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