adding repair build script
[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 -struct \
22 structfile.struct -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 # compile specs into C code
31 for i in *
32 do
33 cd $SPECDIR/$i
34 cp $BUILDDIR/structfile.struct $i.struct
35 java -cp $REPAIRROOT/:. MCC.Compiler -checkonly $i
36 cp size.[c,h] $BUILDDIR/specdir
37 cp $i.c $i_aux.[c,h] $BUILDDIR/specdir
38 echo $i >> $BUILDDIR/specs
39 done
40
41 #compile C code
42
43 cd $BUILDDIR/specdir
44 ./buildruntime
45 for i in `cat $BUILDDIR/specs`
46 do
47 gcc -O0 -g -c $i.c
48 done
49
50 #build and link everything
51
52 gcc -I$ROBUSTROOT/Runtime -I. -IRuntime/include -Itmpbuilddirectory \
53 -O0 -DBOEHM_GC -LRuntime/lib/ -lgc -DTASK -g \
54 tmpbuilddirectory/methods.c tmpbuilddirectory/taskdefs.c \
55 $ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/Queue.c \
56 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/checkpoint.c \
57 $ROBUSTROOT/Runtime/GenericHashtable.c $BUILDDIR/specdir/*.o \
58 -o $MAINFILE.bin