source: trunk/yao/share/antlr-2.7.7/scripts/javac.sh @ 1

Last change on this file since 1 was 1, checked in by lnalod, 15 years ago

Initial import of YAO sources

  • Property svn:eol-style set to native
File size: 5.8 KB
Line 
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##
9test -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.
20srcdir="/usr/neuro/local/yao/yao9/share/antlr-2.7.7/scripts/.."
21
22## objdir shall contain absolute path to this build directory.
23objdir="/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.
28bootclasspath=""
29
30classpath="/usr/neuro/local/yao/yao9/share/antlr-2.7.7/antlr/antlr.jar"
31
32case linux-gnu in
33  cygwin)
34    sep=";"
35    ;;
36  macos*)
37    sep=";"
38    ;;
39  *)
40    sep=":"
41    ;;
42esac
43
44## When on cygwin we translage paths into mixed notation (DOS
45## with forward slashes).
46case 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    ;;
67esac
68
69## Command JAVAC is precomputed but user may override.
70if test -z "${JAVAC}" ; then
71  JAVAC="/usr/bin/javac"
72  javac="javac"
73else
74  javac=`basename $JAVAC`
75  javac=`echo $javac|sed 's,\..*$,,'`
76fi
77
78## Take environment variable CLASSPATH into account
79if 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
91fi
92## Compute the flags for well known compilers. Note that a user
93## may override this settings by providing JAVACFLAGS - see be-
94## low.
95case "${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    ;;
117esac
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.
127test -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
165set x ${JAVACFLAGS}  ; shift
166case $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    ;;
186esac
187
188## Any special treatment goes here ..
189case "${javac}" in
190  jikes)
191    ;;
192  javac)
193    ;;
194  gcj)
195    ;;
196  *)
197    ;;
198esac
199
200
201##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
202##    This shall be the command to be excuted below       ##
203##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
204
205cmd="${JAVAC} ${JAVACFLAGS} ${ARGV}"
206
207##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
208##        standard template to execute a command          ##
209##xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx##
210case "${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    ;;
219esac
220
221$cmd || {
222  rc=$?
223  cat <<EOF
224
225xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
226                      >> E R R O R <<
227============================================================
228
229$cmd
230
231============================================================
232Got an error while trying to execute  command  above.  Error
233messages (if any) must have shown before. The exit code was:
234exit($rc)
235xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
236EOF
237  exit $rc
238}
239exit 0
Note: See TracBrowser for help on using the repository browser.