Feature #574 win: Copy binaries to <build>/bin not /usr/bin
[charm.git] / build
blobbe9a8c7e96dabc2fb6da60f89edd1cb69843854a
1 #!/bin/sh
3 # Silly shorthand, used for source reorganization
4 src="src/arch"
6 more=0
8 syntax() {
9 echo ''
10 echo 'Usage: build <target> <version> <options> [charmc-options ...]'
11 echo ''
12 echo '<targets>: converse charm++ LIBS AMPI FEM bigemulator pose msa'
13 echo '<targets>: doc ps-doc pdf-doc html-doc'
14 if test $more = 1
15 then
16 echo ''
17 echo ' charm++ compile Charm++ core only'
18 echo ' AMPI compile Adaptive MPI on top of Charm++'
19 echo ' FEM compile FEM framework'
20 echo ' LIBS compile additional parallel libraries with Charm++ core'
21 echo ' bigemulator build additional BigSim libraries'
22 echo ' pose build POSE parallel discrete event simulator'
23 echo ' msa build Multiphase Shared Arrays(MSA) library'
24 echo ' Tau build the TAU tracing library for generating TAU performance data'
25 echo ' ChaNGa compile Charm++ core and necessary libraries for ChaNGa'
26 echo ' everylb compile EveryLB suite of load balancing strategies'
27 echo ''
29 echo '<versions>: '
30 ( 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 )
31 echo ''
32 echo '<options>: compiler and platform specific options'
33 echo 'icc iccstatic xlc xlc64 gcc clang craycc pgcc pathscale cc cc64 mpcc ecc gcc64 gcc3 mpcc32 mpcc64 mpicxx'
34 echo 'help smp gm tcp scyld clustermatic bigemulator ooc syncft mlogft causalft'
35 echo 'papi pthreads lam'
36 echo '--incdir --libdir --basedir --build-shared --destination --suffix -j'
37 if test $more = 1
38 then
39 echo ''
40 echo 'For platform specific options, use help option:'
41 echo ' help platform specific help, e.g. ./build charm++ net-linux-x86_64 help'
42 echo ''
43 echo 'Choose a compiler (only one option is allowed from this section):'
44 echo ' icc, iccstatic Intel compilers (default or static linking)'
45 echo ' xlc, xlc64 IBM XL compilers (with 64-bit option on architectures with 32-bit modes)'
46 echo ' gcc GNU compiler collection (on platforms where the default differs)'
47 echo ' clang Clang C/C++ compiler'
48 echo ' craycc Cray compilers'
49 echo ' pgcc Portland Group compilers'
50 echo ' pathscale Pathscale compiler suite'
51 echo ' cc, cc64 For Sun WorkShop C++ 32/64 bit compilers'
52 echo ' mpcc SUN Solaris C++ compiler for MPI'
53 echo ' ecc Intel C/C++ compiler for Linux IA64 (Itanium)'
54 echo ' gcc3 GNU GCC/G++ version 3'
55 echo ''
56 echo 'Choose an alternative fortran compiler (only one option is allowed from this section):'
57 echo ' g95 G95 at http://ww.g95.org'
58 echo " pgf90 Portland Group Fortran compiler"
59 echo ' ifort Intel Fortran compiler'
60 echo ''
61 echo 'Platform specific options (choose multiple if apply):'
62 echo ' smp support for SMP, multithreaded charm on each node'
63 echo ' ibverbs use Infiniband Verbs for communication (only for net-linux-x86_64; prefer verbs-*)'
64 echo ' lam Use LAM MPI'
65 echo ' mpt use SGI Message Passing Toolkit (only for mpi version)'
66 echo ' gm use Myrinet for communication'
67 echo ' tcp use TCP sockets for communication (only for net version)'
68 echo ' scyld compile for Scyld Beowulf cluster based on bproc'
69 echo ' clustermatic compile for Clustermatic (support version 3 and 4) '
70 echo ' pthreads compile with pthreads Converse threads'
71 echo ''
72 echo 'Advanced options:'
73 echo ' bigemulator compile for BigSim simulator'
74 echo ' ooc compile with out of core support'
75 echo ' syncft compile with Charm++ fault tolerance support'
76 echo ' mlogft compile with Charm++ message logging fault tolerance support'
77 echo ' papi compile with PAPI performance counter support (if any)'
78 echo ''
79 echo "Charm++ dynamic libraries:"
80 echo " --no-build-shared don't build Charm++'s shared libraries (default)"
81 echo " --build-shared build Charm++ dynamic libraries (.so) "
82 echo ''
83 echo 'Enable/disable features:'
84 src/scripts/configure --help | grep enable-
85 src/scripts/configure --help | grep with-
86 echo " --with-production build Charm++ with all optimizations for maximum performance, and disabling all above features"
87 echo ''
88 echo 'Miscellaneous options:'
89 echo ' --incdir=DIR specify additional include path for compiler'
90 echo ' --libdir=DIR specify additional lib path for compiler'
91 echo ' --basedir=DIR shortcut for the above two - DIR/include and DIR/lib'
92 echo ' -j[N] parallel make, N is the number of paralle make jobs'
93 echo " --with-romio build AMPI with ROMIO library"
94 echo " --with-lbtime-type specify real type for the load balancing timers"
95 echo " --destination=DIR build Charm++ inside DIR, by default the destination is <version>"
96 echo " --suffix=DIR append DIR to the destination directory of the Charm++ build"
97 echo " --tau-makefile=FILE Specify which TAU stub makefile to use"
99 echo ''
100 echo '<charmc-options>: normal compiler options e.g. -g -optimize -save -verbose'
101 if test $more = 1
102 then
103 echo ''
104 echo 'Examples:'
105 echo "1. display all supported options for net-linux-x86_64 using 'help':"
106 echo ' ./build charm++ net-linux-x86_64 help'
107 echo '2. compile Charm++ on Linux with all available tuning:'
108 echo ' ./build charm++ net-linux-x86_64 --with-production'
109 echo '3. compile Charm++ for Linux (32bit) clustermatic Beowulf cluster with Intel compiler and optimizations:'
110 echo ' ./build charm++ net-linux clustermatic icc -optimize'
111 echo '4. compile Charm++ for IA64 Linux cluster with MPICH-GM:'
112 echo ' ./build charm++ mpi-linux-ia64 gm -optimize'
113 echo '5. compile Charm++ for Windows with VC++ (Cygwin required):'
114 echo ' ./build charm++ net-win32 -optimize'
115 echo '6. compile on IBM SP with MPI using parallel gmake, 4 jobs simultaneously:'
116 echo ' MAKE=gmake ./build charm++ mpi-sp -j4 -optimize # sh'
117 echo ' setenv MAKE gmake; ./build charm++ mpi-sp -j4 -optimize # csh'
118 echo '7. 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=
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", "gcc3", or "kcc")
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
282 done
284 while [ ! $# -eq 0 ]
286 case "$1" in
287 "--basedir")
288 shift;
289 for dir in $1
291 CheckDir $dir/include $dir/lib
292 LIBDIR="$LIBDIR -L$dir/lib";
293 INCDIR="$INCDIR -I$dir/include"
294 done
295 shift
297 --basedir=*)
298 basedir=`echo $1 | awk -F= '{print $2}'`
299 for dir in $basedir
301 CheckDir $dir/include $dir/lib
302 LIBDIR="$LIBDIR -L$dir/lib";
303 INCDIR="$INCDIR -I$dir/include"
304 done
305 shift
307 "--libdir")
308 shift; CheckDir $1
309 for dir in $1
311 LIBDIR="$LIBDIR -L$dir";
312 done
313 shift
315 --libdir=*)
316 libdir=`echo $1 | awk -F= '{print $2}'`
317 CheckDir $libdir
318 for dir in $libdir
320 LIBDIR="$LIBDIR -L$dir";
321 done
322 shift
324 "--incdir")
325 shift; CheckDir $1
326 for dir in $1
328 INCDIR="$INCDIR -I$dir";
329 done
330 shift
332 --incdir=*)
333 incdir=`echo $1 | awk -F= '{print $2}'`
334 CheckDir $incdir
335 for dir in $incdir
337 INCDIR="$INCDIR -I$dir";
338 done
339 shift
341 --no-build-shared|--no-shared)
342 #BUILD_SHARED="-no-build-shared";
343 shift
345 --build-shared)
346 BUILD_SHARED="-build-shared";
347 shift
349 --with-romio)
350 WITH_ROMIO="true"; shift
352 --with-production)
353 WITH_PRODUCTION="true"
354 shift
356 --with-*)
357 CONFIG_OPTS="$CONFIG_OPTS $1"
358 shift
360 --without-*)
361 CONFIG_OPTS="$CONFIG_OPTS $1"
362 shift
364 --destination)
365 shift
366 DESTINATION="$1"
367 shift
369 --destination=*)
370 DESTINATION="`echo $1 | awk -F= '{print $2}'`"
371 shift
373 --suffix)
374 shift
375 DESTINATION_SUFFIX="$1"
376 shift
378 --suffix=*)
379 DESTINATION_SUFFIX="`echo $1 | awk -F= '{print $2}'`"
380 shift
382 --tau-makefile)
383 TAU_MAKEFILE=$1
384 shift
386 --tau-makefile=*)
387 TAU_MAKEFILE=`echo $1 | awk -F= '{print $2}'`
388 shift
390 --quiet)
391 MAKEOPTS="$MAKEOPTS --quiet"
392 QUIET="--quiet"
393 shift;
395 --enable-tracing|--enable-tracing=*)
396 CONFIG_OPTS="$CONFIG_OPTS $1"
397 ENABLE_TRACING=yes
398 shift
400 --enable-*)
401 CONFIG_OPTS="$CONFIG_OPTS $1"
402 shift
404 --disable-*)
405 CONFIG_OPTS="$CONFIG_OPTS $1"
406 shift
408 -j*)
409 PMAKENUM=`echo $1 | awk -Fj '{print $2}'`
410 MAKEOPTS="$MAKEOPTS -j $PMAKENUM"
411 shift;
413 -*)
414 # We hit a real compiler option (like -g, or -Dfoo),
415 # so just copy over all remaining options
416 while [ ! $# -eq 0 ]
418 OPTS="$OPTS $1"; shift
419 done
421 "help")
422 printOption
425 # This has to be a build-time option (like "smp", "gcc3", or "kcc")
426 TestIfCompiler $1
427 if [ $? -eq 1 ]
428 then
429 # It specifies a compiler:
430 if [ ! -z "$COMPILER" ]
431 then
432 echo "Error> Tried to specify two compilers: $COMPILER and $1"
433 printOption
435 COMPILER=$1
436 else
437 # It specifies some other option:
438 TestIfOption $1
439 BOPTS="$BOPTS $1"
440 [ $1 = "bigemulator" ] && BUILD_EMULATOR=1
441 [ $1 = "bigsim" ] && BUILD_EMULATOR=1
442 [ $1 = "cuda" ] && BUILD_CUDA=1
444 shift
446 esac
447 done
449 if [ $BUILD_CUDA -eq 1 ]; then
450 echo "checking for CUDA toolkit directory"
451 CUDA_CANDIDATE_DIRS="$CUDATOOLKIT_HOME /usr/local/cuda /usr/lib/nvidia-cuda-toolkit"
452 for dir in $CUDA_CANDIDATE_DIRS; do
453 if test -d "$dir"; then
454 CUDA_DIR="$dir"
455 HAVE_CUDA="yes"
456 echo "CUDA_DIR=$CUDA_DIR"
457 break
459 done
462 [ "x$VERSION" = "x" ] && syntax && exit 1
464 if test -n "$WITH_PRODUCTION" -a $BUILD_EMULATOR -eq 1 -a -z "$ENABLE_TRACING"
465 then
466 echo "Error: bigemulator requires tracing modules, --with-production must be used with --enable-tracing"
467 exit 1
470 if [ -z "$MAKE" ]
471 then
472 # prefer gmake
473 MAKE=`which gmake 2>/dev/null`
474 [ -z "$MAKE" -o ! -x "$MAKE" ] && MAKE='make'
477 if [ ! -f $src/$BASEVERSION/conv-mach.h ]
478 then
479 if [ "x_$BASEVERSION" = "x_net-rs6k" ]
480 then
481 echo "Error> build net-aix-ppc instead of net-rs6k!"
482 else
483 echo "Error> build can not find arch: $BASEVERSION!"
485 exit 1
488 #generate VERSION name combining all the build-time options.
489 if [ -n "$BOPTS" -o -n "$COMPILER" ]
490 then
491 echo "Selected Compiler: $COMPILER"
492 echo "Selected Options: $BOPTS"
493 SORTED=`echo $BOPTS | awk '{ for (i = 1; i <= NF; ++i) print $i }' | sort`
494 BOPTS_WITHCOMPILER=`echo $SORTED $COMPILER`
495 for i in $BOPTS_WITHCOMPILER
497 VERSION=$VERSION-$i
498 done
501 #echo "|$DESTINATION|$DESTINATION_SUFFIX|"
503 if [ -z "$DESTINATION" ]
504 then
505 DESTINATION="$VERSION"
508 if [ -n "$DESTINATION_SUFFIX" ]
509 then
510 DESTINATION="$DESTINATION-$DESTINATION_SUFFIX"
513 [ -d $DESTINATION ] || Echo "Creating dir: $DESTINATION"
514 [ -d $DESTINATION ] || mkdir $DESTINATION
515 [ -d $DESTINATION/tmp ] || Echo "Creating dir: $DESTINATION/tmp"
516 [ -d $DESTINATION/tmp ] || mkdir $DESTINATION/tmp
518 Echo "Copying src/scripts/Makefile to $DESTINATION/tmp"
519 rm -f $DESTINATION/tmp/Makefile
520 rm -f $DESTINATION/tmp/Make.depends
521 rm -f $DESTINATION/tmp/Make.cidepends
522 rm -f $DESTINATION/tmp/Make.lb
523 rm -f $DESTINATION/tmp/Make.machine
524 rm -f $DESTINATION/tmp/Make.extlib
527 # Create the bin, lib, include, etc. links:
528 WINNAME=`echo $VERSION | awk -F- '{print $2}'`
529 if [ "x_$WINNAME" = "x_win32" -o "x_$WINNAME" = "x_win64" ]
530 then
531 #Win32/64 version needs special compilers and *copied* (not linked)
532 # source files.
533 [ -d $DESTINATION/bin ] || Echo "Creating dir: $DESTINATION/bin"
534 [ -d $DESTINATION/bin ] || mkdir $DESTINATION/bin
535 echo "Copying compilers for $WINNAME into $DESTINATION/bin directory"
536 cp -f $src/$WINNAME/unix2nt* $DESTINATION/bin
537 cp $src/win32/system_ln $DESTINATION/tmp
538 cp $src/win32/unistd.h $DESTINATION/tmp
539 echo "Compiling createlink.cpp ..."
540 (cd $src/win32; ../../../$DESTINATION/bin/unix2nt_cc -c createlink.cpp -o createlink.o -D_WIN32_WINNT=0x0500; ../../../$DESTINATION/bin/unix2nt_cc createlink.o)
541 if test ! -x $src/win32/createlink.exe
542 then
543 echo "VC++ is not properly installed!"
544 exit 1
546 echo "Copying $src/win32/createlink.exe to $DESTINATION/bin directory"
547 cp $src/win32/createlink.exe $DESTINATION/bin
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 "../../src/scripts/Make.depends" $DESTINATION/tmp/Make.depends
571 $DESTINATION/tmp/system_ln "../../src/scripts/Make.cidepends" $DESTINATION/tmp/Make.cidepends
572 if test -f src/ck-ldb/Make.lb
573 then
574 $DESTINATION/tmp/system_ln "../../src/ck-ldb/Make.lb" $DESTINATION/tmp/Make.lb
575 else
576 touch $DESTINATION/tmp/Make.lb
578 $DESTINATION/tmp/system_ln "../../src/scripts/Makefile" $DESTINATION/tmp/Makefile
579 $DESTINATION/tmp/system_ln "../../src/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 for i in $BOPTS
618 echo '#include "'conv-mach-$i.h'"' >> $ConvHeader
619 if [ $BUILD_CUDA -eq 1 ]; then
620 echo 'CUDA_DIR="'$CUDA_DIR'"'>>$ConvSh
622 echo '. $CHARMINC/'"conv-mach-$i.sh" >> $ConvSh
623 done
626 if test "$BUILD_SHARED" = "-build-shared"
627 then
628 echo "CMK_NO_BUILD_SHARED=false" >> $ConvSh
629 else
630 echo "CMK_NO_BUILD_SHARED=true" >> $ConvSh
633 if test -n "$WITH_ROMIO"
634 then
635 echo "CMK_AMPI_WITH_ROMIO=\"true\"" >> $ConvSh
638 if test -n "$WITH_PRODUCTION"
639 then
640 echo '#define CMK_OPTIMIZE 1' >> $ConvHeader
641 # Prepend optimize so that an explicit -no-optimize still works
642 OPTS="-optimize -production $OPTS"
643 CONFIG_OPTS="--disable-controlpoint --disable-tracing --disable-tracing-commthread --disable-charmdebug --disable-replay --disable-error-checking --disable-stats $CONFIG_OPTS"
646 # build with Tau
647 WITH_TAU=0
648 if [ "$PROGRAM" = "Tau" ]
649 then
650 Echo "TAU>>>> makefile config option: $TAU_MAKEFILE"
651 if [ -n "$TAU_MAKEFILE" -a -f $TAU_MAKEFILE ]
652 then
653 #Setting up TAU trace library:
654 Echo "TAU>>>> configuring with this TAU makefile: $TAU_MAKEFILE"
656 WITH_TAU=1
657 else
658 Echo "TAU>>>> ERROR could not find Makefile: $TAU_MAKEFILE, ignored"
659 TAU_MAKEFILE=""
662 [ -z "$TAU_MAKEFILE" ] && TAU_MAKEFILE="Make.tau"
663 SED_CHARMC="s@TAU_MAKEFILE=\(.*\)@TAU_MAKEFILE=$TAU_MAKEFILE@"
665 sed -e $SED_CHARMC src/scripts/Makefile > .Makefile.$$ && cp .Makefile.$$ src/scripts/Makefile && rm -f .Makefile.$$
666 sed -e $SED_CHARMC src/scripts/charmc > .charmc.$$ && cp .charmc.$$ src/scripts/charmc && rm -f .charmc.$$
668 if test $WITH_TAU -eq 1
669 then
670 echo "#define CMK_WITH_TAU 1" >> $ConvHeader
671 echo "#define pthread_create tau_pthread_create" >> $ConvHeader
672 echo "#define pthread_exit tau_pthread_exit" >> $ConvHeader
674 echo "CMK_WITH_TAU=\"true\"" >> $ConvSh
677 if [ "$PROGRAM" = "ChaNGa" ]
678 then
679 #Setting lbuserdata when the build is ChaNGa
680 CONFIG_OPTS="--enable-lbuserdata $CONFIG_OPTS"
683 echo $BASEVERSION > $DESTINATION/tmp/.vdir
684 echo $BASEVERSION | sed -e 's@-.*@@' > $DESTINATION/tmp/.gdir
686 if test $BUILD_EMULATOR = 1
687 then
688 PROGRAM="$PROGRAM bigsim"
689 # CONFIG_OPTS="--disable-charmdebug $CONFIG_OPTS"
692 printError()
694 Echo "-------------------------------------------------"
695 Echo "Charm++ NOT BUILT. Either cd into $DESTINATION/tmp and try"
696 Echo "to resolve the problems yourself, visit"
697 Echo " http://charm.cs.illinois.edu/"
698 Echo "for more information. Otherwise, email the developers at charm@cs.illinois.edu"
699 exit $MAKEEXIT
702 echo 'BUILDOPTS="'$OPTS'"' >> $ConvSh
704 Echo "Performing '$MAKE $MAKEOPTS basics OPTS="$OPTS" QUIET="$QUIET" CONFIG_OPTS="$CONFIG_OPTS"' in $DESTINATION/tmp"
705 cd $DESTINATION/tmp
706 echo "CONFIG_OPTS=\"$CONFIG_OPTS\"" > config_opts.sh
707 chmod +x config_opts.sh
708 echo "OPTSATBUILDTIME += $OPTS" > buildopts.mk
709 $MAKE $MAKEOPTS basics OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
710 MAKEEXIT=$?
711 [ $MAKEEXIT -ne 0 ] && printError
713 Echo "Performing '$MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS" QUIET="$QUIET"' in $DESTINATION/tmp"
714 $MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS $BUILD_SHARED" QUIET="$QUIET"
715 MAKEEXIT=$?
716 if [ $MAKEEXIT -eq 0 ]
717 then
718 Echo "-------------------------------------------------"
719 Echo "$PROGRAM built successfully."
720 Echo "Next, try out a sample program like" \
721 "$DESTINATION/tests/charm++/simplearrayhello"
722 else
723 printError