Bug #734: Sanitize braces within strings
[charm.git] / build
blobf9ee16cd1c712d612ee3957af128cf488735ecf4
1 #!/bin/sh
3 # Silly shorthand, used for source reorganization
4 srcbase="$(cd $(dirname $0)/src/; pwd)"
5 src="$srcbase/arch/"
7 more=0
9 syntax() {
10 echo ''
11 echo 'Usage: build <target> <version> <options> [charmc-options ...]'
12 echo ''
13 echo '<targets>: converse charm++ LIBS AMPI FEM bigemulator pose msa'
14 echo '<targets>: doc ps-doc pdf-doc html-doc'
15 if test $more = 1
16 then
17 echo ''
18 echo ' charm++ compile Charm++ core only'
19 echo ' AMPI compile Adaptive MPI on top of Charm++'
20 echo ' FEM compile FEM framework'
21 echo ' LIBS compile additional parallel libraries with Charm++ core'
22 echo ' bigemulator build additional BigSim libraries'
23 echo ' pose build POSE parallel discrete event simulator'
24 echo ' msa build Multiphase Shared Arrays(MSA) library'
25 echo ' Tau build the TAU tracing library for generating TAU performance data'
26 echo ' ChaNGa compile Charm++ core and necessary libraries for ChaNGa'
27 echo ' everylb compile EveryLB suite of load balancing strategies'
28 echo ''
30 echo '<versions>: '
31 ( cd $src ; ls -1 | egrep -v '(^shmem$)|(^mpi$)|(^sim$)|(^net(lrts)?$)|(^multicore$)|(^util$)|(^common$)|(^uth$)|(^conv-mach-fix.sh$)|(^win32$)|(^win64$)|(^lapi$)|(^cell$)|(^(gemini_)?gni$)|(^pami(lrts)?$)|(^verbs$)|(^template$)|(^cuda$)' | pr -3 -t )
32 echo ''
33 echo '<options>: compiler and platform specific options'
34 echo 'icc iccstatic xlc xlc64 gcc clang craycc pgcc pathscale cc cc64 mpcc ecc gcc64 gcc3 mpcc32 mpcc64 mpicxx'
35 echo 'help smp gm tcp scyld clustermatic bigemulator ooc syncft mlogft causalft'
36 echo 'papi pthreads lam'
37 echo '--incdir --libdir --basedir --build-shared --destination --suffix -j'
38 if test $more = 1
39 then
40 echo ''
41 echo 'For platform specific options, use help option:'
42 echo ' help platform specific help, e.g. ./build charm++ net-linux-x86_64 help'
43 echo ''
44 echo 'Choose a compiler (only one option is allowed from this section):'
45 echo ' icc, iccstatic Intel compilers (default or static linking)'
46 echo ' xlc, xlc64 IBM XL compilers (with 64-bit option on architectures with 32-bit modes)'
47 echo ' gcc GNU compiler collection (on platforms where the default differs)'
48 echo ' clang Clang C/C++ compiler'
49 echo ' craycc Cray compilers'
50 echo ' pgcc Portland Group compilers'
51 echo ' pathscale Pathscale compiler suite'
52 echo ' cc, cc64 For Sun WorkShop C++ 32/64 bit compilers'
53 echo ' mpcc SUN Solaris C++ compiler for MPI'
54 echo ' ecc Intel C/C++ compiler for Linux IA64 (Itanium)'
55 echo ' gcc3 GNU GCC/G++ version 3'
56 echo ''
57 echo 'Choose an alternative fortran compiler (only one option is allowed from this section):'
58 echo ' g95 G95 at http://ww.g95.org'
59 echo " pgf90 Portland Group Fortran compiler"
60 echo ' ifort Intel Fortran compiler'
61 echo ''
62 echo 'Platform specific options (choose multiple if apply):'
63 echo ' smp support for SMP, multithreaded charm on each node'
64 echo ' ibverbs use Infiniband Verbs for communication (only for net-linux-x86_64; prefer verbs-*)'
65 echo ' lam Use LAM MPI'
66 echo ' mpt use SGI Message Passing Toolkit (only for mpi version)'
67 echo ' gm use Myrinet for communication'
68 echo ' tcp use TCP sockets for communication (only for net version)'
69 echo ' scyld compile for Scyld Beowulf cluster based on bproc'
70 echo ' clustermatic compile for Clustermatic (support version 3 and 4) '
71 echo ' pthreads compile with pthreads Converse threads'
72 echo ''
73 echo 'Advanced options:'
74 echo ' bigemulator compile for BigSim simulator'
75 echo ' ooc compile with out of core support'
76 echo ' syncft compile with Charm++ fault tolerance support'
77 echo ' mlogft compile with Charm++ message logging fault tolerance support'
78 echo ' papi compile with PAPI performance counter support (if any)'
79 echo ''
80 echo "Charm++ dynamic libraries:"
81 echo " --no-build-shared don't build Charm++'s shared libraries (default)"
82 echo " --build-shared build Charm++ dynamic libraries (.so) "
83 echo ''
84 echo 'Enable/disable features:'
85 $srcbase/scripts/configure --help | grep enable-
86 $srcbase/scripts/configure --help | grep with-
87 echo " --with-production build Charm++ with all optimizations for maximum performance, and disabling all above features"
88 echo ''
89 echo 'Miscellaneous options:'
90 echo ' --incdir=DIR specify additional include path for compiler'
91 echo ' --libdir=DIR specify additional lib path for compiler'
92 echo ' --basedir=DIR shortcut for the above two - DIR/include and DIR/lib'
93 echo ' -j[N] parallel make, N is the number of paralle make jobs'
94 echo " --with-romio build AMPI with ROMIO library"
95 echo " --with-lbtime-type specify real type for the load balancing timers"
96 echo " --destination=DIR build Charm++ inside DIR, by default the destination is <version>"
97 echo " --suffix=DIR append DIR to the destination directory of the Charm++ build"
98 echo " --tau-makefile=FILE Specify which TAU stub makefile to use"
100 echo ''
101 echo '<charmc-options>: normal compiler options e.g. -g -optimize -save -verbose'
102 if test $more = 1
103 then
104 echo ''
105 echo 'Examples:'
106 echo "1. display all supported options for net-linux-x86_64 using 'help':"
107 echo ' ./build charm++ net-linux-x86_64 help'
108 echo '2. compile Charm++ on Linux with all available tuning:'
109 echo ' ./build charm++ net-linux-x86_64 --with-production'
110 echo '3. compile Charm++ for Linux (32bit) clustermatic Beowulf cluster with Intel compiler and optimizations:'
111 echo ' ./build charm++ net-linux clustermatic icc -optimize'
112 echo '4. compile Charm++ for IA64 Linux cluster with MPICH-GM:'
113 echo ' ./build charm++ mpi-linux-ia64 gm -optimize'
114 echo '5. compile Charm++ for Windows with VC++ (Cygwin required):'
115 echo ' ./build charm++ net-win32 -optimize'
116 echo '6. compile on IBM SP with MPI using parallel gmake, 4 jobs simultaneously:'
117 echo ' MAKE=gmake ./build charm++ mpi-sp -j4 -optimize # sh'
118 echo ' setenv MAKE gmake; ./build charm++ mpi-sp -j4 -optimize # csh'
119 echo '7. compile Charm++ with MPI that is installed at /usr/local/mpich:'
120 echo ' ./build charm++ mpi-linux --incdir /usr/local/mpich/include --libdir /usr/local/mpich/lib -optimize'
121 echo ' or in short,'
122 echo ' ./build charm++ mpi-linux --basedir /usr/local/mpich -optimize'
123 echo ' ./build Tau --tau-makefile=/usr/local/packages/TAU/x86_64/lib/Makefile.tau-mpi'
124 echo ''
125 echo 'Note: This script:'
126 echo ' 1. Creates directories <destination> and <destination>/tmp'
127 echo ' 2. Copies src/scripts/Makefile into <destination>/tmp'
128 echo ' 3. Does a "make basics" in <destination>/tmp.'
129 echo ' 3. Does a "make -jN <target> <version> OPTS=<charmc-options>" in <destination>/tmp.'
130 echo "That's all build does. The rest is handled by the Makefile."
131 echo ''
132 echo 'Thank you for using Charm++, please send questions or comments to '
133 echo 'Parallel Programming Lab at University of Illinois at Urbana-Champaign'
134 echo '(email: charm@cs.illinois.edu).'
136 else
137 echo ''
138 echo "To get more detailed help, run ./build --help"
142 Echo() {
143 [ "x$QUIET" = "x--quiet" ] || echo $*
146 printOption() {
147 for prefix in cc conv-mach
149 str="Supported compilers:"
150 [ "$prefix" = "conv-mach" ] && str="Supported options:"
151 opts=""
152 for dir in $OPT_DIRS
154 # echo "Checking for $prefix in $dir"
155 files=`cd $dir; ls $prefix-*.h 2>/dev/null`
156 opts="$opts "`echo $files | sed 's/'$prefix'-\([^.]*\).h/\1/g'`
157 done
158 tmp=.tmp.$$
159 rm -f $tmp; touch $tmp
160 for o in $opts
162 echo $o >> $tmp
163 done
164 opts=`sort $tmp | uniq`
165 rm -f $tmp
166 echo $str $opts
167 done
168 exit 1
171 CheckDir() {
172 for d in $*
174 if test ! -d $d
175 then
176 echo Error: cannot find $d!
177 exit 1
179 done
182 TestIfCompiler() {
183 for dir in $OPT_DIRS
185 [ -f $dir/cc-$1.sh ] && return 1
186 done
187 return 0
190 TestIfOption() {
191 for dir in $OPT_DIRS
193 [ -f $dir/conv-mach-$1.h ] && return 1
194 done
196 echo "Error> option: $1 is not supported in this version!";
197 printOption
201 # start
203 BUILD_CUDA=0
204 MAKEOPTS=""
205 OPTS=""
206 BOPTS=""
207 MORE=""
208 COMPILER=""
209 BASEDIR=
210 LIBDIR=
211 INCDIR=
212 ARCH=
213 BUILD_SHARED="" # default no shared lib
214 WITH_ROMIO=
215 WITH_PRODUCTION=
216 BUILD_EMULATOR=0
217 DESTINATION=""
218 DESTINATION_SUFFIX=""
219 TAU_MAKEFILE=""
220 QUIET=""
222 [ "$1" = '--help' -o "$1" = '-h' ] && more=1 && syntax | ( less || more ) && exit 1
223 [ $# -lt 2 ] && ./smart-build.pl && exit 1
224 PROGRAM=$1
225 shift
227 # find longest prefix of version argument that exists as a directory in $src
228 VERSION=$1
229 VERSOPTS=""
230 testversion=""
231 oldifs=$IFS
232 IFS=-
233 for w in $1; do
234 IFS=$oldifs
235 if [ -z "$testversion" ]; then
236 testversion=$w
237 else
238 testversion="$testversion-$w"
240 if [ -d $src/$testversion ]; then
241 VERSION=$testversion
242 VERSOPTS=""
243 else
244 VERSOPTS="$VERSOPTS $w"
246 done
247 if [ $VERSION = $1 ]; then VERSOPTS=""; fi
249 BASEVERSION=$VERSION;
250 if test -f $src/$BASEVERSION/vdir_link
251 then
252 BASEVERSION=`cat $src/$BASEVERSION/vdir_link`
254 ARCH=`echo $BASEVERSION | sed -e 's@-.*@@'`
255 shift
257 #echo $src
258 #echo $BASEVERSION
259 #echo $ARCH
261 OPT_DIRS="$src/$BASEVERSION $src/$ARCH $src/common"
263 # process remainder of version argument as options, copied from below
264 for w in $VERSOPTS; do
265 # This has to be a build-time option (like "smp", "gcc3", or "kcc")
266 TestIfCompiler $w
267 if [ $? -eq 1 ]
268 then
269 # It specifies a compiler:
270 if [ ! -z "$COMPILER" ]
271 then
272 echo "Error> Tried to specify two compilers: $COMPILER and $w"
273 printOption
275 COMPILER=$w
276 else
277 # It specifies some other option:
278 TestIfOption $w
279 BOPTS="$BOPTS $w"
280 [ $w = "bigemulator" ] && BUILD_EMULATOR=1
281 [ $w = "bigsim" ] && BUILD_EMULATOR=1
283 done
285 while [ ! $# -eq 0 ]
287 case "$1" in
288 "--basedir")
289 shift;
290 for dir in $1
292 CheckDir $dir/include $dir/lib
293 LIBDIR="$LIBDIR -L$dir/lib";
294 INCDIR="$INCDIR -I$dir/include"
295 done
296 shift
298 --basedir=*)
299 basedir=`echo $1 | awk -F= '{print $2}'`
300 for dir in $basedir
302 CheckDir $dir/include $dir/lib
303 LIBDIR="$LIBDIR -L$dir/lib";
304 INCDIR="$INCDIR -I$dir/include"
305 done
306 shift
308 "--libdir")
309 shift; CheckDir $1
310 for dir in $1
312 LIBDIR="$LIBDIR -L$dir";
313 done
314 shift
316 --libdir=*)
317 libdir=`echo $1 | awk -F= '{print $2}'`
318 CheckDir $libdir
319 for dir in $libdir
321 LIBDIR="$LIBDIR -L$dir";
322 done
323 shift
325 "--incdir")
326 shift; CheckDir $1
327 for dir in $1
329 INCDIR="$INCDIR -I$dir";
330 done
331 shift
333 --incdir=*)
334 incdir=`echo $1 | awk -F= '{print $2}'`
335 CheckDir $incdir
336 for dir in $incdir
338 INCDIR="$INCDIR -I$dir";
339 done
340 shift
342 --no-build-shared|--no-shared)
343 #BUILD_SHARED="-no-build-shared";
344 shift
346 --build-shared)
347 BUILD_SHARED="-build-shared";
348 shift
350 --with-romio)
351 WITH_ROMIO="true"; shift
353 --with-production)
354 WITH_PRODUCTION="true"
355 shift
357 --with-*)
358 CONFIG_OPTS="$CONFIG_OPTS $1"
359 shift
361 --without-*)
362 CONFIG_OPTS="$CONFIG_OPTS $1"
363 shift
365 --destination)
366 shift
367 DESTINATION="$1"
368 shift
370 --destination=*)
371 DESTINATION="`echo $1 | awk -F= '{print $2}'`"
372 shift
374 --suffix)
375 shift
376 DESTINATION_SUFFIX="$1"
377 shift
379 --suffix=*)
380 DESTINATION_SUFFIX="`echo $1 | awk -F= '{print $2}'`"
381 shift
383 --tau-makefile)
384 TAU_MAKEFILE=$1
385 shift
387 --tau-makefile=*)
388 TAU_MAKEFILE=`echo $1 | awk -F= '{print $2}'`
389 shift
391 --quiet)
392 MAKEOPTS="$MAKEOPTS --quiet"
393 QUIET="--quiet"
394 shift;
396 --enable-tracing|--enable-tracing=*)
397 CONFIG_OPTS="$CONFIG_OPTS $1"
398 ENABLE_TRACING=yes
399 shift
401 --enable-*)
402 CONFIG_OPTS="$CONFIG_OPTS $1"
403 shift
405 --disable-*)
406 CONFIG_OPTS="$CONFIG_OPTS $1"
407 shift
409 -j*)
410 PMAKENUM=`echo $1 | awk -Fj '{print $2}'`
411 MAKEOPTS="$MAKEOPTS -j $PMAKENUM"
412 shift;
414 -*)
415 # We hit a real compiler option (like -g, or -Dfoo),
416 # so just copy over all remaining options
417 while [ ! $# -eq 0 ]
419 OPTS="$OPTS $1"; shift
420 done
422 "help")
423 printOption
426 # This has to be a build-time option (like "smp", "gcc3", or "kcc")
427 TestIfCompiler $1
428 if [ $? -eq 1 ]
429 then
430 # It specifies a compiler:
431 if [ ! -z "$COMPILER" ]
432 then
433 echo "Error> Tried to specify two compilers: $COMPILER and $1"
434 printOption
436 COMPILER=$1
437 else
438 # It specifies some other option:
439 TestIfOption $1
440 BOPTS="$BOPTS $1"
441 [ $1 = "bigemulator" ] && BUILD_EMULATOR=1
442 [ $1 = "bigsim" ] && BUILD_EMULATOR=1
443 [ $1 = "cuda" ] && BUILD_CUDA=1
445 shift
447 esac
448 done
450 if [ $BUILD_CUDA -eq 1 ]; then
451 echo "checking for CUDA toolkit directory"
452 CUDA_CANDIDATE_DIRS="$CUDATOOLKIT_HOME /usr/local/cuda /usr/lib/nvidia-cuda-toolkit"
453 for dir in $CUDA_CANDIDATE_DIRS; do
454 if test -d "$dir"; then
455 CUDA_DIR="$dir"
456 HAVE_CUDA="yes"
457 echo "CUDA_DIR=$CUDA_DIR"
458 break
460 done
463 [ "x$VERSION" = "x" ] && syntax && exit 1
465 if test -n "$WITH_PRODUCTION" -a $BUILD_EMULATOR -eq 1 -a -z "$ENABLE_TRACING"
466 then
467 echo "Error: bigemulator requires tracing modules, --with-production must be used with --enable-tracing"
468 exit 1
471 if [ -z "$MAKE" ]
472 then
473 # prefer gmake
474 MAKE=`which gmake 2>/dev/null`
475 [ -z "$MAKE" -o ! -x "$MAKE" ] && MAKE='make'
478 if [ ! -f $src/$BASEVERSION/conv-mach.h ]
479 then
480 if [ "x_$BASEVERSION" = "x_net-rs6k" ]
481 then
482 echo "Error> build net-aix-ppc instead of net-rs6k!"
483 else
484 echo "Error> build can not find arch: $BASEVERSION!"
486 exit 1
489 #generate VERSION name combining all the build-time options.
490 if [ -n "$BOPTS" -o -n "$COMPILER" ]
491 then
492 echo "Selected Compiler: $COMPILER"
493 echo "Selected Options: $BOPTS"
494 SORTED=`echo $BOPTS | awk '{ for (i = 1; i <= NF; ++i) print $i }' | sort`
495 BOPTS_WITHCOMPILER=`echo $SORTED $COMPILER`
496 for i in $BOPTS_WITHCOMPILER
498 VERSION=$VERSION-$i
499 done
502 #echo "|$DESTINATION|$DESTINATION_SUFFIX|"
504 if [ -z "$DESTINATION" ]
505 then
506 DESTINATION="$VERSION"
509 if [ -n "$DESTINATION_SUFFIX" ]
510 then
511 DESTINATION="$DESTINATION-$DESTINATION_SUFFIX"
514 [ -d $DESTINATION ] || Echo "Creating dir: $DESTINATION"
515 [ -d $DESTINATION ] || mkdir $DESTINATION
516 [ -d $DESTINATION/tmp ] || Echo "Creating dir: $DESTINATION/tmp"
517 [ -d $DESTINATION/tmp ] || mkdir $DESTINATION/tmp
519 Echo "Copying src/scripts/Makefile to $DESTINATION/tmp"
520 rm -f $DESTINATION/tmp/Makefile
521 rm -f $DESTINATION/tmp/Make.depends
522 rm -f $DESTINATION/tmp/Make.cidepends
523 rm -f $DESTINATION/tmp/Make.lb
524 rm -f $DESTINATION/tmp/Make.machine
525 rm -f $DESTINATION/tmp/Make.extlib
528 # Create the bin, lib, include, etc. links:
529 WINNAME=`echo $VERSION | awk -F- '{print $2}'`
530 if [ "x_$WINNAME" = "x_win32" -o "x_$WINNAME" = "x_win64" ]
531 then
532 #Win32/64 version needs special compilers and *copied* (not linked)
533 # source files.
534 cp $src/win32/system_ln $DESTINATION/tmp
535 cp $src/win32/unistd.h $DESTINATION/tmp
536 echo "Compiling createlink.cpp ..."
537 (cd $src/win32; ../$WINNAME/unix2nt_cc -c createlink.cpp -o createlink.o -D_WIN32_WINNT=0x0500; ../$WINNAME/unix2nt_cc createlink.o)
539 if test ! -x $src/win32/createlink.exe
540 then
541 echo "VC++ is not properly installed!"
542 exit 1
544 chmod +x $DESTINATION/tmp/system_ln
545 cp $src/win32/gathertree.local $DESTINATION/tmp
546 cp $src/win32/gatherflat.local $DESTINATION/tmp
547 else
548 cat > $DESTINATION/tmp/system_ln <<EOF
549 #!/bin/sh
550 ln -f -s \$@
552 chmod +x $DESTINATION/tmp/system_ln
553 for newdir in `echo bin lib lib_so include tmp`
555 Echo "Soft-linking over $newdir"
556 if [ -r $newdir ]
557 then
558 rm -fr $newdir || exit 1
560 $DESTINATION/tmp/system_ln $DESTINATION/$newdir $newdir
561 done
562 rm -f VERSION
563 $DESTINATION/tmp/system_ln $DESTINATION/include/VERSION VERSION
566 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.depends" $DESTINATION/tmp/Make.depends
567 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.cidepends" $DESTINATION/tmp/Make.cidepends
568 if test -f src/ck-ldb/Make.lb
569 then
570 $DESTINATION/tmp/system_ln "$srcbase/ck-ldb/Make.lb" $DESTINATION/tmp/Make.lb
571 else
572 touch $DESTINATION/tmp/Make.lb
574 $DESTINATION/tmp/system_ln "$srcbase/scripts/Makefile" $DESTINATION/tmp/Makefile
575 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.tau" $DESTINATION/tmp/Make.tau
576 touch $DESTINATION/tmp/Makefile.machine
577 touch $DESTINATION/tmp/Make.extlib
579 ConvUsr="$DESTINATION/tmp/conv-mach-pre.sh"
580 Echo "Generating $ConvUsr"
581 echo > $ConvUsr
582 if test -n "$LIBDIR"
583 then
584 echo 'USER_OPTS_LD="$USER_OPTS_LD '$LIBDIR'"' >> $ConvUsr
585 echo 'USER_OPTS_LDXX="$USER_OPTS_LDXX '$LIBDIR'"' >> $ConvUsr
587 if test -n "$INCDIR"
588 then
589 echo 'USER_OPTS_CC="$USER_OPTS_CC '$INCDIR'"' >> $ConvUsr
590 echo 'USER_OPTS_CXX="$USER_OPTS_CXX '$INCDIR'"' >> $ConvUsr
592 chmod +x $ConvUsr
594 # Create conv-mach-opt headers with special build-time options
595 ConvHeader="$DESTINATION/tmp/conv-mach-opt.h"
596 ConvSh="$DESTINATION/tmp/conv-mach-opt.sh"
597 if [ ! -f $ConvSh -o ! -f $ConvHeader ]
598 then
599 Echo "Generating $ConvHeader, conv-mach-opt.sh"
600 echo '/* Build-time options header, automatically generated by charm/build*/'> $ConvHeader
601 echo '# Built-time options header, automatically generated by charm/build'> $ConvSh
602 echo '[ -z "$CHARMINC" ] && CHARMINC="."' >> $ConvSh
604 if test -n "$COMPILER"
605 then
606 i="$COMPILER"
607 echo '#include "'cc-$i.h'"' >> $ConvHeader
608 echo '. $CHARMINC/'"cc-$i.sh" >> $ConvSh
610 if test -n "$BOPTS"
611 then
612 for i in $BOPTS
614 echo '#include "'conv-mach-$i.h'"' >> $ConvHeader
615 if [ $BUILD_CUDA -eq 1 ]; then
616 echo 'CUDA_DIR="'$CUDA_DIR'"'>>$ConvSh
618 echo '. $CHARMINC/'"conv-mach-$i.sh" >> $ConvSh
619 done
622 if test "$BUILD_SHARED" = "-build-shared"
623 then
624 echo "CMK_NO_BUILD_SHARED=false" >> $ConvSh
625 else
626 echo "CMK_NO_BUILD_SHARED=true" >> $ConvSh
629 if test -n "$WITH_ROMIO"
630 then
631 echo "CMK_AMPI_WITH_ROMIO=\"true\"" >> $ConvSh
634 if test -n "$WITH_PRODUCTION"
635 then
636 echo '#define CMK_OPTIMIZE 1' >> $ConvHeader
637 # Prepend optimize so that an explicit -no-optimize still works
638 OPTS="-optimize -production $OPTS"
639 CONFIG_OPTS="--disable-controlpoint --disable-tracing --disable-tracing-commthread --disable-charmdebug --disable-replay --disable-error-checking --disable-stats $CONFIG_OPTS"
642 # build with Tau
643 WITH_TAU=0
644 if [ "$PROGRAM" = "Tau" ]
645 then
646 Echo "TAU>>>> makefile config option: $TAU_MAKEFILE"
647 if [ -n "$TAU_MAKEFILE" -a -f $TAU_MAKEFILE ]
648 then
649 #Setting up TAU trace library:
650 Echo "TAU>>>> configuring with this TAU makefile: $TAU_MAKEFILE"
652 WITH_TAU=1
653 else
654 Echo "TAU>>>> ERROR could not find Makefile: $TAU_MAKEFILE, ignored"
655 TAU_MAKEFILE=""
658 [ -z "$TAU_MAKEFILE" ] && TAU_MAKEFILE="Make.tau"
659 SED_CHARMC="s@TAU_MAKEFILE=\(.*\)@TAU_MAKEFILE=$TAU_MAKEFILE@"
661 sed -e $SED_CHARMC $srcbase/scripts/Makefile > .Makefile.$$ && cp .Makefile.$$ $srcbase/scripts/Makefile && rm -f .Makefile.$$
662 sed -e $SED_CHARMC $srcbase/scripts/charmc > .charmc.$$ && cp .charmc.$$ $srcbase/scripts/charmc && rm -f .charmc.$$
664 if test $WITH_TAU -eq 1
665 then
666 echo "#define CMK_WITH_TAU 1" >> $ConvHeader
667 echo "#define pthread_create tau_pthread_create" >> $ConvHeader
668 echo "#define pthread_exit tau_pthread_exit" >> $ConvHeader
670 echo "CMK_WITH_TAU=\"true\"" >> $ConvSh
673 if [ "$PROGRAM" = "ChaNGa" ]
674 then
675 #Setting lbuserdata when the build is ChaNGa
676 CONFIG_OPTS="--enable-lbuserdata $CONFIG_OPTS"
679 echo $BASEVERSION > $DESTINATION/tmp/.vdir
680 echo $BASEVERSION | sed -e 's@-.*@@' > $DESTINATION/tmp/.gdir
682 if test $BUILD_EMULATOR = 1
683 then
684 PROGRAM="$PROGRAM bigsim"
685 # CONFIG_OPTS="--disable-charmdebug $CONFIG_OPTS"
688 printError()
690 Echo "-------------------------------------------------"
691 Echo "Charm++ NOT BUILT. Either cd into $DESTINATION/tmp and try"
692 Echo "to resolve the problems yourself, visit"
693 Echo " http://charm.cs.illinois.edu/"
694 Echo "for more information. Otherwise, email the developers at charm@cs.illinois.edu"
695 exit $MAKEEXIT
698 echo 'BUILDOPTS="'$OPTS'"' >> $ConvSh
699 echo "SRCBASE=$srcbase" > $DESTINATION/tmp/charmpath.mk
701 Echo "Performing '$MAKE $MAKEOPTS basics OPTS="$OPTS" QUIET="$QUIET" CONFIG_OPTS="$CONFIG_OPTS"' in $DESTINATION/tmp"
702 cd $DESTINATION/tmp
703 echo "CONFIG_OPTS=\"$CONFIG_OPTS\"" > config_opts.sh
704 chmod +x config_opts.sh
705 echo "OPTSATBUILDTIME += $OPTS" > buildopts.mk
706 $MAKE $MAKEOPTS basics OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
707 MAKEEXIT=$?
708 [ $MAKEEXIT -ne 0 ] && printError
710 Echo "Performing '$MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS" QUIET="$QUIET"' in $DESTINATION/tmp"
711 $MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
712 MAKEEXIT=$?
713 if [ $MAKEEXIT -eq 0 ]
714 then
715 Echo "-------------------------------------------------"
716 Echo "$PROGRAM built successfully."
717 Echo "Next, try out a sample program like" \
718 "$DESTINATION/tests/charm++/simplearrayhello"
719 else
720 printError