1 |
#!/bin/bash |
#!/bin/bash |
2 |
# |
# |
3 |
# $Header$ |
# $Header$ |
4 |
|
# $Name$ |
5 |
# |
# |
6 |
|
|
7 |
usage() |
usage() |
12 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
13 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
14 |
echo " (-mpi) use MPI input files" |
echo " (-mpi) use MPI input files" |
15 |
|
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
16 |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
17 |
echo " (-a|-addr)STRING list of email recipients" |
echo " (-a|-addr)STRING list of email recipients" |
18 |
echo " (DEF=\"edhill@mitgcm.org\")" |
echo " (DEF=\"edhill@mitgcm.org\")" |
20 |
echo " (DEF=\"\" which builds all)" |
echo " (DEF=\"\" which builds all)" |
21 |
echo " (-b|-bash)STRING location of \"bash\" executable" |
echo " (-b|-bash)STRING location of \"bash\" executable" |
22 |
echo " (DEF=\"\" for \"/bin/bash\")" |
echo " (DEF=\"\" for \"/bin/bash\")" |
23 |
echo " (-c|-command)STRING command to run" |
echo " (-command)STRING command to run" |
24 |
echo " (DEF=\"make output.txt\")" |
echo " (DEF=\"make output.txt\")" |
25 |
echo " (-m|-make)STRING command to use for \"make\"" |
echo " (-m|-make)STRING command to use for \"make\"" |
26 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
27 |
|
echo " (-clean) *ONLY* run \"make CLEAN\"" |
28 |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
29 |
echo " (-nogenmake|-ng) skip the genmake stage" |
echo " (-nogenmake|-ng) skip the genmake stage" |
30 |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
187 |
GENMAKE2="$BASH ../../../tools/genmake2" |
GENMAKE2="$BASH ../../../tools/genmake2" |
188 |
( |
( |
189 |
cd $1; |
cd $1; |
|
printf 'genmake ... ' 1>&2 |
|
190 |
command="$GENMAKE2 -ds -m $MAKE --mods=../code" |
command="$GENMAKE2 -ds -m $MAKE --mods=../code" |
191 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
192 |
command="$command --optfile=$OPTFILE" |
command="$command --optfile=$OPTFILE" |
193 |
# echo " command=\"$command\"" |
# echo " command=\"$command\"" |
194 |
fi |
fi |
195 |
|
if test "x$IEEE" != x ; then |
196 |
|
command="$command -ieee" |
197 |
|
fi |
198 |
|
# echo "command: \"$command\"" |
199 |
|
printf 'genmake ... ' 1>&2 |
200 |
$command > make.log 2>&1 |
$command > make.log 2>&1 |
201 |
RETVAL=$? |
RETVAL=$? |
202 |
for i in gm_state gm_optfile gm_local Makefile ; do |
for i in genmake_state genmake_optfile genmake_local Makefile ; do |
203 |
if test -r $i ; then |
if test -r $i ; then |
204 |
cp $i $CDIR |
cp $i $CDIR |
205 |
fi |
fi |
394 |
-debug Produce even more output which will mean nothing to most |
-debug Produce even more output which will mean nothing to most |
395 |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
396 |
-clean Do "make CLEAN" after compiling and testing. |
-clean Do "make CLEAN" after compiling and testing. |
|
-noieee By default, $0 uses the -ieee option for genmake. This turns it off. |
|
397 |
-cleanup Aggresively removes all model output, executables and object files |
-cleanup Aggresively removes all model output, executables and object files |
398 |
and then exits. Use with care. |
and then exits. Use with care. |
399 |
|
|
426 |
expts='' |
expts='' |
427 |
# ieee=1 |
# ieee=1 |
428 |
|
|
429 |
|
IEEE= |
430 |
|
if test "x$MITGCM_IEEE" != x ; then |
431 |
|
IEEE=$MITGCM_IEEE |
432 |
|
fi |
433 |
|
|
434 |
|
|
435 |
CLEANUP=f |
CLEANUP=f |
436 |
QUICK=f |
QUICK=f |
437 |
NOGENMAKE=f |
NOGENMAKE=f |
509 |
-nodepend | --nodepend | -nd | --nd) |
-nodepend | --nodepend | -nd | --nd) |
510 |
NODEPEND=t ;; |
NODEPEND=t ;; |
511 |
|
|
512 |
-mpi) MPI=t ;; |
-mpi) MPI=true ;; |
513 |
|
|
514 |
|
-ieee) IEEE=true ;; |
515 |
|
-noieee) IEEE= ;; |
516 |
|
|
517 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
518 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
|
-clean) clean=1 ;; |
|
519 |
-quiet) verbose=0 ;; |
-quiet) verbose=0 ;; |
520 |
|
|
521 |
-*) |
-*) |
584 |
|
|
585 |
NDIR=0 |
NDIR=0 |
586 |
|
|
587 |
|
of_path= |
588 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
589 |
if test -r $OPTFILE ; then |
if test -r $OPTFILE ; then |
590 |
OPTFILE=`pwd`"/$OPTFILE" |
# get the path |
591 |
|
path=${OPTFILE%/*} |
592 |
|
if test "x$path" = x ; then |
593 |
|
of_path=`pwd` |
594 |
|
else |
595 |
|
of_path=`( cd $path > /dev/null 2>&1 ; pwd )` |
596 |
|
fi |
597 |
|
file=${OPTFILE##*/} |
598 |
|
OPTFILE=$of_path/$file |
599 |
|
else |
600 |
|
echo |
601 |
|
echo "WARNING: can't read OPTFILE=\"$OPTFILE\" but will try to use it..." |
602 |
fi |
fi |
603 |
fi |
fi |
604 |
echo |
echo |
622 |
# Verify that the testdir exists and contains previous |
# Verify that the testdir exists and contains previous |
623 |
# results in the correct location--or skip this directory! |
# results in the correct location--or skip this directory! |
624 |
if test ! -r $dir"/results/output.txt" ; then |
if test ! -r $dir"/results/output.txt" ; then |
|
echo |
|
625 |
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" |
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" |
|
echo |
|
626 |
continue |
continue |
627 |
fi |
fi |
628 |
|
|
652 |
# Is this an MPI run? |
# Is this an MPI run? |
653 |
if test "x$MPI" = xt ; then |
if test "x$MPI" = xt ; then |
654 |
FILES=$MPI_FILES |
FILES=$MPI_FILES |
655 |
|
endings="_mpi" |
656 |
else |
else |
657 |
FILES=$NOMPI_FILES |
FILES=$NOMPI_FILES |
658 |
|
endings="_nompi" |
659 |
fi |
fi |
660 |
|
|
661 |
# Check to see that we have the files |
# Check to see that we have the files |
674 |
# If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR |
# If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR |
675 |
if test "x$have_files" = xt ; then |
if test "x$have_files" = xt ; then |
676 |
for i in $FILES ; do |
for i in $FILES ; do |
677 |
cmp $CODE_DIR/$i $BUILD_DIR/$i > /dev/null 2>&1 |
sstr="s|$endings||" |
678 |
|
name=`echo $i | sed -e $sstr ` |
679 |
|
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
680 |
RETVAL=$? |
RETVAL=$? |
681 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
682 |
cp $CODE_DIR/$i $BUILD_DIR/$i |
cp $CODE_DIR/$i $BUILD_DIR/$name |
683 |
fi |
fi |
684 |
done |
done |
685 |
fi |
fi |