add Tilera version stuff in buildscript and removes some redundant codes to avoid...
[IRC.git] / Robust / src / buildscript
1 #!/bin/bash
2
3 printhelp() {
4 echo -robustroot set up the ROBUSTROOT to directory other than default one
5 echo -dsm distributed shared memory
6 echo -singleTM single machine committing transactions
7 echo -stmdebug STM debug
8 echo -abortreaders abort readers immediately
9 echo -trueprob double - probabiltiy of true branch
10 echo -dsmcaching -enable caching in dsm runtime
11 echo -mac distributed shared memory mac support
12 echo -check generate check code
13 echo -dmalloc link in dmalloc
14 echo -64bit compile for 64 bit machine
15 echo -joptimize java compiler optimizations
16 echo -dcopts conflict optimizations for transactional memory
17 echo -recover compile task code
18 echo -fastcheck fast checkpointing for Bristlecone
19 echo -specdir directory
20 echo -printflat print out flat representation
21 echo -selfloop task - this task cannot self loop forever
22 echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)"
23 echo -taskstate do task state analysis
24 echo -tagstate do tag state analysis
25 echo -scheduling do task scheduling
26 echo -multicore generate multi-core version binary
27 echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1"
28 echo "-cacheflush enable cache flush in raw version binary (should be used togethere with -raw)"
29 echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)"
30 echo "-rawpath print out execute path information for raw version (should be used together with -raw)"
31 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
32 echo -printscheduling print out scheduling graphs
33 echo -printschedulesim print out scheduling simulator result graphs
34 echo -abcclose close the array boundary check
35 echo "-tilera generate tilera version binary (should be used together with -multicore"
36 echo "-raw generate raw version binary (should be used together with -multicore)"
37 echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)"
38 echo -threadsimulate generate multi-thread simulate version binary
39 echo -optional enable optional
40 echo -debug generate debug symbols
41 echo -prefetch do prefetch analysis
42 echo -transstats generates transaction stats on commits and aborts
43 echo -garbagestats Print garbage collection statistics
44 echo -webinterface enable web interface
45 echo -runtimedebug printout runtime debug messages
46 echo "-thread use support for multiple threads"
47 echo "-optimize call gcc with -O9 (optimize)"
48 echo "-nooptimize call gcc with -O0 (do not optimize)"
49 echo -curdir directory 
50 echo -mainclass class with main method
51 echo -o binary
52 echo -nojava do not run bristlecone compiler
53 echo -instructionfailures inject code for instructionfailures
54 echo -profile build with profile options
55 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
56 echo "-enable-assertions execute assert statements during compilation"
57 echo -justanalyze exit after compiler analyses complete
58 echo -help help
59 }
60
61 ABORTREADERS=false;
62 ROBUSTROOT=~/research/Robust/src
63 DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/
64 REPAIRROOT=~/research/Repair/RepairCompiler/
65 CURDIR=`pwd`
66 DSMFLAG=false
67 SINGLETM=false
68 NOJAVA=false
69 CHECKFLAG=false
70 RECOVERFLAG=false
71 MLPFLAG=false
72 MLPDEBUG=false
73 MULTICOREFLAG=false
74 RAWFLAG=false
75 TILERAFLAG=false
76 CACHEFLUSHFLAG=false
77 RAWCONFIG=''
78 DEBUGFLAG=false
79 RAWPATHFLAG=false
80 PROFILEFLAG=false
81 USEIOFLAG=false
82 INTERRUPTFLAG=false
83 THREADSIMULATEFLAG=false;
84 USEDMALLOC=false
85 THREADFLAG=false
86 FASTCHECK=false
87 SPECDIR=`pwd`
88 SRCFILES=''
89 EXTRAOPTIONS=''
90 MAINFILE='a'
91 JAVAFORWARDOPTS=''
92 JAVAOPTS=''
93 OPTIONALFLAG=false
94 EXITAFTERANALYSIS=false
95
96 if [[ -z $1 ]]
97 then
98 printhelp
99 exit
100 fi
101
102 while [[ -n $1 ]]
103 do
104 if [[ $1 = '-help' ]]
105 then
106 printhelp
107 exit
108 elif [[ $1 = '-justanalyze' ]]
109 then
110 EXITAFTERANALYSIS=true
111 elif [[ $1 = '-abortreaders' ]]
112 then
113 ABORTREADERS=true
114 EXTRAOPTIONS="$EXTRAOPTIONS -DABORTREADERS"
115 JAVAOPTS="$JAVAOPTS -abortreaders"
116 elif [[ $1 = '-robustroot' ]]
117 then
118 ROBUSTROOT="$2"
119 shift
120 elif [[ $1 = '-nojava' ]]
121 then
122 NOJAVA=true
123 elif [[ $1 = '-garbagestats' ]]
124 then
125 EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS"
126 elif [[ $1 = '-64bit' ]]
127 then
128 EXTRAOPTIONS="$EXTRAOPTIONS -DBIT64"
129 elif [[ $1 = '-fastcheck' ]]
130 then
131 EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK"
132 JAVAOPTS="$JAVAOPTS -fastcheck"
133 FASTCHECK=true
134 elif [[ $1 = '-o' ]]
135 then
136 MAINFILE="$2"
137 shift
138 elif [[ $1 = '-mainclass' ]]
139 then
140 JAVAOPTS="$JAVAOPTS -mainclass $2"
141 shift
142 elif [[ $1 = '-selfloop' ]]
143 then
144 JAVAOPTS="$JAVAOPTS -selfloop $2"
145 shift
146 elif [[ $1 = '-excprefetch' ]]
147 then
148 JAVAOPTS="$JAVAOPTS -excprefetch $2"
149 shift
150 elif [[ $1 = '-dsm' ]]
151 then
152 JAVAOPTS="$JAVAOPTS -dsm"
153 DSMFLAG=true
154 elif [[ $1 = '-singleTM' ]]
155 then
156 JAVAOPTS="$JAVAOPTS -singleTM"
157 EXTRAOPTIONS="$EXTRAOPTIONS -DSTM"
158 SINGLETM=true
159 elif [[ $1 = '-stmdebug' ]]
160 then
161 EXTRAOPTIONS="$EXTRAOPTIONS -DSTMDEBUG"
162 elif [[ $1 = '-prefetch' ]]
163 then
164 JAVAOPTS="$JAVAOPTS -prefetch"
165 elif [[ $1 = '-transstats' ]]
166 then
167 EXTRAOPTIONS="$EXTRAOPTIONS -DTRANSSTATS"
168 elif [[ $1 = '-printflat' ]]
169 then
170 JAVAOPTS="$JAVAOPTS -printflat"
171 elif [[ $1 = '-trueprob' ]]
172 then
173 JAVAOPTS="$JAVAOPTS -trueprob $2"
174 shift
175 elif [[ $1 = '-mac' ]]
176 then
177 EXTRAOPTIONS="$EXTRAOPTIONS -DMAC"
178 elif [[ $1 = '-profile' ]]
179 then
180 PROFILEFLAG=true
181 EXTRAOPTIONS="$EXTRAOPTIONS -pg"
182 elif [[ $1 = '-useio' ]]
183 then
184 USEIOFLAG=true
185 elif [[ $1 = '-taskstate' ]]
186 then
187 JAVAOPTS="$JAVAOPTS -taskstate"
188 elif [[ $1 = '-tagstate' ]]
189 then
190 JAVAOPTS="$JAVAOPTS -tagstate"
191 elif [[ $1 = '-scheduling' ]]
192 then
193 JAVAOPTS="$JAVAOPTS -scheduling"
194 elif [[ $1 = '-multicore' ]]
195 then
196 MULTICOREFLAG=true
197 JAVAOPTS="$JAVAOPTS -multicore"
198 elif [[ $1 = '-numcore' ]]
199 then
200 JAVAOPTS="$JAVAOPTS -numcore $2"
201 shift
202 elif [[ $1 = '-raw' ]]
203 then
204 RAWFLAG=true
205 elif [[ $1 = '-tilera' ]]
206 then
207 TILERAFLAG=true
208 elif [[ $1 = '-cacheflush' ]]
209 then
210 CACHEFLUSHFLAG=true
211 elif [[ $1 = '-rawconfig' ]]
212 then
213 RAWCONFIG="$2"
214 shift
215 elif [[ $1 = '-interrupt' ]]
216 then
217 INTERRUPTFLAG=true
218 elif [[ $1 = '-threadsimulate' ]]
219 then
220 THREADSIMULATEFLAG=true
221 elif [[ $1 = '-abcclose' ]]
222 then
223 JAVAOPTS="$JAVAOPTS -abcclose"
224 elif [[ $1 = '-optional' ]]
225 then
226 JAVAOPTS="$JAVAOPTS -optional"
227 OPTIONALFLAG=true
228 elif [[ $1 = '-dmalloc' ]]
229 then
230 USEDMALLOC=true
231 elif [[ $1 = '-recover' ]]
232 then
233 RECOVERFLAG=true
234 JAVAOPTS="$JAVAOPTS -task"
235 elif [[ $1 = '-useprofile' ]]
236 then
237 JAVAOPTS="$JAVAOPTS -useprofile"
238 elif [[ $1 = '-webinterface' ]]
239 then
240 JAVAOPTS="$JAVAOPTS -webinterface"
241 elif [[ $1 = '-instructionfailures' ]]
242 then
243 JAVAOPTS="$JAVAOPTS -instructionfailures"
244 elif [[ $1 = '-joptimize' ]]
245 then
246 JAVAOPTS="$JAVAOPTS -optimize"
247 elif [[ $1 = '-dcopts' ]]
248 then
249 JAVAOPTS="$JAVAOPTS -dcopts"
250 elif [[ $1 = '-mlp' ]]
251 then
252 JAVAOPTS="$JAVAOPTS -mlp"
253 elif [[ $1 = '-mlpdebug' ]]
254 then
255 JAVAOPTS="$JAVAOPTS -mlpdebug"
256 elif [[ $1 = '-check' ]]
257 then
258 CHECKFLAG=true
259 JAVAOPTS="$JAVAOPTS -conscheck"
260 elif [[ $1 = '-enable-assertions' ]]
261 then
262 JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea"
263 elif [[ $1 = '-specdir' ]]
264 then
265 cd $2
266 SPECDIR=`pwd`
267 cd $CURDIR
268 shift
269 elif [[ $1 = '-debug' ]]
270 then
271 DEBUGFLAG=true
272 EXTRAOPTIONS="$EXTRAOPTIONS -g"
273 elif [[ $1 = '-rawpath' ]]
274 then
275 RAWPATHFLAG=true
276 elif [[ $1 = '-runtimedebug' ]]
277 then
278 EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG"
279 elif [[ $1 = '-dsmcaching' ]]
280 then
281 EXTRAOPTIONS="$EXTRAOPTIONS -DCACHE"
282 elif [[ $1 = '-rangeprefetch' ]]
283 then
284 EXTRAOPTIONS="$EXTRAOPTIONS -DRANGEPREFETCH"
285 elif [[ $1 = '-nooptimize' ]]
286 then
287 EXTRAOPTIONS="$EXTRAOPTIONS -O0"
288 elif [[ $1 = '-optimize' ]]
289 then
290 EXTRAOPTIONS="$EXTRAOPTIONS -O9"
291 elif [[ $1 = '-thread' ]]
292 then
293 JAVAOPTS="$JAVAOPTS -thread"
294 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread"
295 THREADFLAG=true
296 elif [[ $1 = '-distributioninfo' ]]
297 then
298 JAVAOPTS="$JAVAOPTS -distributioninfo"
299 elif [[ $1 = '-curdir' ]]
300 then
301 CURDIR=$2
302 shift
303 elif [[ $1 = '-outputdir' ]]
304 then
305 JAVAOPTS="$JAVAOPTS -outputdir $2"
306 shift
307 else
308 SRCFILES="$SRCFILES $1"
309 fi
310 shift
311 done
312
313 BUILDDIR="$CURDIR/tmpbuilddirectory"
314
315 cd $1
316 cd $CURDIR
317 shift
318
319 mkdir $BUILDDIR
320
321 if $CHECKFLAG #Generate structure files for repair tool
322 then
323 JAVAOPTS="$JAVAOPTS -struct structfile"
324 fi
325
326 # Setup class path
327
328 if $RECOVERFLAG
329 then
330 if $FASTCHECK
331 then
332 #fast transactions
333 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/FastCheck"
334 else
335 #base bristlecone files
336 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Bristlecone"
337 fi
338 else
339 if $DSMFLAG
340 then
341 #dsm stuff
342 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaDSM"
343 elif $SINGLETM
344 then
345 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaSTM"
346 elif $THREADFLAG
347 then
348 #threading java stuff
349 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/JavaThread"
350 fi
351 #base java stuff
352 JAVAOPTS="$JAVAOPTS -classlibrary $ROBUSTROOT/ClassLibrary/Java"
353 fi
354
355 # Build bristlecone/java sources
356
357 if $MULTICOREFLAG
358 then
359 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx800m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
360 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ \
361 -dir $BUILDDIR $JAVAOPTS $SRCFILES
362 then exit $?
363 fi
364 else
365 #if ! ${ROBUSTROOT}/ourjava -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
366 if ! $NOJAVA
367 then
368 if ! ${ROBUSTROOT}/ourjava -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \
369 $ROBUSTROOT/ClassLibrary/ -classlibrary $ROBUSTROOT/ClassLibrary/gnu/ -dir $BUILDDIR -precise \
370 $JAVAOPTS $SRCFILES
371 then exit $?
372 fi
373 fi
374 fi
375
376 if $EXITAFTERANALYSIS
377 then
378 exit
379 fi
380
381 # Build all of the consistency specs
382
383 if $CHECKFLAG # CHECKFLAG
384 then
385 cd $SPECDIR
386 mkdir $BUILDDIR/specdir
387 cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir
388
389 echo > $BUILDDIR/specs
390
391 # compile specs into C code
392 for i in * # iterate over all directories
393 do
394 if [[ "$i" != "CVS" ]] # CVSDIR CHECK
395 then
396 cd $SPECDIR/$i
397 cat $BUILDDIR/structfile.struct $i.label > $i.struct
398 java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i
399 cp size.[c,h] $BUILDDIR/specdir
400 cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir
401 echo $i >> $BUILDDIR/specs
402 fi # CVSDIR CHECK
403 done # iterate over all directories
404
405 #compile C code
406
407 cd $BUILDDIR/specdir
408 ./buildrobust
409 echo > $BUILDDIR/checkers.h
410 for i in `cat $BUILDDIR/specs`
411 do
412 gcc -O0 -g -fbounds-check -c $i\_aux.c
413 echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h
414 done
415 fi # CHECKFLAG
416
417 #build and link everything
418
419 if $RAWFLAG
420 then # RAWFLAG
421 RAWDIR="$CURDIR/raw"
422 MAKEFILE="Makefile.raw"
423 mkdir $RAWDIR
424 cd $RAWDIR
425 make clean
426 rm ./*
427
428 export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW"
429
430 if $CACHEFLUSHFLAG
431 then # print path
432 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DCACHEFLUSH"
433 fi
434
435 if $RAWPATHFLAG
436 then # print path
437 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWPATH"
438 fi
439
440 if $DEBUGFLAG
441 then #debug version
442 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DDEBUG"
443 fi
444
445 if $PROFILEFLAG
446 then # profile version
447 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DPROFILE"
448 fi
449
450 if $USEIOFLAG
451 then # useio version
452 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DUSEIO"
453 fi
454
455 if $INTERRUPTFLAG
456 then #INTERRUPT version
457 RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT"
458 fi #INTERRUPT version
459
460 if $USEIOFLAG
461 then # useio version
462 MAKEFILE="$MAKEFILE.io"
463 echo "+++++++++++use Makefile.raw.io++++++++++++++++"
464 else
465 MAKEFILE="$MAKEFILE.$RAWCONFIG"
466 fi #useio version
467
468 cp $ROBUSTROOT/Runtime/RAW/$MAKEFILE ./Makefile
469 cp ../Runtime/*.c ./
470 cp ../Runtime/*.h ./
471 cp ../Runtime/*.S ./
472 cp ../Runtime/*.s ./
473 cp ../Runtime/RAW/*.c ./
474 cp ../Runtime/RAW/*.h ./
475 cp ../Runtime/RAW/*.S ./
476 cp ../Runtime/RAW/*.s ./
477 cp ../tmpbuilddirectory/*.c ./
478 cp ../tmpbuilddirectory/*.h ./
479
480 make
481
482 elif $TILERAFLAG
483 then # TILERAFLAG
484 TILERADIR="$CURDIR/tilera"
485 MAKEFILE="Makefile.tilera"
486 mkdir $TILERADIR
487 cd $TILERADIR
488 make clean
489 rm ./*
490
491 export TILERACFLAGS="-DTASK -DMULTICORE"
492
493 if $CACHEFLUSHFLAG
494 then # print path
495 TILERACFLAGS="${TILERACFLAGS} -DCACHEFLUSH"
496 fi
497
498 if $RAWPATHFLAG
499 then # print path
500 TILERACFLAGS="${TILERACFLAGS} -DRAWPATH"
501 fi
502
503 if $DEBUGFLAG
504 then #debug version
505 TILERACFLAGS="${TILERACFLAGS} -DDEBUG"
506 fi
507
508 if $PROFILEFLAG
509 then # profile version
510 TILERACFLAGS="${TILERACFLAGS} -DPROFILE"
511 fi
512
513 if $USEIOFLAG
514 then # useio version
515 TILERACFLAGS="${TILERACFLAGS} -DUSEIO"
516 fi
517
518 if $INTERRUPTFLAG
519 then #INTERRUPT version
520 TILERACFLAGS="${TILERACFLAGS} -DINTERRUPT"
521 fi #INTERRUPT version
522
523 cp $ROBUSTROOT/Runtime/Tilera/$MAKEFILE ./Makefile
524 cp ../Runtime/multicoretask.c ./
525 cp ../Runtime/multicoreruntime.c ./
526 cp ../Runtime/Queue.c ./
527 cp ../Runtime/file.c ./
528 cp ../Runtime/math.c ./
529 cp ../Runtime/object.c ./
530 cp ../Runtime/GenericHashtable.c ./
531 cp ../Runtime/SimpleHash.c ./
532 cp ../Runtime/ObjectHash.c ./
533 cp ../Runtime/socket.c ./
534 cp ../Runtime/taskdefs.c ./
535 cp ../Runtime/methods.c ./
536 cp ../Runtime/mem.c ./
537 cp ../Runtime/GenericHashtable.h ./
538 cp ../Runtime/mem.h ./
539 cp ../Runtime/multicoreruntime.h ./
540 cp ../Runtime/object.h ./
541 cp ../Runtime/ObjectHash.h ./
542 cp ../Runtime/Queue.h ./
543 cp ../Runtime/runtime.h ./
544 cp ../Runtime/SimpleHash.h ./
545 cp ../Runtime/Tilera/*.c ./
546 cp ../Runtime/Tilera/*.h ./
547 cp ../tmpbuilddirectory/*.c ./
548 cp ../tmpbuilddirectory/*.h ./
549
550 else #!RAWFLAG && !TILERAFLAG
551 cd $CURDIR 
552
553 INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \
554 -I$BUILDDIR"
555
556 if $MULTICOREFLAG
557 then
558 RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c"
559 else
560 RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c"
561 fi
562
563 FILES="$RUNTIMEFILE \
564 $ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \
565 $ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \
566 $ROBUSTROOT/Runtime/ObjectHash.c \
567 $ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \
568 $ROBUSTROOT/Runtime/math.c \
569 $ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c"
570
571 if $DSMFLAG
572 then
573 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME"
574 FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.c $DSMRUNTIME/machinepile.c $ROBUSTROOT/Runtime/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRUNTIME/sockpool.c $DSMRUNTIME/addUdpEnhance.c $DSMRUNTIME/signal.c $DSMRUNTIME/gCollect.c $DSMRUNTIME/addPrefetchEnhance.c $DSMRUNTIME/dsmlock.c $DSMRUNTIME/prefetch.c"
575 fi
576
577 if $SINGLETM
578 then
579 EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -I$DSMRUNTIME"
580 FILES="$FILES $DSMRUNTIME/dsmlock.c $DSMRUNTIME/singleTMCommit.c $DSMRUNTIME/stmlookup.c $ROBUSTROOT/Runtime/thread.c"
581 fi
582
583 if $ABORTREADERS
584 then
585 FILES="$FILES $DSMRUNTIME/abortreaders.c"
586 fi
587
588 if $FASTCHECK
589 then
590 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
591 fi
592
593 if $MLP
594 then
595 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"
596 fi
597
598 if $RECOVERFLAG
599 then
600 EXTRAOPTIONS="$EXTRAOPTIONS -DTASK"
601 if $MULTICOREFLAG
602 then
603 EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE"
604 fi
605 FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c $ROBUSTROOT/Runtime/chash.c"
606 if $RAWFLAG
607 then
608 EXTRAOPTIONS="$EXTRAOPTIONS -DRAW"
609 fi
610 if $THREADSIMULATEFLAG
611 then
612 # -lpthread for pthread functions, -lrt for message queue functions
613 EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt"
614 fi
615 fi
616
617 if $OPTIONALFLAG
618 then
619 EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL"
620 FILES="$FILES tmpbuilddirectory/optionalarrays.c"
621 fi
622
623 if $THREADFLAG
624 then
625 FILES="$FILES $ROBUSTROOT/Runtime/thread.c"
626 fi
627
628 if $CHECKFLAG
629 then
630 EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o"
631 INCLUDES="$INCLUDES -I$BUILDDIR/specdir"
632 fi
633
634 if $USEDMALLOC
635 then
636 EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
637 fi
638
639 if $MULTICOREFLAG
640 then
641 gcc $INCLUDES $EXTRAOPTIONS \
642 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
643 else
644 gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \
645 tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin
646 fi
647
648 fi #!RAWFLAG
649
650 exit
651