build: clear out references to many deleted machine layers
[charm.git] / build
blob0d8adf4c6e07e38d9b7ffec614e3e2965b37b63d
1 #!/bin/sh
3 # Silly shorthand, used for source reorganization
4 if [ $(dirname $0) = "." ]
5 then
6 srcbaseabs="./src"
7 srcbase="../../src"
8 else
9 srcbaseabs="$(cd $(dirname $0)/src/; pwd)"
10 srcbase=$srcbaseabs
12 src="$srcbaseabs/arch/"
14 more=0
16 syntax() {
17 echo ''
18 echo 'Usage: build <target> <version> <options> [charmc-options ...]'
19 echo ''
20 echo '<targets>: converse charm++ LIBS AMPI FEM bigemulator pose msa'
21 echo '<targets>: doc ps-doc pdf-doc html-doc'
22 if test $more = 1
23 then
24 echo ''
25 echo ' charm++ compile Charm++ core only'
26 echo ' AMPI compile Adaptive MPI on top of Charm++'
27 echo ' FEM compile FEM framework'
28 echo ' LIBS compile additional parallel libraries with Charm++ core'
29 echo ' bigemulator build additional BigSim libraries'
30 echo ' pose build POSE parallel discrete event simulator'
31 echo ' msa build Multiphase Shared Arrays(MSA) library'
32 echo ' Tau build the TAU tracing library for generating TAU performance data'
33 echo ' ChaNGa compile Charm++ core and necessary libraries for ChaNGa'
34 echo ' everylb compile EveryLB suite of load balancing strategies'
35 echo ''
37 echo '<versions>: '
38 ( cd $src ; ls -1 | egrep -v '(^shmem$)|(^mpi$)|(^sim$)|(^net(lrts)?$)|(^multicore$)|(^util$)|(^common$)|(^uth$)|(^conv-mach-fix.sh$)|(^win64$)|(^(gemini_)?gni$)|(^pami(lrts)?$)|(^verbs$)|(^template$)|(^cuda$)' | pr -3 -t )
39 echo ''
40 echo '<options>: compiler and platform specific options'
41 echo 'icc iccstatic xlc xlc64 gcc clang craycc pgcc pathscale cc cc64 mpcc gcc64 gcc3 mpicxx'
42 echo 'help smp gm tcp scyld clustermatic bigemulator ooc syncft mlogft causalft'
43 echo 'papi pthreads lam'
44 echo '--incdir --libdir --basedir --build-shared --destination --suffix -j'
45 if test $more = 1
46 then
47 echo ''
48 echo 'For platform specific options, use help option:'
49 echo ' help platform specific help, e.g. ./build charm++ net-linux-x86_64 help'
50 echo ''
51 echo 'Choose a compiler (only one option is allowed from this section):'
52 echo ' icc, iccstatic Intel compilers (default or static linking)'
53 echo ' xlc, xlc64 IBM XL compilers (with 64-bit option on architectures with 32-bit modes)'
54 echo ' gcc GNU compiler collection (on platforms where the default differs)'
55 echo ' clang Clang C/C++ compiler'
56 echo ' craycc Cray compilers'
57 echo ' pgcc Portland Group compilers'
58 echo ' pathscale Pathscale compiler suite'
59 echo ' cc, cc64 For Sun WorkShop C++ 32/64 bit compilers'
60 echo ' mpcc SUN Solaris C++ compiler for MPI'
61 echo ' gcc3 GNU GCC/G++ version 3'
62 echo ''
63 echo 'Choose an alternative fortran compiler (only one option is allowed from this section):'
64 echo ' g95 G95 at http://ww.g95.org'
65 echo " pgf90 Portland Group Fortran compiler"
66 echo ' ifort Intel Fortran compiler'
67 echo ''
68 echo 'Platform specific options (choose multiple if apply):'
69 echo ' smp support for SMP, multithreaded charm on each node'
70 echo ' ibverbs use Infiniband Verbs for communication (only for net-linux-x86_64; prefer verbs-*)'
71 echo ' lam Use LAM MPI'
72 echo ' mpt use SGI Message Passing Toolkit (only for mpi version)'
73 echo ' gm use Myrinet for communication'
74 echo ' tcp use TCP sockets for communication (only for net version)'
75 echo ' scyld compile for Scyld Beowulf cluster based on bproc'
76 echo ' clustermatic compile for Clustermatic (support version 3 and 4) '
77 echo ' pthreads compile with pthreads Converse threads'
78 echo ''
79 echo 'Advanced options:'
80 echo ' bigemulator compile for BigSim simulator'
81 echo ' ooc compile with out of core support'
82 echo ' syncft compile with Charm++ fault tolerance support'
83 echo ' mlogft compile with Charm++ message logging fault tolerance support'
84 echo ' papi compile with PAPI performance counter support (if any)'
85 echo ''
86 echo "Charm++ dynamic libraries:"
87 echo " --no-build-shared don't build Charm++'s shared libraries (default)"
88 echo " --build-shared build Charm++ dynamic libraries (.so) "
89 echo ''
90 echo 'Enable/disable features:'
91 $srcbaseabs/scripts/configure --help | grep enable-
92 $srcbaseabs/scripts/configure --help | grep with-
93 echo " --with-production build Charm++ with all optimizations for maximum performance, and disabling all above features"
94 echo ''
95 echo 'Miscellaneous options:'
96 echo ' --incdir=DIR specify additional include path for compiler'
97 echo ' --libdir=DIR specify additional lib path for compiler'
98 echo ' --basedir=DIR shortcut for the above two - DIR/include and DIR/lib'
99 echo ' -j[N] parallel make, N is the number of paralle make jobs'
100 echo " --with-romio build AMPI with ROMIO library"
101 echo " --with-lbtime-type specify real type for the load balancing timers"
102 echo " --destination=DIR build Charm++ inside DIR, by default the destination is <version>"
103 echo " --suffix=DIR append DIR to the destination directory of the Charm++ build"
104 echo " --tau-makefile=FILE Specify which TAU stub makefile to use"
106 echo ''
107 echo '<charmc-options>: normal compiler options e.g. -g -optimize -save -verbose'
108 if test $more = 1
109 then
110 echo ''
111 echo 'Examples:'
112 echo "1. display all supported options for net-linux-x86_64 using 'help':"
113 echo ' ./build charm++ net-linux-x86_64 help'
114 echo '2. compile Charm++ on Linux with all available tuning:'
115 echo ' ./build charm++ net-linux-x86_64 --with-production'
116 echo '3. compile Charm++ for Linux (32bit) clustermatic Beowulf cluster with Intel compiler and optimizations:'
117 echo ' ./build charm++ net-linux clustermatic icc -optimize'
118 echo '4. compile Charm++ for Windows with VC++ (Cygwin required):'
119 echo ' ./build charm++ net-win64 -optimize'
120 echo '5. compile Charm++ with MPI that is installed at /usr/local/mpich:'
121 echo ' ./build charm++ mpi-linux --incdir /usr/local/mpich/include --libdir /usr/local/mpich/lib -optimize'
122 echo ' or in short,'
123 echo ' ./build charm++ mpi-linux --basedir /usr/local/mpich -optimize'
124 echo ' ./build Tau --tau-makefile=/usr/local/packages/TAU/x86_64/lib/Makefile.tau-mpi'
125 echo ''
126 echo 'Note: This script:'
127 echo ' 1. Creates directories <destination> and <destination>/tmp'
128 echo ' 2. Copies src/scripts/Makefile into <destination>/tmp'
129 echo ' 3. Does a "make basics" in <destination>/tmp.'
130 echo ' 3. Does a "make -jN <target> <version> OPTS=<charmc-options>" in <destination>/tmp.'
131 echo "That's all build does. The rest is handled by the Makefile."
132 echo ''
133 echo 'Thank you for using Charm++, please send questions or comments to '
134 echo 'Parallel Programming Lab at University of Illinois at Urbana-Champaign'
135 echo '(email: charm@cs.illinois.edu).'
137 else
138 echo ''
139 echo "To get more detailed help, run ./build --help"
143 Echo() {
144 [ "x$QUIET" = "x--quiet" ] || echo $*
147 printOption() {
148 for prefix in cc conv-mach
150 str="Supported compilers:"
151 [ "$prefix" = "conv-mach" ] && str="Supported options:"
152 opts=""
153 for dir in $OPT_DIRS
155 # echo "Checking for $prefix in $dir"
156 files=`cd $dir; ls $prefix-*.h 2>/dev/null`
157 opts="$opts "`echo $files | sed 's/'$prefix'-\([^.]*\).h/\1/g'`
158 done
159 tmp=.tmp.$$
160 rm -f $tmp; touch $tmp
161 for o in $opts
163 echo $o >> $tmp
164 done
165 opts=`sort $tmp | uniq`
166 rm -f $tmp
167 echo $str $opts
168 done
169 exit 1
172 CheckDir() {
173 for d in $*
175 if test ! -d $d
176 then
177 echo Error: cannot find $d!
178 exit 1
180 done
183 TestIfCompiler() {
184 for dir in $OPT_DIRS
186 [ -f $dir/cc-$1.sh ] && return 1
187 done
188 return 0
191 TestIfOption() {
192 for dir in $OPT_DIRS
194 [ -f $dir/conv-mach-$1.h ] && return 1
195 done
197 echo "Error> option: $1 is not supported in this version!";
198 printOption
202 # start
204 BUILD_CUDA=0
205 MAKEOPTS=""
206 OPTS=""
207 BOPTS=""
208 MORE=""
209 COMPILER=""
210 BASEDIR=
211 LIBDIR=
212 INCDIR=
213 ARCH=
214 BUILD_SHARED="" # default no shared lib
215 WITH_ROMIO=
216 WITH_PRODUCTION=
217 BUILD_EMULATOR=0
218 DESTINATION=""
219 DESTINATION_SUFFIX=""
220 TAU_MAKEFILE=""
221 QUIET=""
223 [ "$1" = '--help' -o "$1" = '-h' ] && more=1 && syntax | ( less || more ) && exit 1
224 [ $# -lt 2 ] && ./smart-build.pl && exit 1
225 PROGRAM=$1
226 shift
228 # find longest prefix of version argument that exists as a directory in $src
229 VERSION=$1
230 VERSOPTS=""
231 testversion=""
232 oldifs=$IFS
233 IFS=-
234 for w in $1; do
235 IFS=$oldifs
236 if [ -z "$testversion" ]; then
237 testversion=$w
238 else
239 testversion="$testversion-$w"
241 if [ -d $src/$testversion ]; then
242 VERSION=$testversion
243 VERSOPTS=""
244 else
245 VERSOPTS="$VERSOPTS $w"
247 done
248 if [ $VERSION = $1 ]; then VERSOPTS=""; fi
250 BASEVERSION=$VERSION;
251 if test -f $src/$BASEVERSION/vdir_link
252 then
253 BASEVERSION=`cat $src/$BASEVERSION/vdir_link`
255 ARCH=`echo $BASEVERSION | sed -e 's@-.*@@'`
256 shift
258 #echo $src
259 #echo $BASEVERSION
260 #echo $ARCH
262 OPT_DIRS="$src/$BASEVERSION $src/$ARCH $src/common"
264 # process remainder of version argument as options, copied from below
265 for w in $VERSOPTS; do
266 # This has to be a build-time option (like "smp", "gcc3", or "kcc")
267 TestIfCompiler $w
268 if [ $? -eq 1 ]
269 then
270 # It specifies a compiler:
271 if [ ! -z "$COMPILER" ]
272 then
273 echo "Error> Tried to specify two compilers: $COMPILER and $w"
274 printOption
276 COMPILER=$w
277 else
278 # It specifies some other option:
279 TestIfOption $w
280 BOPTS="$BOPTS $w"
281 [ $w = "bigemulator" ] && BUILD_EMULATOR=1
282 [ $w = "bigsim" ] && BUILD_EMULATOR=1
283 [ $w = "cuda" ] && BUILD_CUDA=1
285 done
287 while [ ! $# -eq 0 ]
289 case "$1" in
290 "--basedir")
291 shift;
292 for dir in $1
294 CheckDir $dir/include $dir/lib
295 LIBDIR="$LIBDIR -L$dir/lib";
296 INCDIR="$INCDIR -I$dir/include"
297 done
298 shift
300 --basedir=*)
301 basedir=`echo $1 | awk -F= '{print $2}'`
302 for dir in $basedir
304 CheckDir $dir/include $dir/lib
305 LIBDIR="$LIBDIR -L$dir/lib";
306 INCDIR="$INCDIR -I$dir/include"
307 done
308 shift
310 "--libdir")
311 shift; CheckDir $1
312 for dir in $1
314 LIBDIR="$LIBDIR -L$dir";
315 done
316 shift
318 --libdir=*)
319 libdir=`echo $1 | awk -F= '{print $2}'`
320 CheckDir $libdir
321 for dir in $libdir
323 LIBDIR="$LIBDIR -L$dir";
324 done
325 shift
327 "--incdir")
328 shift; CheckDir $1
329 for dir in $1
331 INCDIR="$INCDIR -I$dir";
332 done
333 shift
335 --incdir=*)
336 incdir=`echo $1 | awk -F= '{print $2}'`
337 CheckDir $incdir
338 for dir in $incdir
340 INCDIR="$INCDIR -I$dir";
341 done
342 shift
344 --no-build-shared|--no-shared)
345 #BUILD_SHARED="-no-build-shared";
346 shift
348 --build-shared)
349 BUILD_SHARED="-build-shared";
350 shift
352 --with-romio)
353 WITH_ROMIO="true"; shift
355 --with-production)
356 WITH_PRODUCTION="true"
357 shift
359 --with-*)
360 CONFIG_OPTS="$CONFIG_OPTS $1"
361 shift
363 --without-*)
364 CONFIG_OPTS="$CONFIG_OPTS $1"
365 shift
367 --destination)
368 shift
369 DESTINATION="$1"
370 shift
372 --destination=*)
373 DESTINATION="`echo $1 | awk -F= '{print $2}'`"
374 shift
376 --suffix)
377 shift
378 DESTINATION_SUFFIX="$1"
379 shift
381 --suffix=*)
382 DESTINATION_SUFFIX="`echo $1 | awk -F= '{print $2}'`"
383 shift
385 --tau-makefile)
386 TAU_MAKEFILE=$1
387 shift
389 --tau-makefile=*)
390 TAU_MAKEFILE=`echo $1 | awk -F= '{print $2}'`
391 shift
393 --quiet)
394 MAKEOPTS="$MAKEOPTS --quiet"
395 QUIET="--quiet"
396 shift;
398 --enable-tracing|--enable-tracing=*)
399 CONFIG_OPTS="$CONFIG_OPTS $1"
400 ENABLE_TRACING=yes
401 shift
403 --enable-*)
404 CONFIG_OPTS="$CONFIG_OPTS $1"
405 shift
407 --disable-*)
408 CONFIG_OPTS="$CONFIG_OPTS $1"
409 shift
411 -j*)
412 PMAKENUM=`echo $1 | awk -Fj '{print $2}'`
413 MAKEOPTS="$MAKEOPTS -j $PMAKENUM"
414 shift;
416 -*)
417 # We hit a real compiler option (like -g, or -Dfoo),
418 # so just copy over all remaining options
419 while [ ! $# -eq 0 ]
421 OPTS="$OPTS $1"; shift
422 done
424 "help")
425 printOption
428 # This has to be a build-time option (like "smp", "gcc3", or "kcc")
429 TestIfCompiler $1
430 if [ $? -eq 1 ]
431 then
432 # It specifies a compiler:
433 if [ ! -z "$COMPILER" ]
434 then
435 echo "Error> Tried to specify two compilers: $COMPILER and $1"
436 printOption
438 COMPILER=$1
439 else
440 # It specifies some other option:
441 TestIfOption $1
442 BOPTS="$BOPTS $1"
443 [ $1 = "bigemulator" ] && BUILD_EMULATOR=1
444 [ $1 = "bigsim" ] && BUILD_EMULATOR=1
445 [ $1 = "cuda" ] && BUILD_CUDA=1
447 shift
449 esac
450 done
452 if [ $BUILD_CUDA -eq 1 ]; then
453 echo "checking for CUDA toolkit directory"
454 CUDA_CANDIDATE_DIRS="$CUDATOOLKIT_HOME /usr/local/cuda /usr/lib/nvidia-cuda-toolkit"
455 for dir in $CUDA_CANDIDATE_DIRS; do
456 if test -d "$dir"; then
457 CUDA_DIR="$dir"
458 HAVE_CUDA="yes"
459 echo "CUDA_DIR=$CUDA_DIR"
460 break
462 done
465 [ "x$VERSION" = "x" ] && syntax && exit 1
467 if test -n "$WITH_PRODUCTION" -a $BUILD_EMULATOR -eq 1 -a -z "$ENABLE_TRACING"
468 then
469 echo "Error: bigemulator requires tracing modules, --with-production must be used with --enable-tracing"
470 exit 1
473 if [ -z "$MAKE" ]
474 then
475 # prefer gmake
476 MAKE=`which gmake 2>/dev/null`
477 [ -z "$MAKE" -o ! -x "$MAKE" ] && MAKE='make'
480 if [ ! -f $src/$BASEVERSION/conv-mach.h ]
481 then
482 echo "Error> build can not find arch: $BASEVERSION!"
483 exit 1
486 #generate VERSION name combining all the build-time options.
487 if [ -n "$BOPTS" -o -n "$COMPILER" ]
488 then
489 echo "Selected Compiler: $COMPILER"
490 echo "Selected Options: $BOPTS"
491 SORTED=`echo $BOPTS | awk '{ for (i = 1; i <= NF; ++i) print $i }' | sort`
492 BOPTS_WITHCOMPILER=`echo $SORTED $COMPILER`
493 for i in $BOPTS_WITHCOMPILER
495 VERSION=$VERSION-$i
496 done
499 #echo "|$DESTINATION|$DESTINATION_SUFFIX|"
501 if [ -z "$DESTINATION" ]
502 then
503 DESTINATION="$VERSION"
506 if [ $(dirname $DESTINATION) != "." ]
507 then
508 srcbaseabs="$(cd $srcbaseabs; pwd)"
509 srcbase=$srcbaseabs
510 src="$srcbaseabs/arch/"
513 if [ -n "$DESTINATION_SUFFIX" ]
514 then
515 DESTINATION="$DESTINATION-$DESTINATION_SUFFIX"
518 [ -d $DESTINATION ] || Echo "Creating dir: $DESTINATION"
519 [ -d $DESTINATION ] || mkdir $DESTINATION
520 [ -d $DESTINATION/tmp ] || Echo "Creating dir: $DESTINATION/tmp"
521 [ -d $DESTINATION/tmp ] || mkdir $DESTINATION/tmp
523 Echo "Copying src/scripts/Makefile to $DESTINATION/tmp"
524 rm -f $DESTINATION/tmp/Makefile
525 rm -f $DESTINATION/tmp/Make.depends
526 rm -f $DESTINATION/tmp/Make.cidepends
527 rm -f $DESTINATION/tmp/Make.lb
528 rm -f $DESTINATION/tmp/Make.machine
529 rm -f $DESTINATION/tmp/Make.extlib
532 # Create the bin, lib, include, etc. links:
533 WINNAME=`echo $VERSION | awk -F- '{print $2}'`
534 if [ "x_$WINNAME" = "x_win32" -o "x_$WINNAME" = "x_win64" ]
535 then
536 #Win32/64 version needs special compilers and *copied* (not linked)
537 # source files.
538 cp $src/win32/system_ln $DESTINATION/tmp
539 cp $src/win32/unistd.h $DESTINATION/tmp
540 echo "Compiling createlink.cpp ..."
541 (cd $src/win32; ../$WINNAME/unix2nt_cc -c createlink.cpp -o createlink.o -D_WIN32_WINNT=0x0500; ../$WINNAME/unix2nt_cc createlink.o)
543 if test ! -x $src/win32/createlink.exe
544 then
545 echo "VC++ is not properly installed!"
546 exit 1
548 chmod +x $DESTINATION/tmp/system_ln
549 cp $src/win32/gathertree.local $DESTINATION/tmp
550 cp $src/win32/gatherflat.local $DESTINATION/tmp
551 else
552 cat > $DESTINATION/tmp/system_ln <<EOF
553 #!/bin/sh
554 ln -f -s \$@
556 chmod +x $DESTINATION/tmp/system_ln
557 for newdir in `echo bin lib lib_so include tmp`
559 Echo "Soft-linking over $newdir"
560 if [ -r $newdir ]
561 then
562 rm -fr $newdir || exit 1
564 $DESTINATION/tmp/system_ln $DESTINATION/$newdir $newdir
565 done
566 rm -f VERSION
567 $DESTINATION/tmp/system_ln $DESTINATION/include/VERSION VERSION
570 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.depends" $DESTINATION/tmp/Make.depends
571 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.cidepends" $DESTINATION/tmp/Make.cidepends
572 if test -f "$srcbaseabs/ck-ldb/Make.lb"
573 then
574 $DESTINATION/tmp/system_ln "$srcbase/ck-ldb/Make.lb" $DESTINATION/tmp/Make.lb
575 else
576 touch $DESTINATION/tmp/Make.lb
578 $DESTINATION/tmp/system_ln "$srcbase/scripts/Makefile" $DESTINATION/tmp/Makefile
579 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.tau" $DESTINATION/tmp/Make.tau
580 touch $DESTINATION/tmp/Makefile.machine
581 touch $DESTINATION/tmp/Make.extlib
583 ConvUsr="$DESTINATION/tmp/conv-mach-pre.sh"
584 Echo "Generating $ConvUsr"
585 echo > $ConvUsr
586 if test -n "$LIBDIR"
587 then
588 echo 'USER_OPTS_LD="$USER_OPTS_LD '$LIBDIR'"' >> $ConvUsr
589 echo 'USER_OPTS_LDXX="$USER_OPTS_LDXX '$LIBDIR'"' >> $ConvUsr
591 if test -n "$INCDIR"
592 then
593 echo 'USER_OPTS_CC="$USER_OPTS_CC '$INCDIR'"' >> $ConvUsr
594 echo 'USER_OPTS_CXX="$USER_OPTS_CXX '$INCDIR'"' >> $ConvUsr
596 chmod +x $ConvUsr
598 # Create conv-mach-opt headers with special build-time options
599 ConvHeader="$DESTINATION/tmp/conv-mach-opt.h"
600 ConvSh="$DESTINATION/tmp/conv-mach-opt.sh"
601 if [ ! -f $ConvSh -o ! -f $ConvHeader ]
602 then
603 Echo "Generating $ConvHeader, conv-mach-opt.sh"
604 echo '/* Build-time options header, automatically generated by charm/build*/'> $ConvHeader
605 echo '# Built-time options header, automatically generated by charm/build'> $ConvSh
606 echo '[ -z "$CHARMINC" ] && CHARMINC="."' >> $ConvSh
608 if test -n "$COMPILER"
609 then
610 i="$COMPILER"
611 echo '#include "'cc-$i.h'"' >> $ConvHeader
612 echo '. $CHARMINC/'"cc-$i.sh" >> $ConvSh
614 if test -n "$BOPTS"
615 then
616 # pxshm+smp note: When combining the 'smp' and 'pxshm' directives, it is
617 # important that they be included in $ConvHeader in that
618 # exact order. See bug #717.
619 TMP=""
620 HAS_PXSHM=0
621 HAS_SMP=0
622 for i in $BOPTS; do
623 if [ "$i" = "smp" ]; then
624 HAS_SMP=1
625 elif [ "$i" = "pxshm" ]; then
626 HAS_PXSHM=1
627 else
628 TMP="$TMP $i"
630 done
631 if [ $HAS_PXSHM -eq 1 ]; then
632 TMP="pxshm $TMP"
634 if [ $HAS_SMP -eq 1 ]; then
635 TMP="smp $TMP"
638 BOPTS=$TMP
639 for i in $BOPTS
641 echo '#include "'conv-mach-$i.h'"' >> $ConvHeader
642 if [ $BUILD_CUDA -eq 1 ]; then
643 echo 'CUDA_DIR="'$CUDA_DIR'"'>>$ConvSh
645 echo '. $CHARMINC/'"conv-mach-$i.sh" >> $ConvSh
646 done
649 if test "$BUILD_SHARED" = "-build-shared"
650 then
651 echo "CMK_NO_BUILD_SHARED=false" >> $ConvSh
652 else
653 echo "CMK_NO_BUILD_SHARED=true" >> $ConvSh
656 if test -n "$WITH_ROMIO"
657 then
658 echo "CMK_AMPI_WITH_ROMIO=\"true\"" >> $ConvSh
661 if test -n "$WITH_PRODUCTION"
662 then
663 echo '#define CMK_OPTIMIZE 1' >> $ConvHeader
664 # Prepend optimize so that an explicit -no-optimize still works
665 OPTS="-optimize -production $OPTS"
666 CONFIG_OPTS="--disable-controlpoint --disable-tracing --disable-tracing-commthread --disable-charmdebug --disable-replay --disable-error-checking --disable-stats $CONFIG_OPTS"
669 # build with Tau
670 WITH_TAU=0
671 if [ "$PROGRAM" = "Tau" ]
672 then
673 Echo "TAU>>>> makefile config option: $TAU_MAKEFILE"
674 if [ -n "$TAU_MAKEFILE" -a -f $TAU_MAKEFILE ]
675 then
676 #Setting up TAU trace library:
677 Echo "TAU>>>> configuring with this TAU makefile: $TAU_MAKEFILE"
679 WITH_TAU=1
680 else
681 Echo "TAU>>>> ERROR could not find Makefile: $TAU_MAKEFILE, ignored"
682 TAU_MAKEFILE=""
686 if test $WITH_TAU -eq 1
687 then
688 [ -z "$TAU_MAKEFILE" ] && TAU_MAKEFILE="Make.tau"
689 SED_CHARMC="s@TAU_MAKEFILE=\(.*\)@TAU_MAKEFILE=$TAU_MAKEFILE@"
691 sed -e $SED_CHARMC $srcbaseabs/scripts/Makefile > .Makefile.$$ && cp .Makefile.$$ $srcbaseabs/scripts/Makefile && rm -f .Makefile.$$
692 sed -e $SED_CHARMC $srcbaseabs/scripts/charmc > .charmc.$$ && cp .charmc.$$ $srcbaseabs/scripts/charmc && rm -f .charmc.$$
694 echo "#define CMK_WITH_TAU 1" >> $ConvHeader
695 echo "#define pthread_create tau_pthread_create" >> $ConvHeader
696 echo "#define pthread_exit tau_pthread_exit" >> $ConvHeader
698 echo "CMK_WITH_TAU=\"true\"" >> $ConvSh
701 if [ "$PROGRAM" = "ChaNGa" ]
702 then
703 #Setting lbuserdata when the build is ChaNGa
704 CONFIG_OPTS="--enable-lbuserdata $CONFIG_OPTS"
707 echo $BASEVERSION > $DESTINATION/tmp/.vdir
708 echo $BASEVERSION | sed -e 's@-.*@@' > $DESTINATION/tmp/.gdir
710 if test $BUILD_EMULATOR = 1
711 then
712 PROGRAM="$PROGRAM bigsim"
713 # CONFIG_OPTS="--disable-charmdebug $CONFIG_OPTS"
716 printError()
718 Echo "-------------------------------------------------"
719 Echo "Charm++ NOT BUILT. Either cd into $DESTINATION/tmp and try"
720 Echo "to resolve the problems yourself, visit"
721 Echo " http://charm.cs.illinois.edu/"
722 Echo "for more information. Otherwise, email the developers at charm@cs.illinois.edu"
723 exit $MAKEEXIT
726 echo 'BUILDOPTS="'$OPTS'"' >> $ConvSh
727 echo "SRCBASE=$srcbase" > $DESTINATION/tmp/charmpath.mk
729 Echo "Performing '$MAKE $MAKEOPTS basics OPTS="$OPTS" QUIET="$QUIET" CONFIG_OPTS="$CONFIG_OPTS"' in $DESTINATION/tmp"
730 cd $DESTINATION/tmp
731 echo "CONFIG_OPTS=\"$CONFIG_OPTS\"" > config_opts.sh
732 chmod +x config_opts.sh
733 echo "OPTSATBUILDTIME += $OPTS" > buildopts.mk
734 $MAKE $MAKEOPTS basics OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
735 MAKEEXIT=$?
736 [ $MAKEEXIT -ne 0 ] && printError
738 Echo "Performing '$MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS" QUIET="$QUIET"' in $DESTINATION/tmp"
739 $MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
740 MAKEEXIT=$?
741 if [ $MAKEEXIT -eq 0 ]
742 then
743 Echo "-------------------------------------------------"
744 Echo "$PROGRAM built successfully."
745 Echo "Next, try out a sample program like" \
746 "$DESTINATION/tests/charm++/simplearrayhello"
747 else
748 printError