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