4 echo -check generate check code
5 echo -dmalloc link in dmalloc
6 echo -recover compile task code
7 echo -specdir directory
8 echo -debug generate debug symbols
9 echo -runtimedebug printout runtime debug messages
10 echo "-thread use support for multiple threads"
11 echo "-optimize call gcc with -O9 (optimize)"
12 echo "-nooptimize call gcc with -O0 (do not optimize)"
13 echo -curdir directory
14 echo -mainclass class with main method
16 echo -instructionfailures inject code for instructionfailures
20 ROBUSTROOT=~/research/Robust/src
21 REPAIRROOT=~/research/Repair/RepairCompiler/
49 elif [[ $1 = '-mainclass' ]]
51 JAVAOPTS="$JAVAOPTS -mainclass $2"
53 elif [[ $1 = '-dmalloc' ]]
56 elif [[ $1 = '-recover' ]]
59 JAVAOPTS="$JAVAOPTS -task"
60 elif [[ $1 = '-instructionfailures' ]]
62 JAVAOPTS="$JAVAOPTS -instructionfailures"
63 elif [[ $1 = '-check' ]]
66 JAVAOPTS="$JAVAOPTS -conscheck"
67 elif [[ $1 = '-specdir' ]]
73 elif [[ $1 = '-debug' ]]
75 EXTRAOPTIONS="$EXTRAOPTIONS -g"
76 elif [[ $1 = '-runtimedebug' ]]
78 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
79 elif [[ $1 = '-nooptimize' ]]
81 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
82 elif [[ $1 = '-optimize' ]]
84 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
85 elif [[ $1 = '-thread' ]]
87 JAVAOPTS="$JAVAOPTS -thread"
88 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
90 elif [[ $1 = '-curdir' ]]
95 SRCFILES="$SRCFILES $1"
100 BUILDDIR="$CURDIR/tmpbuilddirectory"
108 if $CHECKFLAG #Generate structure files for repair tool
110 JAVAOPTS="$JAVAOPTS -struct structfile"
113 # Build bristlecone/java sources
115 java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
116 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
119 # Build all of the consistency specs
121 if $CHECKFLAG # CHECKFLAG
124 mkdir $BUILDDIR/specdir
125 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
127 echo > $BUILDDIR/specs
129 # compile specs into C code
130 for i in * # iterate over all directories
132 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
135 cat $BUILDDIR/structfile.struct $i.label > $i.struct
136 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
137 cp size.[c,h] $BUILDDIR/specdir
138 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
139 echo $i >> $BUILDDIR/specs
141 done # iterate over all directories
147 echo > $BUILDDIR/checkers.h
148 for i in `cat $BUILDDIR/specs`
150 gcc -O0 -g -c $i\_aux.c
151 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
155 #build and link everything
159 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
162 FILES="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c \
163 $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c \
164 $ROBUSTROOT/Runtime/option.c $ROBUSTROOT/Runtime/garbage.c \
165 $ROBUSTROOT/Runtime/socket.c $ROBUSTROOT/Runtime/GenericHashtable.c \
166 $ROBUSTROOT/Runtime/object.c"
170 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
171 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c"
176 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
181 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
182 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
187 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
190 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
191 tmpbuilddirectory/methods.c $FILES -o $MAINFILE.bin