1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
|
#!/bin/sh
## This script shall wrap/hide how we are going to compile C++
## source files within the ANTLR (www.antlr.org) project.
test -z "${verbose}" && {
verbose=@VERBOSE@
}
## check whether we have something to do ..
test -z "$1" && exit 0
## get arguments
ARGV="$*"
## Command CXX is precomputed but user may override.
if test -z "${CXX}" ; then
CXX="@CXX@"
cxx="@cxx@"
else
cxx="`basename $CXX`"
cxx="`echo $cxx|sed 's,\..*$,,'`"
fi
## use whitespace to separate dirs, don't use compiler specific
## options like '-I' etc. That will be added at runtime when we
## know what compiler is in use.
## 2.7.6: take CXXINCLUDE from environment into account.
CXXINCLUDE=". ${CXXINCLUDE} @abs_top_srcdir@/lib/cpp"
## according to Kurt we need to set some additional included
## paths when using 'cxx' on Tru64. Here we go ..
case $cxx in
cxx)
CXXINCLUDE="$CXXINCLUDE @abs_top_srcdir@/include"
CXXINCLUDE="$CXXINCLUDE /usr/include/cxx"
CXXINCLUDE="$CXXINCLUDE /usr/include"
;;
esac
test -z "${DEBUG}" && {
DEBUG="@DEBUG@"
}
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
## Here we set flags for well know programs ##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
##
## Do not set variable CXXFLAGS here, just use it's sister
## variable 'cxxflags'. This allows the caller to override
## this settings - see handling of CXXFLAGS below.
case "${cxx}" in
cxx)
cxxflags="-D__DECCXX -ieee -DDEC -O0 -arch host -trapuv -check_bounds -warnprotos -std1 -noansi_args -portable"
#-I/spare/mccalke/antlr-2.7.5-new/include -I/usr/include/cxx -I/usr/include -L/usr/lib/cmplrs/cxx -L/usr/lib/cmplrs/cxx/V6.5-042"
;;
gcc)
cxxflags="-felide-constructors -pipe"
case "${DEBUG}" in
0)
cxxflags="-O2 -DNDEBUG ${cxxflags}"
;;
1)
cxxflags="-g ${cxxflags} -W -Wall"
;;
esac
;;
cl)
cxxflags="-nologo -GX -GR"
;;
bcc32)
cxxflags="-q -v -w-inl -w-aus -w-par -w-ccc"
;;
CC)
cxxflags="-g"
;;
xlC)
cxxflags=""
;;
aCC)
cxxflags=""
;;
*)
cxxflag=""
;;
esac
case ${cxx} in
bcc32|CC|aCC|xlC|cxx)
CXX_OPT_INCLUDE="-I"
;;
*)
CXX_OPT_INCLUDE="-I "
;;
esac
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
## **NO CHANGE NECESSARY BELOW THIS LINE - EXPERTS ONLY** ##
##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
## If specific flags have been configured then they overrule
## our precomputed flags. Still a user can override by using
## environment variable $CXXFLAGS - see below.
test -n "@CXXFLAGS@" && {
set x @CXXFLAGS@ ; shift
case $1 in
+)
shift
CXXFLAGS="${cxxflags} $*"
;;
-)
shift
cxxflags="$* ${cxxflags}"
;;
=)
shift
cxxflags="$*"
;;
*)
if test -z "$1" ; then
cxxflags="${cxxflags}"
else
cxxflags="$*"
fi
;;
esac
}
## Regardless what has been configured, a user should always
## be able to override without the need to reconfigure or
## change this file. Therefore we check variable $CXXFLAGS.
## In almost all cases the precomputed flags are just ok but
## some additional flags are needed. To support this in an
## easy way, we check for the very first value. If this val-
## ue is
## '+' -> append content of CXXFLAGS to precomputed flags
## '-' -> prepend content -*-
## '=' -> do not use precomputed flags
## If none of these characters are given, the behaviour will
## be the same as if "=" would have been given.
set x ${CXXFLAGS} ; shift
case $1 in
+)
shift
CXXFLAGS="${cxxflags} $*"
;;
-)
shift
CXXFLAGS="$* ${cxxflags}"
;;
=)
shift
CXXFLAGS="$*"
;;
*)
if test -z "$1" ; then
CXXFLAGS="${cxxflags}"
else
CXXFLAGS="$*"
fi
;;
esac
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##
## No c u s t o m i z a t i o n below this line ##
##%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%##
## translate args - requires that we are on cygwin. Other-
## wise we have to assume that args are already in proper
## format.
case "@build_os@" in
cygwin)
case "@cxx@" in
cl|bcc32)
ARGV="`cygpath -m ${ARGV}`"
;;
esac
;;
esac
## we only add valid directories - note that CXXINCLUDE is
## supposed to contain directories and not optionized'
## arguments.
set x ${CXXINCLUDE} ; shift
Y=""
## filter non valid directories
while test $# -gt 0 ; do
y="$1" ; shift
test -d "${y}" && {
Y="${Y} ${y}"
}
done
set x ${Y} ; shift ; Y=""
## translate directories on cygwin
case "@build_os@" in
cygwin)
set x `cygpath -m ${*}` ; shift
;;
esac
## prefix each arg with CXX_OPT_INCLUDE (for instance -I)
while test $# -gt 0 ; do
y="$1" ; shift
Y="${Y} ${CXX_OPT_INCLUDE}${y}"
done
CXXINCLUDE="${Y}"
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx###
### LAST CHANCE COMPILER TUNIG HERE ###
###================================================================###
case "${cxx}" in
cl)
;;
bcc32)
;;
gcc)
;;
xlC)
;;
CC)
;;
aCC)
;;
cxx)
;;
*)
;;
esac
case "@cxx@" in
*)
CXXFLAGS="${CXXFLAGS} -c"
;;
esac
###xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
### all variables participating in calling must be set now..
###---------------------------------------------------------
CXX_CMD="${CXX} ${CXXFLAGS} ${CXXINCLUDE}"
test -z "${ARGV}" && exit 0
for x in ${ARGV} ; do
cmd="$CXX_CMD $x"
case "${verbose}" in
0|no|nein|non)
echo "*** compiling $x"
;;
*)
echo $cmd
;;
esac
$cmd || {
rc=$?
cat <<EOF
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> E R R O R <<
============================================================
$cmd
============================================================
Got an error while trying to execute command above. Error
messages (if any) must have shown before. The exit code was:
exit($rc)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
EOF
exit $rc
}
done
exit 0
|