248 |
fi |
fi |
249 |
} |
} |
250 |
|
|
251 |
|
|
252 |
|
build_embed_encode() |
253 |
|
{ |
254 |
|
printf " building the embed-encode utility... " |
255 |
|
if test ! -e "$ROOTDIR/tools/embed_encode/encode_files" ; then |
256 |
|
if test ! -d "$ROOTDIR/tools/embed_encode" ; then |
257 |
|
echo |
258 |
|
echo " Error: can't locate \"$ROOTDIR/tools/embed_encode\"" |
259 |
|
echo |
260 |
|
EMBED_SRC=f |
261 |
|
return 1 |
262 |
|
fi |
263 |
|
clist="cc gcc c89 $CC" |
264 |
|
for ic in $clist ; do |
265 |
|
comm="$ic -o encode_files encode_files.c" |
266 |
|
( cd $ROOTDIR/tools/embed_encode && $comm ) > /dev/null 2>&1 |
267 |
|
RETVAL=$? |
268 |
|
if test "x$RETVAL" = x0 ; then |
269 |
|
echo "OK" |
270 |
|
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
271 |
|
return 0 |
272 |
|
fi |
273 |
|
done |
274 |
|
echo |
275 |
|
echo " Error: unable to build $ROOTDIR/embed_encode/encode_files" |
276 |
|
echo " so it has been disabled" |
277 |
|
echo |
278 |
|
EMBED_SRC=f |
279 |
|
return 1 |
280 |
|
fi |
281 |
|
echo "OK" |
282 |
|
DEFINES="$DEFINES -DHAVE_EMBED_SRC" |
283 |
|
} |
284 |
|
|
285 |
|
|
286 |
# Guess possible config options for this host |
# Guess possible config options for this host |
287 |
find_possible_configs() { |
find_possible_configs() { |
288 |
|
|
388 |
else |
else |
389 |
echo " The possible FORTRAN compilers found in your path are:" |
echo " The possible FORTRAN compilers found in your path are:" |
390 |
echo " "$p_FC |
echo " "$p_FC |
391 |
if test "x$FC" = x ; then |
fi |
392 |
FC=`echo $p_FC | $AWK '{print $1}'` |
|
393 |
echo " Setting FORTRAN compiler to: "$FC |
# Use the first of the compilers found in the current PATH |
394 |
fi |
# that has a correctly-named optfile |
395 |
|
if test "x$OPTFILE" = x -a "x$FC" = x ; then |
396 |
|
for i in $p_FC ; do |
397 |
|
OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i |
398 |
|
if test -r $OPTFILE ; then |
399 |
|
echo " Setting OPTFILE to: "$OPTFILE |
400 |
|
break |
401 |
|
fi |
402 |
|
done |
403 |
fi |
fi |
404 |
|
|
405 |
if test "x$OPTFILE" = x ; then |
if test "x$OPTFILE" = x ; then |
572 |
|
|
573 |
-ts | --ts |
-ts | --ts |
574 |
Produce timing information per timestep |
Produce timing information per timestep |
575 |
|
-papis | --papis |
576 |
|
Produce summary MFlop/s with PAPI per timestep |
577 |
|
-foolad | --foolad |
578 |
|
Fool the AD code generator |
579 |
|
-papi | --papi |
580 |
|
Performance analysis with PAPI |
581 |
|
-hpmt | --hpmt |
582 |
|
Performance analysis with the HPM Toolkit |
583 |
|
|
584 |
|
-gsl | --gsl |
585 |
|
Use GSL to control floating point rounding and precision |
586 |
|
|
587 |
-mpi | --mpi |
-mpi | --mpi |
588 |
Include MPI header files and link to MPI libraries |
Include MPI header files and link to MPI libraries |
591 |
set to PATH. i.e. Include files from \$PATH/include, link to libraries |
set to PATH. i.e. Include files from \$PATH/include, link to libraries |
592 |
from \$PATH/lib and use binaries from \$PATH/bin. |
from \$PATH/lib and use binaries from \$PATH/bin. |
593 |
|
|
594 |
|
-es | --es | -embed-source | --embed-source |
595 |
|
Embed a tarball containing the full source code |
596 |
|
(including the Makefile, etc.) used to build the |
597 |
|
executable [off by default] |
598 |
|
|
599 |
-bash NAME |
-bash NAME |
600 |
Explicitly specify the Bourne or BASH shell to use |
Explicitly specify the Bourne or BASH shell to use |
601 |
|
|
660 |
call tsub( string ) |
call tsub( string ) |
661 |
end |
end |
662 |
EOF |
EOF |
663 |
$FC $FFLAGS $DEFINES -c genmake_tcomp.$FS >> genmake_warnings 2>&1 |
$FC $FFLAGS -c genmake_tcomp.$FS >> genmake_warnings 2>&1 |
664 |
RETVAL=$? |
RETVAL=$? |
665 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
666 |
FC_NAMEMANGLE=$default_nm |
FC_NAMEMANGLE=$default_nm |
748 |
} |
} |
749 |
|
|
750 |
|
|
751 |
|
check_HAVE_SIGREG() { |
752 |
|
get_fortran_c_namemangling |
753 |
|
cat <<EOF > genmake_tc_1.c |
754 |
|
$FC_NAMEMANGLE |
755 |
|
#include <stdlib.h> |
756 |
|
#include <stdio.h> |
757 |
|
#include <signal.h> |
758 |
|
#include <errno.h> |
759 |
|
#include <ucontext.h> |
760 |
|
|
761 |
|
int * ip; |
762 |
|
|
763 |
|
static void killhandler( |
764 |
|
unsigned int sn, siginfo_t si, struct ucontext *sc ) |
765 |
|
{ |
766 |
|
*ip = *ip + 1; |
767 |
|
return; |
768 |
|
} |
769 |
|
|
770 |
|
void FC_NAMEMANGLE(sigreg) (int * aip) |
771 |
|
{ |
772 |
|
struct sigaction s; |
773 |
|
ip = aip; |
774 |
|
s.sa_flags = SA_SIGINFO; |
775 |
|
s.sa_sigaction = (void *)killhandler; |
776 |
|
if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) { |
777 |
|
printf("Sigaction returned error = %d\n", errno); |
778 |
|
exit(0); |
779 |
|
} |
780 |
|
return; |
781 |
|
} |
782 |
|
EOF |
783 |
|
make genmake_tc_1.o >> genmake_warnings 2>&1 |
784 |
|
RET_C=$? |
785 |
|
cat <<EOF > genmake_tc_2.$FS |
786 |
|
program hello |
787 |
|
integer anint |
788 |
|
common /iv/ anint |
789 |
|
external sigreg |
790 |
|
call sigreg(anint) |
791 |
|
end |
792 |
|
EOF |
793 |
|
echo >> genmake_warnings |
794 |
|
echo "running: check_HAVE_SIGREG()" >> genmake_warnings |
795 |
|
cat genmake_tc_2.$FS >> genmake_warnings |
796 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
797 |
|
echo $COMM >> genmake_warnings |
798 |
|
$COMM >> genmake_warnings 2>&1 |
799 |
|
RETVAL=$? |
800 |
|
if test "x$RETVAL" = x0 ; then |
801 |
|
HAVE_SIGREG=t |
802 |
|
DEFINES="$DEFINES -DHAVE_SIGREG" |
803 |
|
fi |
804 |
|
rm -f genmake_tc* |
805 |
|
} |
806 |
|
|
807 |
|
|
808 |
check_HAVE_SETRLSTK() { |
check_HAVE_SETRLSTK() { |
809 |
get_fortran_c_namemangling |
get_fortran_c_namemangling |
810 |
cat <<EOF > genmake_tc_1.c |
cat <<EOF > genmake_tc_1.c |
829 |
call setrlstk() |
call setrlstk() |
830 |
end |
end |
831 |
EOF |
EOF |
832 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
echo >> genmake_warnings |
833 |
RET_F=$? |
echo "running: check_HAVE_SETRLSTK()" >> genmake_warnings |
834 |
test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 |
cat genmake_tc_2.$FS >> genmake_warnings |
835 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
836 |
|
echo $COMM >> genmake_warnings |
837 |
|
$COMM >> genmake_warnings 2>&1 |
838 |
RETVAL=$? |
RETVAL=$? |
839 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
840 |
HAVE_SETRLSTK=t |
HAVE_SETRLSTK=t |
874 |
print *," HELLO WORLD", nbyte |
print *," HELLO WORLD", nbyte |
875 |
end |
end |
876 |
EOF |
EOF |
877 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 |
echo >> genmake_warnings |
878 |
RET_F=$? |
echo "running: check_HAVE_STAT()" >> genmake_warnings |
879 |
test -x ./genmake_tc && ./genmake_tc >> genmake_tc.log 2>&1 |
cat genmake_tc_2.$FS >> genmake_warnings |
880 |
|
COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" |
881 |
|
echo $COMM >> genmake_warnings |
882 |
|
$COMM >> genmake_tc.log 2>&1 |
883 |
RETVAL=$? |
RETVAL=$? |
884 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
885 |
HAVE_STAT=t |
HAVE_STAT=t |
893 |
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
if test ! "x$SKIP_NETCDF_CHECK" = x ; then |
894 |
return |
return |
895 |
fi |
fi |
896 |
echo "" > genmake_tnc.log |
echo >> genmake_warnings |
897 |
|
echo "running: check_netcdf_libs()" >> genmake_warnings |
898 |
cat <<EOF > genmake_tnc.F |
cat <<EOF > genmake_tnc.F |
899 |
program fgennc |
program fgennc |
900 |
#include "netcdf.inc" |
#include "netcdf.inc" |
912 |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret) |
913 |
end |
end |
914 |
EOF |
EOF |
915 |
echo "Executing:" > genmake_tnc.log |
echo "=== genmake_tnc.F ===" > genmake_tnc.log |
916 |
echo " $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS" \ |
cat genmake_tnc.F >> genmake_tnc.log |
917 |
> genmake_tnc.log |
echo "=== genmake_tnc.F ===" >> genmake_tnc.log |
918 |
RET_CPP=f |
RET_CPP=f |
919 |
$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ |
COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F" |
920 |
&& RET_CPP=t |
echo "$COMM" >> genmake_tnc.log |
921 |
|
$COMM > genmake_tnc.$FS 2>/dev/null && RET_CPP=t |
922 |
if test "x$RET_CPP" = xf ; then |
if test "x$RET_CPP" = xf ; then |
923 |
echo " WARNING: CPP failed to pre-process the netcdf test." \ |
echo " WARNING: CPP failed to pre-process the netcdf test." \ |
924 |
> genmake_tnc.log |
>> genmake_tnc.log |
925 |
echo " Please check that \$INCLUDES is properly set." \ |
echo " Please check that \$INCLUDES is properly set." \ |
926 |
> genmake_tnc.log |
>> genmake_tnc.log |
927 |
fi |
fi |
928 |
echo "Executing:" > genmake_tnc.log |
echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
929 |
echo " $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS" > genmake_tnc.log |
echo " && $LINK -o genmake_tnc.o $LIBS" >> genmake_tnc.log |
|
echo " $LINK -o genmake_tnc.o $LIBS" > genmake_tnc.log |
|
930 |
$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
931 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 |
932 |
RET_COMPILE=$? |
RET_COMPILE=$? |
933 |
|
cat genmake_tnc.log >> genmake_warnings |
934 |
|
|
935 |
#EH3 Remove test program execution for machines that either disallow |
#EH3 Remove test program execution for machines that either disallow |
936 |
#EH3 execution or cannot support it (eg. cross-compilers) |
#EH3 execution or cannot support it (eg. cross-compilers) |
943 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
944 |
else |
else |
945 |
# try again with "-lnetcdf" added to the libs |
# try again with "-lnetcdf" added to the libs |
946 |
|
echo "try again with added '-lnetcdf'" > genmake_tnc.log |
947 |
|
echo "$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS \ " >> genmake_tnc.log |
948 |
|
echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log |
949 |
|
echo " && $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log |
950 |
$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ |
$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ |
951 |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
&& $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ |
952 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
&& $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 |
953 |
RET_COMPILE=$? |
RET_COMPILE=$? |
954 |
|
cat genmake_tnc.log >> genmake_warnings |
955 |
if test "x$RET_COMPILE" = x0 ; then |
if test "x$RET_COMPILE" = x0 ; then |
956 |
LIBS="$LIBS -lnetcdf" |
LIBS="$LIBS -lnetcdf" |
957 |
HAVE_NETCDF=t |
HAVE_NETCDF=t |
|
else |
|
|
cat genmake_tnc.log >> genmake_warnings |
|
958 |
fi |
fi |
959 |
fi |
fi |
960 |
rm -f genmake_tnc* |
rm -f genmake_tnc* |
1001 |
MPI= |
MPI= |
1002 |
MPIPATH= |
MPIPATH= |
1003 |
TS= |
TS= |
1004 |
|
PAPIS= |
1005 |
|
FOOLAD= |
1006 |
|
PAPI= |
1007 |
|
HPMT= |
1008 |
|
GSL= |
1009 |
|
HAVE_TEST_L= |
1010 |
|
|
1011 |
# DEFINES checked by test compilation or command-line |
# DEFINES checked by test compilation or command-line |
1012 |
HAVE_SYSTEM= |
HAVE_SYSTEM= |
1030 |
PWD=`pwd` |
PWD=`pwd` |
1031 |
test "x$MAKE" = x && MAKE=make |
test "x$MAKE" = x && MAKE=make |
1032 |
test "x$AWK" = x && AWK=awk |
test "x$AWK" = x && AWK=awk |
1033 |
|
EMBED_SRC= |
1034 |
THISHOST=`hostname` |
THISHOST=`hostname` |
1035 |
THISCWD=`pwd` |
THISCWD=`pwd` |
1036 |
THISDATE=`date` |
THISDATE=`date` |
1064 |
|
|
1065 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
1066 |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
1067 |
gm_s2="FC CPP IEEE TS MPI JAM DUMPSTATE STANDARDDIRS" |
gm_s2="FC CPP IEEE TS PAPIS PAPI HPMT GSL MPI JAM DUMPSTATE STANDARDDIRS" |
1068 |
|
|
1069 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
1070 |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM " |
1246 |
|
|
1247 |
-ts | --ts) |
-ts | --ts) |
1248 |
TS=true ;; |
TS=true ;; |
1249 |
|
-papis | --papis) |
1250 |
|
PAPIS=true ;; |
1251 |
|
-foolad | --foolad) |
1252 |
|
FOOLAD=true ;; |
1253 |
|
-papi | --papi) |
1254 |
|
PAPI=true ;; |
1255 |
|
-hpmt | --hpmt) |
1256 |
|
HPMT=true ;; |
1257 |
|
|
1258 |
|
-gsl | --gsl) |
1259 |
|
GSL=true ;; |
1260 |
|
|
1261 |
-mpi | --mpi) |
-mpi | --mpi) |
1262 |
MPI=true ;; |
MPI=true ;; |
1285 |
-ignoretime | -ignore_time | --ignoretime | --ignore_time) |
-ignoretime | -ignore_time | --ignoretime | --ignore_time) |
1286 |
IGNORE_TIME="-DIGNORE_TIME" ;; |
IGNORE_TIME="-DIGNORE_TIME" ;; |
1287 |
|
|
1288 |
|
-es | --es | -embed-source | --embed-source) |
1289 |
|
EMBED_SRC=t ;; |
1290 |
|
|
1291 |
-*) |
-*) |
1292 |
echo "Error: unrecognized option: "$ac_option |
echo "Error: unrecognized option: "$ac_option |
1293 |
usage |
usage |
1486 |
EOF |
EOF |
1487 |
exit 1 |
exit 1 |
1488 |
fi |
fi |
1489 |
|
test -L genmake_tlink > /dev/null 2>&1 |
1490 |
|
RETVAL=$? |
1491 |
|
if test "x$RETVAL" = x0 ; then |
1492 |
|
HAVE_TEST_L=t |
1493 |
|
fi |
1494 |
rm -f genmake_test_ln genmake_tlink |
rm -f genmake_test_ln genmake_tlink |
1495 |
|
|
1496 |
# Check for broken *.F/*.f handling and fix if possible |
# Check for broken *.F/*.f handling and fix if possible |
1503 |
|
|
1504 |
if test ! "x$TS" = x ; then |
if test ! "x$TS" = x ; then |
1505 |
echo " Turning on timing per timestep" |
echo " Turning on timing per timestep" |
1506 |
DEFINES="$DEFINES -DTIME_PER_TIMESTEP" |
if test ! "x$FOOLAD" = x ; then |
1507 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP_SFP" |
1508 |
|
else |
1509 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP" |
1510 |
|
fi |
1511 |
|
fi |
1512 |
|
if test ! "x$PAPIS" = x ; then |
1513 |
|
echo " Turning on PAPI flop summary per timestep" |
1514 |
|
echo " Please make sure PAPIINC, PAPILIB are defined" |
1515 |
|
if test ! "x$FOOLAD" = x ; then |
1516 |
|
DEFINES="$DEFINES -DUSE_PAPI_FLOPS_SFP" |
1517 |
|
else |
1518 |
|
DEFINES="$DEFINES -DUSE_PAPI_FLOPS" |
1519 |
|
fi |
1520 |
|
INCLUDES="$INCLUDES $PAPIINC" |
1521 |
|
LIBS="$LIBS $PAPILIB" |
1522 |
|
fi |
1523 |
|
if test ! "x$PAPI" = x ; then |
1524 |
|
if test ! "x$PAPIS" = x ; then |
1525 |
|
echo " PAPI performance analysis and flop summary per timestep cannot co-exist!" |
1526 |
|
echo " Sticking with PAPI flop summary per timestep!" |
1527 |
|
else |
1528 |
|
echo " Turning on performance analysis with PAPI" |
1529 |
|
echo " Please make sure PAPIINC, PAPILIB are defined" |
1530 |
|
DEFINES="$DEFINES -DUSE_PAPI" |
1531 |
|
INCLUDES="$INCLUDES $PAPIINC" |
1532 |
|
LIBS="$LIBS $PAPILIB" |
1533 |
|
fi |
1534 |
|
fi |
1535 |
|
if test ! "x$HPMT" = x ; then |
1536 |
|
if test ! "x$PAPI" = x ; then |
1537 |
|
echo " PAPI and the HPM Toolkit cannot co-exist!" |
1538 |
|
echo " Sticking with PAPI!" |
1539 |
|
else |
1540 |
|
echo " Turning on performance analysis with the HPM Toolkit" |
1541 |
|
echo " Please make sure HPMTINC, HPMTLIB are defined" |
1542 |
|
DEFINES="$DEFINES -DUSE_LIBHPM" |
1543 |
|
INCLUDES="$INCLUDES $HPMTINC" |
1544 |
|
LIBS="$LIBS $HPMTLIB" |
1545 |
|
fi |
1546 |
|
fi |
1547 |
|
if test ! "x$GSL" = x ; then |
1548 |
|
echo " Turning on use of GSL to control floating point calculations" |
1549 |
|
echo " Please make sure GSLINC, GSLLIB are defined" |
1550 |
|
DEFINES="$DEFINES -DUSE_GSL_IEEE" |
1551 |
|
INCLUDES="$INCLUDES $GSLINC" |
1552 |
|
LIBS="$LIBS $GSLLIB" |
1553 |
fi |
fi |
1554 |
|
|
1555 |
printf "\n=== Checking system libraries ===\n" |
printf "\n=== Checking system libraries ===\n" |
1559 |
call system('echo hi') |
call system('echo hi') |
1560 |
end |
end |
1561 |
EOF |
EOF |
1562 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
$FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1563 |
RETVAL=$? |
RETVAL=$? |
1564 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1565 |
HAVE_SYSTEM=t |
HAVE_SYSTEM=t |
1580 |
print *, string |
print *, string |
1581 |
end |
end |
1582 |
EOF |
EOF |
1583 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
$FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1584 |
RETVAL=$? |
RETVAL=$? |
1585 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1586 |
HAVE_FDATE=t |
HAVE_FDATE=t |
1602 |
print *, tarray |
print *, tarray |
1603 |
end |
end |
1604 |
EOF |
EOF |
1605 |
$FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
$FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1 |
1606 |
RETVAL=$? |
RETVAL=$? |
1607 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
1608 |
HAVE_ETIME=t |
HAVE_ETIME=t |
1620 |
echo "yes" |
echo "yes" |
1621 |
else |
else |
1622 |
echo "no" |
echo "no" |
1623 |
|
if test "x$EMBED_SRC" = xt ; then |
1624 |
|
echo " WARNING: you requested file embedding but it has" |
1625 |
|
echo " been disabled since C code cannot be called" |
1626 |
|
EMBED_SRC= |
1627 |
|
fi |
1628 |
fi |
fi |
1629 |
rm -f genmake_t* |
rm -f genmake_t* |
1630 |
|
|
1637 |
fi |
fi |
1638 |
rm -f genmake_t* |
rm -f genmake_t* |
1639 |
|
|
1640 |
|
printf " Can we register a signal handler using $FC... " |
1641 |
|
check_HAVE_SIGREG |
1642 |
|
if test "x$HAVE_SIGREG" != x ; then |
1643 |
|
echo "yes" |
1644 |
|
else |
1645 |
|
echo "no" |
1646 |
|
fi |
1647 |
|
rm -f genmake_t* |
1648 |
|
|
1649 |
printf " Can we use stat() through C calls... " |
printf " Can we use stat() through C calls... " |
1650 |
check_HAVE_STAT |
check_HAVE_STAT |
1651 |
if test "x$HAVE_STAT" != x ; then |
if test "x$HAVE_STAT" != x ; then |
1664 |
fi |
fi |
1665 |
DEFINES="$DEFINES $IGNORE_TIME" |
DEFINES="$DEFINES $IGNORE_TIME" |
1666 |
|
|
1667 |
|
if test "x$EMBED_SRC" = xt ; then |
1668 |
|
build_embed_encode |
1669 |
|
fi |
1670 |
|
if test "x$EMBED_SRC" = xt ; then |
1671 |
|
ENABLE="$ENABLE embed_files" |
1672 |
|
fi |
1673 |
|
|
1674 |
|
|
1675 |
printf "\n=== Setting defaults ===\n" |
printf "\n=== Setting defaults ===\n" |
1676 |
printf " Adding MODS directories: " |
printf " Adding MODS directories: " |
1677 |
for d in $MODS ; do |
for d in $MODS ; do |
2123 |
fi |
fi |
2124 |
done |
done |
2125 |
|
|
2126 |
|
if test ! "x$DIVA" = x ; then |
2127 |
|
echo " Creating the pseudo-MPI include directory" |
2128 |
|
INCLUDES="-I./mpi_headers $INCLUDES" |
2129 |
|
rm -rf ./mpi_headers |
2130 |
|
mkdir -p ./mpi_headers |
2131 |
|
|
2132 |
|
if test "x$MPIINCLUDEDIR" = x ; then |
2133 |
|
if test "x$MPIHOME" = x ; then |
2134 |
|
MPIHOME='/usr' |
2135 |
|
fi |
2136 |
|
MPIINCLUDEDIR='$MPIHOME/include' |
2137 |
|
fi |
2138 |
|
|
2139 |
|
if test -r $MPIINCLUDEDIR/mpif.h ; then |
2140 |
|
for i in $MPI_HEADER_FILES; do |
2141 |
|
cp -p $MPIINCLUDEDIR/$i ./mpi_headers |
2142 |
|
done |
2143 |
|
|
2144 |
|
perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h |
2145 |
|
else |
2146 |
|
echo " We cannot create a copy of mpif.h!" |
2147 |
|
exit -1 |
2148 |
|
fi |
2149 |
|
fi |
2150 |
|
|
2151 |
echo " Determining the list of source and include files" |
echo " Determining the list of source and include files" |
2152 |
rm -rf .links.tmp |
rm -rf .links.tmp |
2153 |
mkdir .links.tmp |
mkdir .links.tmp |
2166 |
for sf in $sfiles ; do |
for sf in $sfiles ; do |
2167 |
if test ! -r ".links.tmp/$sf" ; then |
if test ! -r ".links.tmp/$sf" ; then |
2168 |
if test -f "$d/$sf" ; then |
if test -f "$d/$sf" ; then |
2169 |
|
ignore_f=f |
2170 |
case $d/$sf in |
case $d/$sf in |
2171 |
./$PACKAGES_DOT_H) |
./$PACKAGES_DOT_H) |
2172 |
|
ignore_f=t |
2173 |
;; |
;; |
2174 |
./AD_CONFIG.h) |
./AD_CONFIG.h) |
2175 |
|
ignore_f=t |
2176 |
;; |
;; |
2177 |
./FC_NAMEMANGLE.h) |
./FC_NAMEMANGLE.h) |
2178 |
|
ignore_f=t |
2179 |
;; |
;; |
2180 |
./BUILD_INFO.h) |
./BUILD_INFO.h) |
2181 |
|
ignore_f=t |
2182 |
|
;; |
2183 |
|
./EMBEDDED_FILES.h) |
2184 |
|
ignore_f=t |
2185 |
;; |
;; |
2186 |
*) |
*) |
2187 |
touch .links.tmp/$sf |
# For the local directory *ONLY*, |
2188 |
deplist="$deplist $sf" |
# ignore all soft-links |
2189 |
|
if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then |
2190 |
|
ignore_f=t |
2191 |
|
else |
2192 |
|
touch .links.tmp/$sf |
2193 |
|
deplist="$deplist $sf" |
2194 |
|
fi |
2195 |
;; |
;; |
2196 |
esac |
esac |
2197 |
extn=`echo $sf | $AWK -F. '{print $NF}'` |
if test "x$ignore_f" = xf ; then |
2198 |
case $extn in |
extn=`echo $sf | $AWK -F. '{print $NF}'` |
2199 |
F) |
case $extn in |
2200 |
echo " \\" >> srclist.inc |
F) |
2201 |
printf " $sf" >> srclist.inc |
echo " \\" >> srclist.inc |
2202 |
;; |
printf " $sf" >> srclist.inc |
2203 |
F90) |
;; |
2204 |
echo " \\" >> f90srclist.inc |
F90) |
2205 |
printf " $sf" >> f90srclist.inc |
echo " \\" >> f90srclist.inc |
2206 |
;; |
printf " $sf" >> f90srclist.inc |
2207 |
c) |
;; |
2208 |
echo " \\" >> csrclist.inc |
c) |
2209 |
printf " $sf" >> csrclist.inc |
echo " \\" >> csrclist.inc |
2210 |
;; |
printf " $sf" >> csrclist.inc |
2211 |
h) |
;; |
2212 |
echo " \\" >> hlist.inc |
h) |
2213 |
printf " $sf" >> hlist.inc |
echo " \\" >> hlist.inc |
2214 |
;; |
printf " $sf" >> hlist.inc |
2215 |
flow) |
;; |
2216 |
echo " \\" >> ad_flow_files.inc |
flow) |
2217 |
printf " $sf" >> ad_flow_files.inc |
echo " \\" >> ad_flow_files.inc |
2218 |
;; |
printf " $sf" >> ad_flow_files.inc |
2219 |
esac |
;; |
2220 |
|
esac |
2221 |
|
fi |
2222 |
fi |
fi |
2223 |
fi |
fi |
2224 |
done |
done |
2294 |
|
|
2295 |
# These files are created by Makefile |
# These files are created by Makefile |
2296 |
SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h BUILD_INFO.h |
SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h BUILD_INFO.h |
|
|
|
2297 |
EOF |
EOF |
2298 |
|
|
2299 |
# Note: figure out some way to add Hyades JAM libraries here |
if test "x$EMBED_SRC" = xt ; then |
2300 |
|
echo "EMBEDDED_FILES = EMBEDDED_FILES.h" >>$MAKEFILE |
2301 |
|
else |
2302 |
|
echo "EMBEDDED_FILES = " >>$MAKEFILE |
2303 |
|
fi |
2304 |
|
|
2305 |
|
# Note: figure out some way to add Hyades JAM libraries here |
2306 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2307 |
# Unix ln (link) |
# Unix ln (link) |
2308 |
LN = ${LN} |
LN = ${LN} |
2364 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2365 |
|
|
2366 |
all: \$(EXECUTABLE) |
all: \$(EXECUTABLE) |
2367 |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) |
\$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) \$(EMBEDDED_FILES) |
2368 |
@echo Creating \$@ ... |
@echo Creating \$@ ... |
2369 |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
\$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) |
2370 |
depend: |
depend: |
2373 |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
\$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) |
2374 |
-rm -f makedepend.out |
-rm -f makedepend.out |
2375 |
|
|
2376 |
|
lib: libmitgcmuv.a |
2377 |
|
|
2378 |
|
libmitgcmuv.a: \$(OBJFILES) |
2379 |
|
ar rcv libmitgcmuv.a \$(OBJFILES) |
2380 |
|
|
2381 |
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) |
links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) |
2382 |
|
|
2383 |
small_f: \$(F77FILES) \$(F90FILES) |
small_f: \$(F77FILES) \$(F90FILES) |
2426 |
test ! "x$THISDATE" = x && echo " -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE |
test ! "x$THISDATE" = x && echo " -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE |
2427 |
test ! "x$THISHOST" = x && echo " -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE |
test ! "x$THISHOST" = x && echo " -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE |
2428 |
|
|
2429 |
|
if test "x$EMBED_SRC" = xt ; then |
2430 |
|
cat >>$MAKEFILE <<EOF |
2431 |
|
|
2432 |
|
decode_files.o : EMBEDDED_FILES.h |
2433 |
|
|
2434 |
|
## \$(F77FILES) |
2435 |
|
all_fF.tar.gz : \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile |
2436 |
|
@echo Creating \$@ ... |
2437 |
|
-tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile |
2438 |
|
-rm -f all_fF.tar.gz |
2439 |
|
-gzip all_fF.tar |
2440 |
|
|
2441 |
|
EMBEDDED_FILES.h : all_fF.tar.gz |
2442 |
|
@echo Creating \$@ ... |
2443 |
|
-\${ROOTDIR}/tools/embed_encode/encode_files EMBEDDED_FILES.h all_fF.tar.gz |
2444 |
|
|
2445 |
|
EOF |
2446 |
|
fi |
2447 |
|
|
2448 |
cat >>$MAKEFILE <<EOF |
cat >>$MAKEFILE <<EOF |
2449 |
|
|
2450 |
# The normal chain of rules is ( .F - .$FS - .o ) |
# The normal chain of rules is ( .F - .$FS - .o ) |
2461 |
.$FS90.o: |
.$FS90.o: |
2462 |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
\$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< |
2463 |
.c.o: |
.c.o: |
2464 |
\$(CC) \$(CFLAGS) -c \$< |
\$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$< |
2465 |
|
|
2466 |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
# Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain |
2467 |
.F.p: |
.F.p: |