210 |
|
|
211 |
# Explain usage |
# Explain usage |
212 |
usage() { |
usage() { |
213 |
echo "" |
echo |
214 |
echo "Usage: "$0" [OPTIONS]" |
echo "Usage: "$0" [OPTIONS]" |
215 |
echo " where [OPTIONS] can be:"$'\n' |
echo " where [OPTIONS] can be:" |
216 |
|
echo |
217 |
echo " -help | --help | -h | --h" |
echo " -help | --help | -h | --h" |
218 |
echo " -nooptfile | --nooptfile" |
echo " -nooptfile | --nooptfile" |
219 |
echo " -optfile NAME | --optfile NAME | -of NAME | --of NAME" |
echo " -optfile NAME | --optfile NAME | -of NAME | --of NAME" |
242 |
echo " -fc=NAME | --fc=NAME" |
echo " -fc=NAME | --fc=NAME" |
243 |
echo " -[no]ieee | --[no]ieee" |
echo " -[no]ieee | --[no]ieee" |
244 |
echo " -[no]mpi | --[no]mpi" |
echo " -[no]mpi | --[no]mpi" |
245 |
echo " -[no]jam | --[no]jam"$'\n' |
echo " -[no]jam | --[no]jam" |
246 |
echo " and NAME is a string such as:"$'\n' |
echo |
247 |
|
echo " and NAME is a string such as:" |
248 |
|
echo |
249 |
echo " --enable pkg1 --enable 'pkg1 pkg2' --enable 'pkg1 pkg2 pkg3'" |
echo " --enable pkg1 --enable 'pkg1 pkg2' --enable 'pkg1 pkg2 pkg3'" |
250 |
echo " -mods=dir1 -mods='dir1' -mods='dir1 dir2 dir3'" |
echo " -mods=dir1 -mods='dir1' -mods='dir1 dir2 dir3'" |
251 |
echo " -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'"$'\n' |
echo " -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'" |
252 |
|
echo |
253 |
echo " which, depending upon your shell, may need to be single-quoted" |
echo " which, depending upon your shell, may need to be single-quoted" |
254 |
echo " if it contains spaces, dashes, or other special characters." |
echo " if it contains spaces, dashes, or other special characters." |
255 |
exit 1 |
exit 1 |
302 |
PDEPEND= |
PDEPEND= |
303 |
PDEFAULT= |
PDEFAULT= |
304 |
OPTFILE= |
OPTFILE= |
305 |
INCLUDES=-I. |
INCLUDES="-I." |
306 |
FFLAGS= |
FFLAGS= |
307 |
FOPTIM= |
FOPTIM= |
308 |
CFLAGS= |
CFLAGS= |
325 |
THISDATE=`date` |
THISDATE=`date` |
326 |
MACHINE=`uname -a` |
MACHINE=`uname -a` |
327 |
|
|
328 |
echo $'\n'"=== Processing options files and arguments ===" |
echo |
329 |
|
echo "=== Processing options files and arguments ===" |
330 |
gm_local="./gm_local" |
gm_local="./gm_local" |
331 |
echo -n " getting local config information: " |
echo -n " getting local config information: " |
332 |
if test -e $gm_local ; then |
if test -e $gm_local ; then |
333 |
echo "using $gm_local" |
echo "using $gm_local" |
334 |
source $gm_local |
source $gm_local |
335 |
echo "DISABLE=$DISABLE"$'\n'"ENABLE=$ENABLE" |
# echo "DISABLE=$DISABLE" |
336 |
|
# echo "ENABLE=$ENABLE" |
337 |
else |
else |
338 |
echo "none found" |
echo "none found" |
339 |
fi |
fi |
340 |
|
|
341 |
# echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
# echo "$0::$1:$2:$3:$4:$5:$6:$7:" |
342 |
OPTIONS=() |
#OPTIONS= |
343 |
n=0 |
#n=0 |
344 |
for i ; do |
#for i ; do |
345 |
setvar="OPTIONS[$n]='$i'" |
# echo "$i $n" |
346 |
# echo " $setvar" |
# setvar="OPTIONS[$n]='$i'" |
347 |
eval "$setvar" |
# # echo " $setvar" |
348 |
n=$(( $n + 1 )) |
# eval "$setvar" |
349 |
|
# n=$(( $n + 1 )) |
350 |
|
#done |
351 |
|
#parse_options |
352 |
|
|
353 |
|
ac_prev= |
354 |
|
for ac_option ; do |
355 |
|
|
356 |
|
# If the previous option needs an argument, assign it. |
357 |
|
if test -n "$ac_prev"; then |
358 |
|
eval "$ac_prev=\$ac_option" |
359 |
|
ac_prev= |
360 |
|
continue |
361 |
|
fi |
362 |
|
|
363 |
|
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` |
364 |
|
|
365 |
|
case $ac_option in |
366 |
|
|
367 |
|
-help | --help | -h | --h) |
368 |
|
usage ;; |
369 |
|
|
370 |
|
-nooptfile | --nooptfile) |
371 |
|
OPTFILE="NONE" ;; |
372 |
|
-optfile | --optfile | -of | --of) |
373 |
|
ac_prev=optfile ;; |
374 |
|
-optfile=* | --optfile=* | -of=* | --of=*) |
375 |
|
OPTFILE=$ac_optarg ;; |
376 |
|
|
377 |
|
-pdepend | --pdepend) |
378 |
|
ac_prev=pdepend ;; |
379 |
|
-pdepend=* | --pdepend=*) |
380 |
|
PDEPEND=$ac_optarg ;; |
381 |
|
|
382 |
|
-pdefault | --pdefault) |
383 |
|
ac_prev=pdefault ;; |
384 |
|
-pdefault=* | --pdefault=*) |
385 |
|
PDEFAULT=$ac_optarg ;; |
386 |
|
|
387 |
|
-makefile | -ma) |
388 |
|
ac_prev=makefile ;; |
389 |
|
--makefile=* | -ma=*) |
390 |
|
MAKEFILE=$ac_optarg ;; |
391 |
|
|
392 |
|
-platform | --platform | -pl | --pl) |
393 |
|
ac_prev=platform ;; |
394 |
|
-platform=* | --platform=* | -pl=* | --pl=*) |
395 |
|
PLATFORM=$ac_optarg ;; |
396 |
|
|
397 |
|
-rootdir | --rootdir | -rd | --rd) |
398 |
|
ac_prev=rootdir ;; |
399 |
|
-rootdir=* | --rootdir=* | -rd=* | --rd=*) |
400 |
|
ROOTDIR=$ac_optarg ;; |
401 |
|
|
402 |
|
-mods | --mods | -mo | --mo) |
403 |
|
ac_prev=mods ;; |
404 |
|
-mods=* | --mods=* | -mo=* | --mo=*) |
405 |
|
MODS=$ac_optarg ;; |
406 |
|
|
407 |
|
-disable | --disable) |
408 |
|
ac_prev=disable ;; |
409 |
|
-disable=* | --disable=*) |
410 |
|
DISABLE=$ac_optarg ;; |
411 |
|
|
412 |
|
-enable | --enable) |
413 |
|
ac_prev=enable ;; |
414 |
|
-enable=* | --enable=*) |
415 |
|
ENABLE=$ac_optarg ;; |
416 |
|
|
417 |
|
-noopt | --noopt) |
418 |
|
ac_prev=noopt ;; |
419 |
|
-noopt=* | --noopt=*) |
420 |
|
NOOPT=$ac_optarg ;; |
421 |
|
|
422 |
|
# -cpp | --cpp) |
423 |
|
# ac_prev=cpp ;; |
424 |
|
# -cpp=* | --cpp=*) |
425 |
|
# CPP=$ac_optarg ;; |
426 |
|
|
427 |
|
-fortran | --fortran | -fc | --fc) |
428 |
|
ac_prev=fc ;; |
429 |
|
-fc=* | --fc=*) |
430 |
|
FC=$ac_optarg ;; |
431 |
|
|
432 |
|
-ieee | --ieee) |
433 |
|
IEEE=1 ;; |
434 |
|
-noieee | --noieee) |
435 |
|
IEEE=0 ;; |
436 |
|
|
437 |
|
-mpi | --mpi) |
438 |
|
MPI=1 ;; |
439 |
|
-nompi | --nompi) |
440 |
|
MPI=0 ;; |
441 |
|
|
442 |
|
-jam | --jam) |
443 |
|
JAM=1 ;; |
444 |
|
-nojam | --nojam) |
445 |
|
JAM=0 ;; |
446 |
|
|
447 |
|
-*) |
448 |
|
echo "Error: unrecognized option: "$ac_option |
449 |
|
usage |
450 |
|
;; |
451 |
|
|
452 |
|
*) |
453 |
|
echo "Error: unrecognized argument: "$ac_option |
454 |
|
usage |
455 |
|
;; |
456 |
|
|
457 |
|
esac |
458 |
|
|
459 |
done |
done |
|
parse_options |
|
460 |
|
|
461 |
echo " getting OPTFILE information: " |
echo " getting OPTFILE information: " |
462 |
if test "x${OPTFILE}" = x ; then |
if test "x${OPTFILE}" = x ; then |
463 |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
echo "Warning: no OPTFILE specified so we'll look for possible settings" |
464 |
echo $'\n'"=== Searching for possible settings for OPTFILE ===" |
printf "\n=== Searching for possible settings for OPTFILE ===\n" |
465 |
find_possible_configs |
find_possible_configs |
466 |
else |
else |
467 |
if test "x$OPTFILE" = xNONE ; then |
if test "x$OPTFILE" = xNONE ; then |
483 |
fi |
fi |
484 |
fi |
fi |
485 |
|
|
486 |
echo $'\n'"=== Setting defaults ===" |
printf "\n=== Setting defaults ===\n" |
487 |
echo -n " Adding MODS directories: " |
echo -n " Adding MODS directories: " |
488 |
for d in $MODS ; do |
for d in $MODS ; do |
489 |
if test ! -d $d ; then |
if test ! -d $d ; then |
490 |
echo $'\n\n'"Error: MODS directory \"$d\" not found!" |
echo |
491 |
|
echo "Error: MODS directory \"$d\" not found!" |
492 |
exit 1 |
exit 1 |
493 |
else |
else |
494 |
echo -n " $d" |
echo -n " $d" |
559 |
echo " Making source files in eesupp from templates" |
echo " Making source files in eesupp from templates" |
560 |
$MAKE -C $ROOTDIR"/eesupp/src/" > make_eesupp.errors 2>&1 |
$MAKE -C $ROOTDIR"/eesupp/src/" > make_eesupp.errors 2>&1 |
561 |
RETVAL=$? |
RETVAL=$? |
562 |
if test "x${RETVAL}" == "x0" ; then |
if test "x${RETVAL}" = x0 ; then |
563 |
rm -f make_eesupp.errors |
rm -f make_eesupp.errors |
564 |
else |
else |
565 |
echo "Error: problem encountered while building source files in eesupp:" |
echo "Error: problem encountered while building source files in eesupp:" |
568 |
fi |
fi |
569 |
fi |
fi |
570 |
|
|
571 |
echo $'\n'"=== Determining package settings ===" |
printf "\n=== Determining package settings ===\n" |
572 |
if test "x${PDEPEND}" = x ; then |
if test "x${PDEPEND}" = x ; then |
573 |
tmp=$ROOTDIR"/pkg/pkg_depend" |
tmp=$ROOTDIR"/pkg/pkg_depend" |
574 |
if test -r $tmp ; then |
if test -r $tmp ; then |
587 |
# Strip the comments and then convert the dependency file into |
# Strip the comments and then convert the dependency file into |
588 |
# two arrays: PNAME, DNAME |
# two arrays: PNAME, DNAME |
589 |
cat $PDEPEND | sed -e 's/#.*$//g' \ |
cat $PDEPEND | sed -e 's/#.*$//g' \ |
590 |
| awk 'BEGIN{nn=-1;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME["nn"]="$1"\nDNAME["nn"]="$i} }' \ |
| awk 'BEGIN{nn=-1;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME_"nn"="$1"\nDNAME_"nn"="$i}} END{print "nname="nn}' \ |
591 |
> ./.pd_tmp |
> ./.pd_tmp |
592 |
RETVAL=$? |
RETVAL=$? |
593 |
if test ! "x${RETVAL}" = x0 ; then |
if test ! "x${RETVAL}" = x0 ; then |
660 |
ck= |
ck= |
661 |
while test "x$ck" != xtt ; do |
while test "x$ck" != xtt ; do |
662 |
i=0 |
i=0 |
663 |
rtot=${#PNAME[@]} |
# rtot=${#PNAME[@]} |
664 |
|
rtot=$nname |
665 |
while test $i -lt $rtot ; do |
while test $i -lt $rtot ; do |
666 |
|
|
667 |
# Is $pname in the current $PACKAGES list? |
# Is $pname in the current $PACKAGES list? |
668 |
pname=${PNAME[$i]} |
# pname=${PNAME[$i]} |
669 |
|
tmp="pname=\"\$PNAME_$i\"" |
670 |
|
eval $tmp |
671 |
pin="f" |
pin="f" |
672 |
for p in $PACKAGES ; do |
for p in $PACKAGES ; do |
673 |
if test "x$p" = "x$pname" ; then |
if test "x$p" = "x$pname" ; then |
676 |
done |
done |
677 |
|
|
678 |
# Is the DNAME entry a (+) or (-) rule ? |
# Is the DNAME entry a (+) or (-) rule ? |
679 |
|
tmp="dname=\"\$DNAME_$i\"" |
680 |
|
eval $tmp |
681 |
plus="-" |
plus="-" |
682 |
echo "${DNAME[$i]}" | grep '^+' > /dev/null 2>&1 |
echo $dname | grep '^+' > /dev/null 2>&1 |
683 |
RETVAL=$? |
RETVAL=$? |
684 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
685 |
plus="+" |
plus="+" |
686 |
fi |
fi |
687 |
|
|
688 |
# Is $dname in the current $PACKAGES list? |
# Is $dname in the current $PACKAGES list? |
689 |
dname=`echo ${DNAME[$i]} | sed -e 's/^[+-]//'` |
dname=`echo $dname | sed -e 's/^[+-]//'` |
690 |
din="f" |
din="f" |
691 |
for p in $PACKAGES ; do |
for p in $PACKAGES ; do |
692 |
if test "x$p" = "x$dname" ; then |
if test "x$p" = "x$dname" ; then |
872 |
done |
done |
873 |
|
|
874 |
|
|
875 |
echo $'\n'"=== Creating the Makefile ===" |
echo |
876 |
|
echo "=== Creating the Makefile ===" |
877 |
echo " setting INCLUDES" |
echo " setting INCLUDES" |
878 |
for i in $INCLUDEDIRS ; do |
for i in $INCLUDEDIRS ; do |
879 |
if test -d $i ; then |
if test -d $i ; then |
919 |
fi |
fi |
920 |
done |
done |
921 |
if test "x$deplist" != x ; then |
if test "x$deplist" != x ; then |
922 |
echo $'\n'"# These files are linked from $d" >> srclinks.tmp |
echo "" >> srclinks.tmp |
923 |
|
echo "# These files are linked from $d" >> srclinks.tmp |
924 |
echo "$deplist :" >> srclinks.tmp |
echo "$deplist :" >> srclinks.tmp |
925 |
echo $'\t$(LN) '$d'/$@ $@' >> srclinks.tmp |
printf "\t\$(LN) %s/\$@ \$@\n" $d >> srclinks.tmp |
926 |
fi |
fi |
927 |
done |
done |
928 |
rm -rf .links.tmp |
rm -rf .links.tmp |
1088 |
echo "Error: unable to add file \"$i\" to the exceptions list" |
echo "Error: unable to add file \"$i\" to the exceptions list" |
1089 |
fi |
fi |
1090 |
echo "$base.o: $base.f" >> $MAKEFILE |
echo "$base.o: $base.f" >> $MAKEFILE |
1091 |
echo $'\t$(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> $MAKEFILE |
printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE |
1092 |
done |
done |
1093 |
|
|
1094 |
echo " Add rules for links" |
echo " Add rules for links" |
1096 |
rm -f srclinks.tmp |
rm -f srclinks.tmp |
1097 |
|
|
1098 |
echo " Adding makedepend marker" |
echo " Adding makedepend marker" |
1099 |
echo $'\n\n'"# DO NOT DELETE" >> $MAKEFILE |
printf "\n\n# DO NOT DELETE\n" >> $MAKEFILE |
1100 |
|
|
1101 |
echo $'\n'"=== Done ===" |
printf "\n=== Done ===\n" |