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