1 | #!/bin/sh |
---|
2 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
3 | ## This file is part of ANTLR. See LICENSE.txt for licence ## |
---|
4 | ## details. Written by W. Haefelinger. ## |
---|
5 | ## ## |
---|
6 | ## Copyright (C) Wolfgang Haefelinger, 2004 ## |
---|
7 | ## ## |
---|
8 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
9 | test -z "${verbose}" && { |
---|
10 | verbose=0 |
---|
11 | } |
---|
12 | ## This script will be called to compile a list of java files on |
---|
13 | ## all UNIX/Cygwin platforms. Whether we'll use SUN java, gcj or |
---|
14 | ## another Java compiler doesn't matter. |
---|
15 | |
---|
16 | ## precompute some variables required or useful to compile |
---|
17 | ## Java source files. |
---|
18 | |
---|
19 | ## srcdir shall contain absolute path to package directory. |
---|
20 | srcdir="/usr/neuro/local/yao/yao9/share/antlr-2.7.7/scripts/.." |
---|
21 | |
---|
22 | ## objdir shall contain absolute path to this build directory. |
---|
23 | objdir="/usr/neuro/local/yao/yao9/share/antlr-2.7.7" |
---|
24 | |
---|
25 | ## bootclasspath shall contain jar or zip file required to |
---|
26 | ## boot Javac. An example where this variable is used is |
---|
27 | ## jikes. Note, this variable can be plain empty. |
---|
28 | bootclasspath="" |
---|
29 | |
---|
30 | classpath="/usr/neuro/local/yao/yao9/share/antlr-2.7.7/antlr/antlr.jar" |
---|
31 | |
---|
32 | case linux-gnu in |
---|
33 | cygwin) |
---|
34 | sep=";" |
---|
35 | ;; |
---|
36 | macos*) |
---|
37 | sep=";" |
---|
38 | ;; |
---|
39 | *) |
---|
40 | sep=":" |
---|
41 | ;; |
---|
42 | esac |
---|
43 | |
---|
44 | ## When on cygwin we translage paths into mixed notation (DOS |
---|
45 | ## with forward slashes). |
---|
46 | case linux-gnu in |
---|
47 | cygwin) |
---|
48 | test -n "$1" && { |
---|
49 | ARGV="`cygpath -m $*`" |
---|
50 | } |
---|
51 | test -n "${srcdir}" && { |
---|
52 | srcdir="`cygpath -m ${srcdir}`" |
---|
53 | } |
---|
54 | test -n "${objdir}" && { |
---|
55 | objdir="`cygpath -m ${objdir}`" |
---|
56 | } |
---|
57 | test -n "${bootclasspath}" && { |
---|
58 | bootclasspath="`cygpath -m ${bootclasspath}`" |
---|
59 | } |
---|
60 | test -n "${classpath}" && { |
---|
61 | classpath="`cygpath -m ${classpath}`" |
---|
62 | } |
---|
63 | ;; |
---|
64 | *) |
---|
65 | ARGV="$*" |
---|
66 | ;; |
---|
67 | esac |
---|
68 | |
---|
69 | ## Command JAVAC is precomputed but user may override. |
---|
70 | if test -z "${JAVAC}" ; then |
---|
71 | JAVAC="/usr/bin/javac" |
---|
72 | javac="javac" |
---|
73 | else |
---|
74 | javac=`basename $JAVAC` |
---|
75 | javac=`echo $javac|sed 's,\..*$,,'` |
---|
76 | fi |
---|
77 | |
---|
78 | ## Take environment variable CLASSPATH into account |
---|
79 | if test -n "$CLASSPATH" ; then |
---|
80 | ifs_save=$IFS |
---|
81 | IFS=$sep |
---|
82 | for d in $CLASSPATH ; do |
---|
83 | case linux-gnu in |
---|
84 | cygwin) |
---|
85 | d=`echo $d` |
---|
86 | ;; |
---|
87 | esac |
---|
88 | classpath="$classpath$sep$d" |
---|
89 | done |
---|
90 | IFS=$ifs_save |
---|
91 | fi |
---|
92 | ## Compute the flags for well known compilers. Note that a user |
---|
93 | ## may override this settings by providing JAVACFLAGS - see be- |
---|
94 | ## low. |
---|
95 | case "${javac}" in |
---|
96 | jikes) |
---|
97 | javacflags="-nowarn -d ." |
---|
98 | javacflags="${javacflags} -sourcepath ${srcdir}" |
---|
99 | javacflags="${javacflags} -bootclasspath ${bootclasspath}" |
---|
100 | javacflags="${javacflags} -classpath ${classpath}" |
---|
101 | ;; |
---|
102 | javac) |
---|
103 | javacflags="-d ." |
---|
104 | javacflags="${javacflags} -sourcepath ${srcdir}" |
---|
105 | javacflags="${javacflags} -classpath ${classpath}" |
---|
106 | ;; |
---|
107 | gcj) |
---|
108 | javacflags="-d ." |
---|
109 | javacflags="${javacflags} -I${srcdir} -C" |
---|
110 | javacflags="${javacflags} -classpath ${classpath}" |
---|
111 | ;; |
---|
112 | *) |
---|
113 | javacflags="-d ." |
---|
114 | javacflags="${javacflags} -sourcepath ${srcdir}" |
---|
115 | javacflags="${javacflags} -classpath ${classpath}" |
---|
116 | ;; |
---|
117 | esac |
---|
118 | |
---|
119 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
120 | ## **NO CHANGE NECESSARY BELOW THIS LINE - EXPERTS ONLY** ## |
---|
121 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
122 | |
---|
123 | |
---|
124 | ## If specific flags have been configured then they overrule |
---|
125 | ## our precomputed flags. Still a user can override by using |
---|
126 | ## environment variable $JAVACFLAGS - see below. |
---|
127 | test -n "" && { |
---|
128 | set x ; shift |
---|
129 | case $1 in |
---|
130 | +) |
---|
131 | shift |
---|
132 | JAVACFLAGS="${javacflags} $*" |
---|
133 | ;; |
---|
134 | -) |
---|
135 | shift |
---|
136 | javacflags="$* ${javacflags}" |
---|
137 | ;; |
---|
138 | =) |
---|
139 | shift |
---|
140 | javacflags="$*" |
---|
141 | ;; |
---|
142 | *) |
---|
143 | if test -z "$1" ; then |
---|
144 | javacflags="${javacflags}" |
---|
145 | else |
---|
146 | javacflags="$*" |
---|
147 | fi |
---|
148 | ;; |
---|
149 | esac |
---|
150 | } |
---|
151 | |
---|
152 | ## Regardless what has been configured, a user should always |
---|
153 | ## be able to override without the need to reconfigure or |
---|
154 | ## change this file. Therefore we check variable $JAVACFLAGS. |
---|
155 | ## In almost all cases the precomputed flags are just ok but |
---|
156 | ## some additional flags are needed. To support this in an |
---|
157 | ## easy way, we check for the very first value. If this val- |
---|
158 | ## ue is |
---|
159 | ## '+' -> append content of JAVACFLAGS to precomputed flags |
---|
160 | ## '-' -> prepend content -*- |
---|
161 | ## '=' -> do not use precomputed flags |
---|
162 | ## If none of these characters are given, the behaviour will |
---|
163 | ## be the same as if "=" would have been given. |
---|
164 | |
---|
165 | set x ${JAVACFLAGS} ; shift |
---|
166 | case $1 in |
---|
167 | +) |
---|
168 | shift |
---|
169 | JAVACFLAGS="${javacflags} $*" |
---|
170 | ;; |
---|
171 | -) |
---|
172 | shift |
---|
173 | JAVACFLAGS="$* ${javacflags}" |
---|
174 | ;; |
---|
175 | =) |
---|
176 | shift |
---|
177 | JAVACFLAGS="$*" |
---|
178 | ;; |
---|
179 | *) |
---|
180 | if test -z "$1" ; then |
---|
181 | JAVACFLAGS="${javacflags}" |
---|
182 | else |
---|
183 | JAVACFLAGS="$*" |
---|
184 | fi |
---|
185 | ;; |
---|
186 | esac |
---|
187 | |
---|
188 | ## Any special treatment goes here .. |
---|
189 | case "${javac}" in |
---|
190 | jikes) |
---|
191 | ;; |
---|
192 | javac) |
---|
193 | ;; |
---|
194 | gcj) |
---|
195 | ;; |
---|
196 | *) |
---|
197 | ;; |
---|
198 | esac |
---|
199 | |
---|
200 | |
---|
201 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
202 | ## This shall be the command to be excuted below ## |
---|
203 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
204 | |
---|
205 | cmd="${JAVAC} ${JAVACFLAGS} ${ARGV}" |
---|
206 | |
---|
207 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
208 | ## standard template to execute a command ## |
---|
209 | ##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx## |
---|
210 | case "${verbose}" in |
---|
211 | 0|no|nein|non) |
---|
212 | set x `echo $ARGV | wc` |
---|
213 | echo "*** compiling $3 Java file(s)" |
---|
214 | ;; |
---|
215 | *) |
---|
216 | echo CLASSPATH=${CLASSPATH} |
---|
217 | echo $cmd |
---|
218 | ;; |
---|
219 | esac |
---|
220 | |
---|
221 | $cmd || { |
---|
222 | rc=$? |
---|
223 | cat <<EOF |
---|
224 | |
---|
225 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
---|
226 | >> E R R O R << |
---|
227 | ============================================================ |
---|
228 | |
---|
229 | $cmd |
---|
230 | |
---|
231 | ============================================================ |
---|
232 | Got an error while trying to execute command above. Error |
---|
233 | messages (if any) must have shown before. The exit code was: |
---|
234 | exit($rc) |
---|
235 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
---|
236 | EOF |
---|
237 | exit $rc |
---|
238 | } |
---|
239 | exit 0 |
---|