-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·35 lines (29 loc) · 781 Bytes
/
compile.sh
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
#!/bin/bash
CLASSPATH=/usr/share/java:/usr/share/java/bcel.jar
PROJECT=Paralen
JARFILE="$PROJECT.jar"
for JAVAFILE in *.java; do
CLASSFILE=`echo "$JAVAFILE" | sed -e 's,\.java$,.class,'`
DATJAVA=`date +%s --reference="$JAVAFILE"`
DATCLASS=0
if [ -r "$CLASSFILE" ]; then
DATCLASS=`date +%s --reference="$CLASSFILE"`
fi
if [ $DATJAVA -gt $DATCLASS ]; then
echo "Compiling '$JAVAFILE'..."
rm -f "$CLASSFILE"
javac -cp "$CLASSPATH" "$JAVAFILE"
fi
done
CLASSFILE="$PROJECT.class"
JAVAFILE="$PROJECT.java"
DATJAVA=`date +%s --reference="$JAVAFILE"`
DATJAR=0
if [ -r "$JARFILE" ]; then
DATJAR=`date +%s --reference="$JARFILE"`
fi
if [ $DATJAVA -gt $DATJAR ]; then
echo "Creating '$JARFILE'..."
rm -f "$JARFILE"
jar -cvfm0 "$JARFILE" "$PROJECT.MF" "$CLASSFILE"
fi