Bug #1207: update DDT's type table with C/C++ bool datatype
[charm.git] / build
blobfba8f49f8a2e0ccfca2a0be2a8b8f48479654c15
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 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 ''
62 echo 'Choose an alternative fortran compiler (only one option is allowed from this section):'
63 echo ' g95 G95 at http://ww.g95.org'
64 echo " pgf90 Portland Group Fortran compiler"
65 echo ' ifort Intel Fortran compiler'
66 echo ''
67 echo 'Platform specific options (choose multiple if apply):'
68 echo ' smp support for SMP, multithreaded charm on each node'
69 echo ' ibverbs use Infiniband Verbs for communication (only for net-linux-x86_64; prefer verbs-*)'
70 echo ' lam Use LAM MPI'
71 echo ' mpt use SGI Message Passing Toolkit (only for mpi version)'
72 echo ' gm use Myrinet for communication'
73 echo ' tcp use TCP sockets for communication (only for net version)'
74 echo ' scyld compile for Scyld Beowulf cluster based on bproc'
75 echo ' clustermatic compile for Clustermatic (support version 3 and 4) '
76 echo ' pthreads compile with pthreads Converse threads'
77 echo ''
78 echo 'Advanced options:'
79 echo ' bigemulator compile for BigSim simulator'
80 echo ' ooc compile with out of core support'
81 echo ' syncft compile with Charm++ fault tolerance support'
82 echo ' mlogft compile with Charm++ message logging fault tolerance support'
83 echo ' papi compile with PAPI performance counter support (if any)'
84 echo ''
85 echo "Charm++ dynamic libraries:"
86 echo " --no-build-shared don't build Charm++'s shared libraries (default)"
87 echo " --build-shared build Charm++ dynamic libraries (.so) "
88 echo ''
89 echo 'Enable/disable features:'
90 $srcbaseabs/scripts/configure --help | grep enable-
91 $srcbaseabs/scripts/configure --help | grep with-
92 echo " --with-production build Charm++ with all optimizations for maximum performance, and disabling all above features"
93 echo ''
94 echo 'Miscellaneous options:'
95 echo ' --incdir=DIR specify additional include path for compiler'
96 echo ' --libdir=DIR specify additional lib path for compiler'
97 echo ' --basedir=DIR shortcut for the above two - DIR/include and DIR/lib'
98 echo ' -j[N] parallel make, N is the number of paralle make jobs'
99 echo " --with-lbtime-type specify real type for the load balancing timers"
100 echo " --destination=DIR build Charm++ inside DIR, by default the destination is <version>"
101 echo " --suffix=DIR append DIR to the destination directory of the Charm++ build"
102 echo " --tau-makefile=FILE Specify which TAU stub makefile to use"
104 echo ''
105 echo '<charmc-options>: normal compiler options e.g. -g -optimize -save -verbose'
106 if test $more = 1
107 then
108 echo ''
109 echo 'Examples:'
110 echo "1. display all supported options for net-linux-x86_64 using 'help':"
111 echo ' ./build charm++ net-linux-x86_64 help'
112 echo '2. compile Charm++ on Linux with all available tuning:'
113 echo ' ./build charm++ net-linux-x86_64 --with-production'
114 echo '3. compile Charm++ for Linux (32bit) clustermatic Beowulf cluster with Intel compiler and optimizations:'
115 echo ' ./build charm++ net-linux clustermatic icc -optimize'
116 echo '4. compile Charm++ for Windows with VC++ (Cygwin required):'
117 echo ' ./build charm++ net-win64 -optimize'
118 echo '5. compile Charm++ with MPI that is installed at /usr/local/mpich:'
119 echo ' ./build charm++ mpi-linux --incdir /usr/local/mpich/include --libdir /usr/local/mpich/lib -optimize'
120 echo ' or in short,'
121 echo ' ./build charm++ mpi-linux --basedir /usr/local/mpich -optimize'
122 echo ' ./build Tau --tau-makefile=/usr/local/packages/TAU/x86_64/lib/Makefile.tau-mpi'
123 echo ''
124 echo 'Note: This script:'
125 echo ' 1. Creates directories <destination> and <destination>/tmp'
126 echo ' 2. Copies src/scripts/Makefile into <destination>/tmp'
127 echo ' 3. Does a "make basics" in <destination>/tmp.'
128 echo ' 3. Does a "make -jN <target> <version> OPTS=<charmc-options>" in <destination>/tmp.'
129 echo "That's all build does. The rest is handled by the Makefile."
130 echo ''
131 echo 'Thank you for using Charm++, please send questions or comments to '
132 echo 'Parallel Programming Lab at University of Illinois at Urbana-Champaign'
133 echo '(email: charm@cs.illinois.edu).'
135 else
136 echo ''
137 echo "To get more detailed help, run ./build --help"
141 Echo() {
142 [ "x$QUIET" = "x--quiet" ] || echo $*
145 printOption() {
146 for prefix in cc conv-mach
148 str="Supported compilers:"
149 [ "$prefix" = "conv-mach" ] && str="Supported options:"
150 opts=""
151 for dir in $OPT_DIRS
153 # echo "Checking for $prefix in $dir"
154 files=`cd $dir; ls $prefix-*.h 2>/dev/null`
155 opts="$opts "`echo $files | sed 's/'$prefix'-\([^.]*\).h/\1/g'`
156 done
157 tmp=.tmp.$$
158 rm -f $tmp; touch $tmp
159 for o in $opts
161 echo $o >> $tmp
162 done
163 opts=`sort $tmp | uniq`
164 rm -f $tmp
165 echo $str $opts
166 done
167 exit 1
170 CheckDir() {
171 for d in $*
173 if test ! -d $d
174 then
175 echo Error: cannot find $d!
176 exit 1
178 done
181 TestIfCompiler() {
182 for dir in $OPT_DIRS
184 [ -f $dir/cc-$1.sh ] && return 1
185 done
186 return 0
189 TestIfOption() {
190 for dir in $OPT_DIRS
192 [ -f $dir/conv-mach-$1.h ] && return 1
193 done
195 echo "Error> option: $1 is not supported in this version!";
196 printOption
200 # start
202 BUILD_CUDA=0
203 MAKEOPTS=""
204 OPTS=""
205 BOPTS=""
206 MORE=""
207 COMPILER=""
208 BASEDIR=
209 LIBDIR=
210 INCDIR=
211 ARCH=
212 BUILD_SHARED="" # default no shared lib
213 WITH_ROMIO="true" # default to building ROMIO on AMPI
214 WITH_PRODUCTION=
215 BUILD_EMULATOR=0
216 DESTINATION=""
217 DESTINATION_SUFFIX=""
218 TAU_MAKEFILE=""
219 QUIET=""
221 [ "$1" = '--help' -o "$1" = '-h' ] && more=1 && syntax | ( less || more ) && exit 1
222 [ $# -lt 2 ] && ./smart-build.pl && exit 1
223 PROGRAM=$1
224 shift
226 # find longest prefix of version argument that exists as a directory in $src
227 VERSION=$1
228 VERSOPTS=""
229 testversion=""
230 oldifs=$IFS
231 IFS=-
232 for w in $1; do
233 IFS=$oldifs
234 if [ -z "$testversion" ]; then
235 testversion=$w
236 else
237 testversion="$testversion-$w"
239 if [ -d $src/$testversion ]; then
240 VERSION=$testversion
241 VERSOPTS=""
242 else
243 VERSOPTS="$VERSOPTS $w"
245 done
246 if [ $VERSION = $1 ]; then VERSOPTS=""; fi
248 BASEVERSION=$VERSION;
249 if test -f $src/$BASEVERSION/vdir_link
250 then
251 BASEVERSION=`cat $src/$BASEVERSION/vdir_link`
253 ARCH=`echo $BASEVERSION | sed -e 's@-.*@@'`
254 shift
256 #echo $src
257 #echo $BASEVERSION
258 #echo $ARCH
260 OPT_DIRS="$src/$BASEVERSION $src/$ARCH $src/common"
262 # process remainder of version argument as options, copied from below
263 for w in $VERSOPTS; do
264 # This has to be a build-time option (like "smp")
265 TestIfCompiler $w
266 if [ $? -eq 1 ]
267 then
268 # It specifies a compiler:
269 if [ ! -z "$COMPILER" ]
270 then
271 echo "Error> Tried to specify two compilers: $COMPILER and $w"
272 printOption
274 COMPILER=$w
275 else
276 # It specifies some other option:
277 TestIfOption $w
278 BOPTS="$BOPTS $w"
279 [ $w = "bigemulator" ] && BUILD_EMULATOR=1
280 [ $w = "bigsim" ] && BUILD_EMULATOR=1
281 [ $w = "cuda" ] && BUILD_CUDA=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 --without-romio)
354 WITH_ROMIO=""; shift
356 --with-production)
357 WITH_PRODUCTION="true"
358 shift
360 --with-*)
361 CONFIG_OPTS="$CONFIG_OPTS $1"
362 shift
364 --without-*)
365 CONFIG_OPTS="$CONFIG_OPTS $1"
366 shift
368 --destination)
369 shift
370 DESTINATION="$1"
371 shift
373 --destination=*)
374 DESTINATION="`echo $1 | awk -F= '{print $2}'`"
375 shift
377 --suffix)
378 shift
379 DESTINATION_SUFFIX="$1"
380 shift
382 --suffix=*)
383 DESTINATION_SUFFIX="`echo $1 | awk -F= '{print $2}'`"
384 shift
386 --tau-makefile)
387 TAU_MAKEFILE=$1
388 shift
390 --tau-makefile=*)
391 TAU_MAKEFILE=`echo $1 | awk -F= '{print $2}'`
392 shift
394 --quiet)
395 MAKEOPTS="$MAKEOPTS --quiet"
396 QUIET="--quiet"
397 shift;
399 --enable-tracing|--enable-tracing=*)
400 CONFIG_OPTS="$CONFIG_OPTS $1"
401 ENABLE_TRACING=yes
402 shift
404 --enable-*)
405 CONFIG_OPTS="$CONFIG_OPTS $1"
406 shift
408 --disable-*)
409 CONFIG_OPTS="$CONFIG_OPTS $1"
410 shift
412 -j*)
413 PMAKENUM=`echo $1 | awk -Fj '{print $2}'`
414 MAKEOPTS="$MAKEOPTS -j $PMAKENUM"
415 shift;
417 -*)
418 # We hit a real compiler option (like -g, or -Dfoo),
419 # so just copy over all remaining options
420 while [ ! $# -eq 0 ]
422 OPTS="$OPTS $1"; shift
423 done
425 "help")
426 printOption
429 # This has to be a build-time option (like "smp")
430 TestIfCompiler $1
431 if [ $? -eq 1 ]
432 then
433 # It specifies a compiler:
434 if [ ! -z "$COMPILER" ]
435 then
436 echo "Error> Tried to specify two compilers: $COMPILER and $1"
437 printOption
439 COMPILER=$1
440 else
441 # It specifies some other option:
442 TestIfOption $1
443 BOPTS="$BOPTS $1"
444 [ $1 = "bigemulator" ] && BUILD_EMULATOR=1
445 [ $1 = "bigsim" ] && BUILD_EMULATOR=1
446 [ $1 = "cuda" ] && BUILD_CUDA=1
448 shift
450 esac
451 done
453 if [ $BUILD_CUDA -eq 1 ]; then
454 echo "checking for CUDA toolkit directory"
455 CUDA_CANDIDATE_DIRS="$CUDATOOLKIT_HOME /usr/local/cuda /usr/lib/nvidia-cuda-toolkit"
456 for dir in $CUDA_CANDIDATE_DIRS; do
457 if test -d "$dir"; then
458 CUDA_DIR="$dir"
459 HAVE_CUDA="yes"
460 echo "CUDA_DIR=$CUDA_DIR"
461 break
463 done
466 [ "x$VERSION" = "x" ] && syntax && exit 1
468 if test -n "$WITH_PRODUCTION" -a $BUILD_EMULATOR -eq 1 -a -z "$ENABLE_TRACING"
469 then
470 echo "Error: bigemulator requires tracing modules, --with-production must be used with --enable-tracing"
471 exit 1
474 if [ -z "$MAKE" ]
475 then
476 # prefer gmake
477 MAKE=`which gmake 2>/dev/null`
478 [ -z "$MAKE" -o ! -x "$MAKE" ] && MAKE='make'
481 if [ ! -f $src/$BASEVERSION/conv-mach.h ]
482 then
483 echo "Error> build can not find arch: $BASEVERSION!"
484 exit 1
487 #generate VERSION name combining all the build-time options.
488 if [ -n "$BOPTS" -o -n "$COMPILER" ]
489 then
490 echo "Selected Compiler: $COMPILER"
492 if test -n "$COMPILER" -a `echo "$BASEVERSION" | grep -c "cray\|gni\|gemini"` -gt 0
493 then
494 echo "Inserted explicit compiler options on Cray systems. Use compiler wrappers by loading PrgEnv-*"
495 echo "e.g.) module load PrgEnv-* (e.g. gnu for gcc, intel for icc, and pgi for pgcc)"
496 echo " ./build charm++ $BASEVERSION <other build options>"
497 echo "Charm++ uses the compiler wrapper 'CC' specified by the Cray system. Don't use explicit compiler options on Cray systems."
498 exit 1
501 echo "Selected Options: $BOPTS"
502 SORTED=`echo $BOPTS | awk '{ for (i = 1; i <= NF; ++i) print $i }' | sort`
503 BOPTS_WITHCOMPILER=`echo $SORTED $COMPILER`
504 for i in $BOPTS_WITHCOMPILER
506 VERSION=$VERSION-$i
507 done
510 #echo "|$DESTINATION|$DESTINATION_SUFFIX|"
512 if [ -z "$DESTINATION" ]
513 then
514 DESTINATION="$VERSION"
517 if [ $(dirname $DESTINATION) != "." ]
518 then
519 srcbaseabs="$(cd $srcbaseabs; pwd)"
520 srcbase=$srcbaseabs
521 src="$srcbaseabs/arch/"
524 if [ -n "$DESTINATION_SUFFIX" ]
525 then
526 DESTINATION="$DESTINATION-$DESTINATION_SUFFIX"
529 [ -d $DESTINATION ] || Echo "Creating dir: $DESTINATION"
530 [ -d $DESTINATION ] || mkdir $DESTINATION
531 [ -d $DESTINATION/tmp ] || Echo "Creating dir: $DESTINATION/tmp"
532 [ -d $DESTINATION/tmp ] || mkdir $DESTINATION/tmp
534 Echo "Copying src/scripts/Makefile to $DESTINATION/tmp"
535 rm -f $DESTINATION/tmp/Makefile
536 rm -f $DESTINATION/tmp/Make.depends
537 rm -f $DESTINATION/tmp/Make.cidepends
538 rm -f $DESTINATION/tmp/Make.lb
539 rm -f $DESTINATION/tmp/Make.machine
540 rm -f $DESTINATION/tmp/Make.extlib
543 # Create the bin, lib, include, etc. links:
544 WINNAME=`echo $VERSION | awk -F- '{print $2}'`
545 if [ "x_$WINNAME" = "x_win32" -o "x_$WINNAME" = "x_win64" ]
546 then
547 #Win32/64 version needs special compilers and *copied* (not linked)
548 # source files.
549 cp $src/win32/system_ln $DESTINATION/tmp
550 cp $src/win32/unistd.h $DESTINATION/tmp
551 echo "Compiling createlink.cpp ..."
552 (cd $src/win32; ../$WINNAME/unix2nt_cc -c createlink.cpp -o createlink.o -D_WIN32_WINNT=0x0500; ../$WINNAME/unix2nt_cc createlink.o)
554 if test ! -x $src/win32/createlink.exe
555 then
556 echo "VC++ is not properly installed!"
557 exit 1
559 chmod +x $DESTINATION/tmp/system_ln
560 cp $src/win32/gathertree.local $DESTINATION/tmp
561 cp $src/win32/gatherflat.local $DESTINATION/tmp
562 else
563 cat > $DESTINATION/tmp/system_ln <<EOF
564 #!/bin/sh
565 ln -f -s \$@
567 chmod +x $DESTINATION/tmp/system_ln
568 for newdir in `echo bin lib lib_so include tmp`
570 Echo "Soft-linking over $newdir"
571 if [ -r $newdir ]
572 then
573 rm -fr $newdir || exit 1
575 $DESTINATION/tmp/system_ln $DESTINATION/$newdir $newdir
576 done
577 rm -f VERSION
578 $DESTINATION/tmp/system_ln $DESTINATION/include/VERSION VERSION
581 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.depends" $DESTINATION/tmp/Make.depends
582 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.cidepends" $DESTINATION/tmp/Make.cidepends
583 if test -f "$srcbaseabs/ck-ldb/Make.lb"
584 then
585 $DESTINATION/tmp/system_ln "$srcbase/ck-ldb/Make.lb" $DESTINATION/tmp/Make.lb
586 else
587 touch $DESTINATION/tmp/Make.lb
589 $DESTINATION/tmp/system_ln "$srcbase/scripts/Makefile" $DESTINATION/tmp/Makefile
590 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.tau" $DESTINATION/tmp/Make.tau
591 touch $DESTINATION/tmp/Makefile.machine
592 touch $DESTINATION/tmp/Make.extlib
594 ConvUsr="$DESTINATION/tmp/conv-mach-pre.sh"
595 Echo "Generating $ConvUsr"
596 echo > $ConvUsr
597 if test -n "$LIBDIR"
598 then
599 echo 'USER_OPTS_LD="$USER_OPTS_LD '$LIBDIR'"' >> $ConvUsr
600 echo 'USER_OPTS_LDXX="$USER_OPTS_LDXX '$LIBDIR'"' >> $ConvUsr
602 if test -n "$INCDIR"
603 then
604 echo 'USER_OPTS_CC="$USER_OPTS_CC '$INCDIR'"' >> $ConvUsr
605 echo 'USER_OPTS_CXX="$USER_OPTS_CXX '$INCDIR'"' >> $ConvUsr
607 chmod +x $ConvUsr
609 # Create conv-mach-opt headers with special build-time options
610 ConvHeader="$DESTINATION/tmp/conv-mach-opt.h"
611 ConvSh="$DESTINATION/tmp/conv-mach-opt.sh"
612 if [ ! -f $ConvSh -o ! -f $ConvHeader ]
613 then
614 Echo "Generating $ConvHeader, conv-mach-opt.sh"
615 echo '/* Build-time options header, automatically generated by charm/build*/'> $ConvHeader
616 echo '# Built-time options header, automatically generated by charm/build'> $ConvSh
617 echo '[ -z "$CHARMINC" ] && CHARMINC="."' >> $ConvSh
619 if test -n "$COMPILER"
620 then
621 i="$COMPILER"
622 echo '#include "'cc-$i.h'"' >> $ConvHeader
623 echo '. $CHARMINC/'"cc-$i.sh" >> $ConvSh
625 if test -n "$BOPTS"
626 then
627 # pxshm+smp note: When combining the 'smp' and 'pxshm' directives, it is
628 # important that they be included in $ConvHeader in that
629 # exact order. See bug #717.
630 TMP=""
631 HAS_PXSHM=0
632 HAS_SMP=0
633 for i in $BOPTS; do
634 if [ "$i" = "smp" ]; then
635 HAS_SMP=1
636 elif [ "$i" = "pxshm" ]; then
637 HAS_PXSHM=1
638 else
639 TMP="$TMP $i"
641 done
642 if [ $HAS_PXSHM -eq 1 ]; then
643 TMP="pxshm $TMP"
645 if [ $HAS_SMP -eq 1 ]; then
646 TMP="smp $TMP"
649 BOPTS=$TMP
650 for i in $BOPTS
652 echo '#include "'conv-mach-$i.h'"' >> $ConvHeader
653 if [ $BUILD_CUDA -eq 1 ]; then
654 echo 'CUDA_DIR="'$CUDA_DIR'"'>>$ConvSh
656 echo '. $CHARMINC/'"conv-mach-$i.sh" >> $ConvSh
657 done
660 if test "$BUILD_SHARED" = "-build-shared"
661 then
662 echo "CMK_NO_BUILD_SHARED=false" >> $ConvSh
663 else
664 echo "CMK_NO_BUILD_SHARED=true" >> $ConvSh
667 if test -n "$WITH_ROMIO"
668 then
669 echo "CMK_AMPI_WITH_ROMIO=\"true\"" >> $ConvSh
672 if test -n "$WITH_PRODUCTION"
673 then
674 echo '#define CMK_OPTIMIZE 1' >> $ConvHeader
675 # Prepend optimize so that an explicit -no-optimize still works
676 OPTS="-optimize -production $OPTS"
677 CONFIG_OPTS="--disable-controlpoint --disable-tracing --disable-tracing-commthread --disable-charmdebug --disable-replay --disable-error-checking --disable-stats $CONFIG_OPTS"
680 # build with Tau
681 WITH_TAU=0
682 if [ "$PROGRAM" = "Tau" ]
683 then
684 Echo "TAU>>>> makefile config option: $TAU_MAKEFILE"
685 if [ -n "$TAU_MAKEFILE" -a -f $TAU_MAKEFILE ]
686 then
687 #Setting up TAU trace library:
688 Echo "TAU>>>> configuring with this TAU makefile: $TAU_MAKEFILE"
690 WITH_TAU=1
691 else
692 Echo "TAU>>>> ERROR could not find Makefile: $TAU_MAKEFILE, ignored"
693 TAU_MAKEFILE=""
697 if test $WITH_TAU -eq 1
698 then
699 [ -z "$TAU_MAKEFILE" ] && TAU_MAKEFILE="Make.tau"
700 SED_CHARMC="s@TAU_MAKEFILE=\(.*\)@TAU_MAKEFILE=$TAU_MAKEFILE@"
702 sed -e $SED_CHARMC $srcbaseabs/scripts/Makefile > .Makefile.$$ && cp .Makefile.$$ $srcbaseabs/scripts/Makefile && rm -f .Makefile.$$
703 sed -e $SED_CHARMC $srcbaseabs/scripts/charmc > .charmc.$$ && cp .charmc.$$ $srcbaseabs/scripts/charmc && rm -f .charmc.$$
705 echo "#define CMK_WITH_TAU 1" >> $ConvHeader
706 echo "#define pthread_create tau_pthread_create" >> $ConvHeader
707 echo "#define pthread_exit tau_pthread_exit" >> $ConvHeader
709 echo "CMK_WITH_TAU=\"true\"" >> $ConvSh
712 if [ "$PROGRAM" = "ChaNGa" ]
713 then
714 #Setting lbuserdata when the build is ChaNGa
715 CONFIG_OPTS="--enable-lbuserdata $CONFIG_OPTS"
718 echo $BASEVERSION > $DESTINATION/tmp/.vdir
719 echo $BASEVERSION | sed -e 's@-.*@@' > $DESTINATION/tmp/.gdir
721 if test $BUILD_EMULATOR = 1
722 then
723 PROGRAM="$PROGRAM bigsim"
724 # CONFIG_OPTS="--disable-charmdebug $CONFIG_OPTS"
727 printError()
729 Echo "-------------------------------------------------"
730 Echo "Charm++ NOT BUILT. Either cd into $DESTINATION/tmp and try"
731 Echo "to resolve the problems yourself, visit"
732 Echo " http://charm.cs.illinois.edu/"
733 Echo "for more information. Otherwise, email the developers at charm@cs.illinois.edu"
734 exit $MAKEEXIT
737 echo 'BUILDOPTS="'$OPTS'"' >> $ConvSh
738 echo "SRCBASE=$srcbase" > $DESTINATION/tmp/charmpath.mk
740 Echo "Performing '$MAKE $MAKEOPTS basics OPTS="$OPTS" QUIET="$QUIET" CONFIG_OPTS="$CONFIG_OPTS"' in $DESTINATION/tmp"
741 cd $DESTINATION/tmp
742 echo "CONFIG_OPTS=\"$CONFIG_OPTS\"" > config_opts.sh
743 chmod +x config_opts.sh
744 echo "OPTSATBUILDTIME += $OPTS" > buildopts.mk
745 $MAKE $MAKEOPTS basics OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
746 MAKEEXIT=$?
747 [ $MAKEEXIT -ne 0 ] && printError
749 Echo "Performing '$MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS" QUIET="$QUIET"' in $DESTINATION/tmp"
750 $MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
751 MAKEEXIT=$?
752 if [ $MAKEEXIT -eq 0 ]
753 then
754 Echo "-------------------------------------------------"
755 Echo "$PROGRAM built successfully."
756 Echo "Next, try out a sample program like" \
757 "$DESTINATION/tests/charm++/simplearrayhello"
758 else
759 printError