4 echo -check generate check code
5 echo -recover compile task code
6 echo -specdir directory
7 echo -debug generate debug symbols
8 echo -runtimedebug printout runtime debug messages
9 echo "-thread use support for multiple threads"
10 echo "-optimize call gcc with -O9 (optimize)"
11 echo "-nooptimize call gcc with -O0 (do not optimize)"
12 echo -curdir directory
13 echo -mainclass class with main method
15 echo -instructionfailures inject code for instructionfailures
19 ROBUSTROOT=~/research/Robust/src
20 REPAIRROOT=~/research/Repair/RepairCompiler/
46 elif [[ $1 = '-mainclass' ]]
48 JAVAOPTS="$JAVAOPTS -mainclass $2"
50 elif [[ $1 = '-recover' ]]
53 JAVAOPTS="$JAVAOPTS -task"
54 elif [[ $1 = '-instructionfailures' ]]
56 JAVAOPTS="$JAVAOPTS -instructionfailures"
57 elif [[ $1 = '-check' ]]
60 JAVAOPTS="$JAVAOPTS -conscheck"
61 elif [[ $1 = '-specdir' ]]
67 elif [[ $1 = '-debug' ]]
69 EXTRAOPTIONS="$EXTRAOPTIONS -g"
70 elif [[ $1 = '-runtimedebug' ]]
72 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
73 elif [[ $1 = '-nooptimize' ]]
75 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
76 elif [[ $1 = '-optimize' ]]
78 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
79 elif [[ $1 = '-thread' ]]
81 JAVAOPTS="$JAVAOPTS -thread"
82 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS"
83 elif [[ $1 = '-curdir' ]]
88 SRCFILES="$SRCFILES $1"
93 BUILDDIR="$CURDIR/tmpbuilddirectory"
101 if $CHECKFLAG #Generate structure files for repair tool
103 JAVAOPTS="$JAVAOPTS -struct structfile"
106 # Build bristlecone/java sources
108 java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
109 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \
112 # Build all of the consistency specs
114 if $CHECKFLAG # CHECKFLAG
117 mkdir $BUILDDIR/specdir
118 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
120 echo > $BUILDDIR/specs
122 # compile specs into C code
123 for i in * # iterate over all directories
125 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
128 cat $BUILDDIR/structfile.struct $i.label > $i.struct
129 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
130 cp size.[c,h] $BUILDDIR/specdir
131 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
132 echo $i >> $BUILDDIR/specs
134 done # iterate over all directories
140 echo > $BUILDDIR/checkers.h
141 for i in `cat $BUILDDIR/specs`
143 gcc -O0 -g -c $i\_aux.c
144 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
148 #build and link everything
152 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
155 FILES="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/file.c \
156 $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c \
157 $ROBUSTROOT/Runtime/option.c $ROBUSTROOT/Runtime/garbage.c \
158 $ROBUSTROOT/Runtime/socket.c $ROBUSTROOT/Runtime/GenericHashtable.c"
162 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
163 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c"
165 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
170 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
171 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
174 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
175 tmpbuilddirectory/methods.c $FILES -o $MAINFILE.bin