split option processing into its own file
[IRC.git] / Robust / src / buildscriptrepair
1 #!/bin/bash
2 # arguments are:
3 # 1 Name of executable
4 # 2 Directory containing specs
5 # 3-n List of class files to compile
6
7 ROBUSTROOT=~/research/Robust/src
8 REPAIRROOT=~/research/Repair/RepairCompiler/
9 CURDIR=`pwd`
10 BUILDDIR=$CURDIR/tmpbuilddirectory
11 MAINFILE=$1
12 shift
13
14 cd $1
15 SPECDIR=`pwd`
16 cd $CURDIR
17 shift
18
19 mkdir $BUILDDIR
20 java -cp $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
21 $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -struct $MAINFILE -conscheck \
22 -struct structfile -task $@
23
24 # Build all of the consistency specs
25
26 cd $SPECDIR
27 mkdir $BUILDDIR/specdir
28 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
29
30 echo > $BUILDDIR/specs
31
32 # compile specs into C code
33 for i in *
34 do
35 if [ "$i" != "CVS" ]
36 then
37 cd $SPECDIR/$i
38 cat $BUILDDIR/structfile.struct $i.label > $i.struct
39 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
40 ls
41 cp size.[c,h] $BUILDDIR/specdir
42 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
43 echo $i >> $BUILDDIR/specs
44 fi
45 done
46
47 #compile C code
48
49 cd $BUILDDIR/specdir
50 ./buildrobust
51 echo > $BUILDDIR/checkers.h
52 for i in `cat $BUILDDIR/specs`
53 do
54 gcc -O0 -g -c $i\_aux.c
55 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
56 done
57
58 #build and link everything
59
60 cd $CURDIR 
61 gcc -I$ROBUSTROOT/Runtime -I. -I$BUILDDIR/specdir \
62 -IRuntime/include -I$BUILDDIR -O0 -DBOEHM_GC -DCONSCHECK \
63 -LRuntime/lib/ -lgc -DTASK -g tmpbuilddirectory/methods.c \
64 tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/runtime.c \
65 $ROBUSTROOT/Runtime/file.c \
66 $ROBUSTROOT/Runtime/socket.c \
67 $ROBUSTROOT/Runtime/Queue.c $ROBUSTROOT/Runtime/SimpleHash.c \
68 $ROBUSTROOT/Runtime/checkpoint.c \
69 $ROBUSTROOT/Runtime/option.c \
70 $ROBUSTROOT/Runtime/GenericHashtable.c $BUILDDIR/specdir/*.o -o \
71 $MAINFILE.bin