build #1110: Fix earlier patch that broke non-default compilers on non-Cray systems
[charm.git] / build
blobc49591e0a14961695830dfb46a443ff9ad5b3b3e
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-romio build AMPI with ROMIO library"
100 echo " --with-lbtime-type specify real type for the load balancing timers"
101 echo " --destination=DIR build Charm++ inside DIR, by default the destination is <version>"
102 echo " --suffix=DIR append DIR to the destination directory of the Charm++ build"
103 echo " --tau-makefile=FILE Specify which TAU stub makefile to use"
105 echo ''
106 echo '<charmc-options>: normal compiler options e.g. -g -optimize -save -verbose'
107 if test $more = 1
108 then
109 echo ''
110 echo 'Examples:'
111 echo "1. display all supported options for net-linux-x86_64 using 'help':"
112 echo ' ./build charm++ net-linux-x86_64 help'
113 echo '2. compile Charm++ on Linux with all available tuning:'
114 echo ' ./build charm++ net-linux-x86_64 --with-production'
115 echo '3. compile Charm++ for Linux (32bit) clustermatic Beowulf cluster with Intel compiler and optimizations:'
116 echo ' ./build charm++ net-linux clustermatic icc -optimize'
117 echo '4. compile Charm++ for Windows with VC++ (Cygwin required):'
118 echo ' ./build charm++ net-win64 -optimize'
119 echo '5. 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")
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
282 [ $w = "cuda" ] && BUILD_CUDA=1
284 done
286 while [ ! $# -eq 0 ]
288 case "$1" in
289 "--basedir")
290 shift;
291 for dir in $1
293 CheckDir $dir/include $dir/lib
294 LIBDIR="$LIBDIR -L$dir/lib";
295 INCDIR="$INCDIR -I$dir/include"
296 done
297 shift
299 --basedir=*)
300 basedir=`echo $1 | awk -F= '{print $2}'`
301 for dir in $basedir
303 CheckDir $dir/include $dir/lib
304 LIBDIR="$LIBDIR -L$dir/lib";
305 INCDIR="$INCDIR -I$dir/include"
306 done
307 shift
309 "--libdir")
310 shift; CheckDir $1
311 for dir in $1
313 LIBDIR="$LIBDIR -L$dir";
314 done
315 shift
317 --libdir=*)
318 libdir=`echo $1 | awk -F= '{print $2}'`
319 CheckDir $libdir
320 for dir in $libdir
322 LIBDIR="$LIBDIR -L$dir";
323 done
324 shift
326 "--incdir")
327 shift; CheckDir $1
328 for dir in $1
330 INCDIR="$INCDIR -I$dir";
331 done
332 shift
334 --incdir=*)
335 incdir=`echo $1 | awk -F= '{print $2}'`
336 CheckDir $incdir
337 for dir in $incdir
339 INCDIR="$INCDIR -I$dir";
340 done
341 shift
343 --no-build-shared|--no-shared)
344 #BUILD_SHARED="-no-build-shared";
345 shift
347 --build-shared)
348 BUILD_SHARED="-build-shared";
349 shift
351 --with-romio)
352 WITH_ROMIO="true"; shift
354 --with-production)
355 WITH_PRODUCTION="true"
356 shift
358 --with-*)
359 CONFIG_OPTS="$CONFIG_OPTS $1"
360 shift
362 --without-*)
363 CONFIG_OPTS="$CONFIG_OPTS $1"
364 shift
366 --destination)
367 shift
368 DESTINATION="$1"
369 shift
371 --destination=*)
372 DESTINATION="`echo $1 | awk -F= '{print $2}'`"
373 shift
375 --suffix)
376 shift
377 DESTINATION_SUFFIX="$1"
378 shift
380 --suffix=*)
381 DESTINATION_SUFFIX="`echo $1 | awk -F= '{print $2}'`"
382 shift
384 --tau-makefile)
385 TAU_MAKEFILE=$1
386 shift
388 --tau-makefile=*)
389 TAU_MAKEFILE=`echo $1 | awk -F= '{print $2}'`
390 shift
392 --quiet)
393 MAKEOPTS="$MAKEOPTS --quiet"
394 QUIET="--quiet"
395 shift;
397 --enable-tracing|--enable-tracing=*)
398 CONFIG_OPTS="$CONFIG_OPTS $1"
399 ENABLE_TRACING=yes
400 shift
402 --enable-*)
403 CONFIG_OPTS="$CONFIG_OPTS $1"
404 shift
406 --disable-*)
407 CONFIG_OPTS="$CONFIG_OPTS $1"
408 shift
410 -j*)
411 PMAKENUM=`echo $1 | awk -Fj '{print $2}'`
412 MAKEOPTS="$MAKEOPTS -j $PMAKENUM"
413 shift;
415 -*)
416 # We hit a real compiler option (like -g, or -Dfoo),
417 # so just copy over all remaining options
418 while [ ! $# -eq 0 ]
420 OPTS="$OPTS $1"; shift
421 done
423 "help")
424 printOption
427 # This has to be a build-time option (like "smp")
428 TestIfCompiler $1
429 if [ $? -eq 1 ]
430 then
431 # It specifies a compiler:
432 if [ ! -z "$COMPILER" ]
433 then
434 echo "Error> Tried to specify two compilers: $COMPILER and $1"
435 printOption
437 COMPILER=$1
438 else
439 # It specifies some other option:
440 TestIfOption $1
441 BOPTS="$BOPTS $1"
442 [ $1 = "bigemulator" ] && BUILD_EMULATOR=1
443 [ $1 = "bigsim" ] && BUILD_EMULATOR=1
444 [ $1 = "cuda" ] && BUILD_CUDA=1
446 shift
448 esac
449 done
451 if [ $BUILD_CUDA -eq 1 ]; then
452 echo "checking for CUDA toolkit directory"
453 CUDA_CANDIDATE_DIRS="$CUDATOOLKIT_HOME /usr/local/cuda /usr/lib/nvidia-cuda-toolkit"
454 for dir in $CUDA_CANDIDATE_DIRS; do
455 if test -d "$dir"; then
456 CUDA_DIR="$dir"
457 HAVE_CUDA="yes"
458 echo "CUDA_DIR=$CUDA_DIR"
459 break
461 done
464 [ "x$VERSION" = "x" ] && syntax && exit 1
466 if test -n "$WITH_PRODUCTION" -a $BUILD_EMULATOR -eq 1 -a -z "$ENABLE_TRACING"
467 then
468 echo "Error: bigemulator requires tracing modules, --with-production must be used with --enable-tracing"
469 exit 1
472 if [ -z "$MAKE" ]
473 then
474 # prefer gmake
475 MAKE=`which gmake 2>/dev/null`
476 [ -z "$MAKE" -o ! -x "$MAKE" ] && MAKE='make'
479 if [ ! -f $src/$BASEVERSION/conv-mach.h ]
480 then
481 echo "Error> build can not find arch: $BASEVERSION!"
482 exit 1
485 #generate VERSION name combining all the build-time options.
486 if [ -n "$BOPTS" -o -n "$COMPILER" ]
487 then
488 echo "Selected Compiler: $COMPILER"
490 if test `echo "$BASEVERSION" | grep -c "cray\|gni\|gemini"` -gt 0
491 then
492 echo "Inserted explicit compiler options on Cray systems. Use compiler wrappers by loading PrgEnv-*"
493 echo "e.g.) module load PrgEnv-* (e.g. gnu for gcc, intel for icc, and pgi for pgcc)"
494 echo " ./build charm++ $BASEVERSION <other build options>"
495 echo "Charm++ uses the compiler wrapper 'CC' specified by the Cray system. Don't use explicit compiler options on Cray systems."
496 exit 1
499 echo "Selected Options: $BOPTS"
500 SORTED=`echo $BOPTS | awk '{ for (i = 1; i <= NF; ++i) print $i }' | sort`
501 BOPTS_WITHCOMPILER=`echo $SORTED $COMPILER`
502 for i in $BOPTS_WITHCOMPILER
504 VERSION=$VERSION-$i
505 done
508 #echo "|$DESTINATION|$DESTINATION_SUFFIX|"
510 if [ -z "$DESTINATION" ]
511 then
512 DESTINATION="$VERSION"
515 if [ $(dirname $DESTINATION) != "." ]
516 then
517 srcbaseabs="$(cd $srcbaseabs; pwd)"
518 srcbase=$srcbaseabs
519 src="$srcbaseabs/arch/"
522 if [ -n "$DESTINATION_SUFFIX" ]
523 then
524 DESTINATION="$DESTINATION-$DESTINATION_SUFFIX"
527 [ -d $DESTINATION ] || Echo "Creating dir: $DESTINATION"
528 [ -d $DESTINATION ] || mkdir $DESTINATION
529 [ -d $DESTINATION/tmp ] || Echo "Creating dir: $DESTINATION/tmp"
530 [ -d $DESTINATION/tmp ] || mkdir $DESTINATION/tmp
532 Echo "Copying src/scripts/Makefile to $DESTINATION/tmp"
533 rm -f $DESTINATION/tmp/Makefile
534 rm -f $DESTINATION/tmp/Make.depends
535 rm -f $DESTINATION/tmp/Make.cidepends
536 rm -f $DESTINATION/tmp/Make.lb
537 rm -f $DESTINATION/tmp/Make.machine
538 rm -f $DESTINATION/tmp/Make.extlib
541 # Create the bin, lib, include, etc. links:
542 WINNAME=`echo $VERSION | awk -F- '{print $2}'`
543 if [ "x_$WINNAME" = "x_win32" -o "x_$WINNAME" = "x_win64" ]
544 then
545 #Win32/64 version needs special compilers and *copied* (not linked)
546 # source files.
547 cp $src/win32/system_ln $DESTINATION/tmp
548 cp $src/win32/unistd.h $DESTINATION/tmp
549 echo "Compiling createlink.cpp ..."
550 (cd $src/win32; ../$WINNAME/unix2nt_cc -c createlink.cpp -o createlink.o -D_WIN32_WINNT=0x0500; ../$WINNAME/unix2nt_cc createlink.o)
552 if test ! -x $src/win32/createlink.exe
553 then
554 echo "VC++ is not properly installed!"
555 exit 1
557 chmod +x $DESTINATION/tmp/system_ln
558 cp $src/win32/gathertree.local $DESTINATION/tmp
559 cp $src/win32/gatherflat.local $DESTINATION/tmp
560 else
561 cat > $DESTINATION/tmp/system_ln <<EOF
562 #!/bin/sh
563 ln -f -s \$@
565 chmod +x $DESTINATION/tmp/system_ln
566 for newdir in `echo bin lib lib_so include tmp`
568 Echo "Soft-linking over $newdir"
569 if [ -r $newdir ]
570 then
571 rm -fr $newdir || exit 1
573 $DESTINATION/tmp/system_ln $DESTINATION/$newdir $newdir
574 done
575 rm -f VERSION
576 $DESTINATION/tmp/system_ln $DESTINATION/include/VERSION VERSION
579 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.depends" $DESTINATION/tmp/Make.depends
580 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.cidepends" $DESTINATION/tmp/Make.cidepends
581 if test -f "$srcbaseabs/ck-ldb/Make.lb"
582 then
583 $DESTINATION/tmp/system_ln "$srcbase/ck-ldb/Make.lb" $DESTINATION/tmp/Make.lb
584 else
585 touch $DESTINATION/tmp/Make.lb
587 $DESTINATION/tmp/system_ln "$srcbase/scripts/Makefile" $DESTINATION/tmp/Makefile
588 $DESTINATION/tmp/system_ln "$srcbase/scripts/Make.tau" $DESTINATION/tmp/Make.tau
589 touch $DESTINATION/tmp/Makefile.machine
590 touch $DESTINATION/tmp/Make.extlib
592 ConvUsr="$DESTINATION/tmp/conv-mach-pre.sh"
593 Echo "Generating $ConvUsr"
594 echo > $ConvUsr
595 if test -n "$LIBDIR"
596 then
597 echo 'USER_OPTS_LD="$USER_OPTS_LD '$LIBDIR'"' >> $ConvUsr
598 echo 'USER_OPTS_LDXX="$USER_OPTS_LDXX '$LIBDIR'"' >> $ConvUsr
600 if test -n "$INCDIR"
601 then
602 echo 'USER_OPTS_CC="$USER_OPTS_CC '$INCDIR'"' >> $ConvUsr
603 echo 'USER_OPTS_CXX="$USER_OPTS_CXX '$INCDIR'"' >> $ConvUsr
605 chmod +x $ConvUsr
607 # Create conv-mach-opt headers with special build-time options
608 ConvHeader="$DESTINATION/tmp/conv-mach-opt.h"
609 ConvSh="$DESTINATION/tmp/conv-mach-opt.sh"
610 if [ ! -f $ConvSh -o ! -f $ConvHeader ]
611 then
612 Echo "Generating $ConvHeader, conv-mach-opt.sh"
613 echo '/* Build-time options header, automatically generated by charm/build*/'> $ConvHeader
614 echo '# Built-time options header, automatically generated by charm/build'> $ConvSh
615 echo '[ -z "$CHARMINC" ] && CHARMINC="."' >> $ConvSh
617 if test -n "$COMPILER"
618 then
619 i="$COMPILER"
620 echo '#include "'cc-$i.h'"' >> $ConvHeader
621 echo '. $CHARMINC/'"cc-$i.sh" >> $ConvSh
623 if test -n "$BOPTS"
624 then
625 # pxshm+smp note: When combining the 'smp' and 'pxshm' directives, it is
626 # important that they be included in $ConvHeader in that
627 # exact order. See bug #717.
628 TMP=""
629 HAS_PXSHM=0
630 HAS_SMP=0
631 for i in $BOPTS; do
632 if [ "$i" = "smp" ]; then
633 HAS_SMP=1
634 elif [ "$i" = "pxshm" ]; then
635 HAS_PXSHM=1
636 else
637 TMP="$TMP $i"
639 done
640 if [ $HAS_PXSHM -eq 1 ]; then
641 TMP="pxshm $TMP"
643 if [ $HAS_SMP -eq 1 ]; then
644 TMP="smp $TMP"
647 BOPTS=$TMP
648 for i in $BOPTS
650 echo '#include "'conv-mach-$i.h'"' >> $ConvHeader
651 if [ $BUILD_CUDA -eq 1 ]; then
652 echo 'CUDA_DIR="'$CUDA_DIR'"'>>$ConvSh
654 echo '. $CHARMINC/'"conv-mach-$i.sh" >> $ConvSh
655 done
658 if test "$BUILD_SHARED" = "-build-shared"
659 then
660 echo "CMK_NO_BUILD_SHARED=false" >> $ConvSh
661 else
662 echo "CMK_NO_BUILD_SHARED=true" >> $ConvSh
665 if test -n "$WITH_ROMIO"
666 then
667 echo "CMK_AMPI_WITH_ROMIO=\"true\"" >> $ConvSh
670 if test -n "$WITH_PRODUCTION"
671 then
672 echo '#define CMK_OPTIMIZE 1' >> $ConvHeader
673 # Prepend optimize so that an explicit -no-optimize still works
674 OPTS="-optimize -production $OPTS"
675 CONFIG_OPTS="--disable-controlpoint --disable-tracing --disable-tracing-commthread --disable-charmdebug --disable-replay --disable-error-checking --disable-stats $CONFIG_OPTS"
678 # build with Tau
679 WITH_TAU=0
680 if [ "$PROGRAM" = "Tau" ]
681 then
682 Echo "TAU>>>> makefile config option: $TAU_MAKEFILE"
683 if [ -n "$TAU_MAKEFILE" -a -f $TAU_MAKEFILE ]
684 then
685 #Setting up TAU trace library:
686 Echo "TAU>>>> configuring with this TAU makefile: $TAU_MAKEFILE"
688 WITH_TAU=1
689 else
690 Echo "TAU>>>> ERROR could not find Makefile: $TAU_MAKEFILE, ignored"
691 TAU_MAKEFILE=""
695 if test $WITH_TAU -eq 1
696 then
697 [ -z "$TAU_MAKEFILE" ] && TAU_MAKEFILE="Make.tau"
698 SED_CHARMC="s@TAU_MAKEFILE=\(.*\)@TAU_MAKEFILE=$TAU_MAKEFILE@"
700 sed -e $SED_CHARMC $srcbaseabs/scripts/Makefile > .Makefile.$$ && cp .Makefile.$$ $srcbaseabs/scripts/Makefile && rm -f .Makefile.$$
701 sed -e $SED_CHARMC $srcbaseabs/scripts/charmc > .charmc.$$ && cp .charmc.$$ $srcbaseabs/scripts/charmc && rm -f .charmc.$$
703 echo "#define CMK_WITH_TAU 1" >> $ConvHeader
704 echo "#define pthread_create tau_pthread_create" >> $ConvHeader
705 echo "#define pthread_exit tau_pthread_exit" >> $ConvHeader
707 echo "CMK_WITH_TAU=\"true\"" >> $ConvSh
710 if [ "$PROGRAM" = "ChaNGa" ]
711 then
712 #Setting lbuserdata when the build is ChaNGa
713 CONFIG_OPTS="--enable-lbuserdata $CONFIG_OPTS"
716 echo $BASEVERSION > $DESTINATION/tmp/.vdir
717 echo $BASEVERSION | sed -e 's@-.*@@' > $DESTINATION/tmp/.gdir
719 if test $BUILD_EMULATOR = 1
720 then
721 PROGRAM="$PROGRAM bigsim"
722 # CONFIG_OPTS="--disable-charmdebug $CONFIG_OPTS"
725 printError()
727 Echo "-------------------------------------------------"
728 Echo "Charm++ NOT BUILT. Either cd into $DESTINATION/tmp and try"
729 Echo "to resolve the problems yourself, visit"
730 Echo " http://charm.cs.illinois.edu/"
731 Echo "for more information. Otherwise, email the developers at charm@cs.illinois.edu"
732 exit $MAKEEXIT
735 echo 'BUILDOPTS="'$OPTS'"' >> $ConvSh
736 echo "SRCBASE=$srcbase" > $DESTINATION/tmp/charmpath.mk
738 Echo "Performing '$MAKE $MAKEOPTS basics OPTS="$OPTS" QUIET="$QUIET" CONFIG_OPTS="$CONFIG_OPTS"' in $DESTINATION/tmp"
739 cd $DESTINATION/tmp
740 echo "CONFIG_OPTS=\"$CONFIG_OPTS\"" > config_opts.sh
741 chmod +x config_opts.sh
742 echo "OPTSATBUILDTIME += $OPTS" > buildopts.mk
743 $MAKE $MAKEOPTS basics OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
744 MAKEEXIT=$?
745 [ $MAKEEXIT -ne 0 ] && printError
747 Echo "Performing '$MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS" QUIET="$QUIET"' in $DESTINATION/tmp"
748 $MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
749 MAKEEXIT=$?
750 if [ $MAKEEXIT -eq 0 ]
751 then
752 Echo "-------------------------------------------------"
753 Echo "$PROGRAM built successfully."
754 Echo "Next, try out a sample program like" \
755 "$DESTINATION/tests/charm++/simplearrayhello"
756 else
757 printError