527 |
*only* works if it is supported by the OPTFILE that |
*only* works if it is supported by the OPTFILE that |
528 |
is being used. |
is being used. |
529 |
|
|
530 |
|
-ts | --ts |
531 |
|
Produce timing information per timestep |
532 |
|
|
533 |
-mpi | --mpi |
-mpi | --mpi |
534 |
Include MPI header files and link to MPI libraries |
Include MPI header files and link to MPI libraries |
535 |
-mpi=PATH | --mpi=PATH |
-mpi=PATH | --mpi=PATH |
671 |
RET_C=$? |
RET_C=$? |
672 |
cat <<EOF > genmake_tc_2.$FS |
cat <<EOF > genmake_tc_2.$FS |
673 |
program hello |
program hello |
674 |
Real*8 wtime |
REAL*8 wtime |
675 |
external cloc |
external cloc |
676 |
call cloc(wtime) |
call cloc(wtime) |
677 |
print *," HELLO WORLD", wtime |
print *," HELLO WORLD", wtime |
678 |
end program hello |
end |
679 |
EOF |
EOF |
680 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
681 |
RET_F=$? |
RET_F=$? |
689 |
} |
} |
690 |
|
|
691 |
|
|
692 |
|
check_HAVE_SETRLSTK() { |
693 |
|
get_fortran_c_namemangling |
694 |
|
cat <<EOF > genmake_tc_1.c |
695 |
|
$FC_NAMEMANGLE |
696 |
|
#include <sys/time.h> |
697 |
|
#include <sys/resource.h> |
698 |
|
#include <unistd.h> |
699 |
|
void FC_NAMEMANGLE(setrlstk) () |
700 |
|
{ |
701 |
|
struct rlimit rls; |
702 |
|
rls.rlim_cur = RLIM_INFINITY; |
703 |
|
rls.rlim_max = RLIM_INFINITY; |
704 |
|
setrlimit(RLIMIT_STACK, &rls); |
705 |
|
return; |
706 |
|
} |
707 |
|
EOF |
708 |
|
make genmake_tc_1.o >> genmake_warnings 2>&1 |
709 |
|
RET_C=$? |
710 |
|
cat <<EOF > genmake_tc_2.$FS |
711 |
|
program hello |
712 |
|
external setrlstk |
713 |
|
call setrlstk() |
714 |
|
end |
715 |
|
EOF |
716 |
|
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 |
717 |
|
RET_F=$? |
718 |
|
test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 |
719 |
|
RETVAL=$? |
720 |
|
if test "x$RETVAL" = x0 ; then |
721 |
|
HAVE_SETRLSTK=t |
722 |
|
DEFINES="$DEFINES -DHAVE_SETRLSTK" |
723 |
|
fi |
724 |
|
rm -f genmake_tc* |
725 |
|
} |
726 |
|
|
727 |
|
|
728 |
check_HAVE_STAT() { |
check_HAVE_STAT() { |
729 |
get_fortran_c_namemangling |
get_fortran_c_namemangling |
730 |
cat <<EOF > genmake_tc_1.c |
cat <<EOF > genmake_tc_1.c |
753 |
integer nbyte |
integer nbyte |
754 |
call tfsize(nbyte) |
call tfsize(nbyte) |
755 |
print *," HELLO WORLD", nbyte |
print *," HELLO WORLD", nbyte |
756 |
end program hello |
end |
757 |
EOF |
EOF |
758 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 |
$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1 |
759 |
RET_F=$? |
RET_F=$? |
873 |
NOOPTFLAGS= |
NOOPTFLAGS= |
874 |
MPI= |
MPI= |
875 |
MPIPATH= |
MPIPATH= |
876 |
|
TS= |
877 |
|
HAVE_TEST_L= |
878 |
|
|
879 |
# DEFINES checked by test compilation or command-line |
# DEFINES checked by test compilation or command-line |
880 |
HAVE_SYSTEM= |
HAVE_SYSTEM= |
881 |
HAVE_FDATE= |
HAVE_FDATE= |
882 |
FC_NAMEMANGLE= |
FC_NAMEMANGLE= |
883 |
HAVE_CLOC= |
HAVE_CLOC= |
884 |
|
HAVE_SETRLSTK= |
885 |
HAVE_STAT= |
HAVE_STAT= |
886 |
HAVE_NETCDF= |
HAVE_NETCDF= |
887 |
HAVE_ETIME= |
HAVE_ETIME= |
931 |
|
|
932 |
# The following state can be set directly by command-line switches |
# The following state can be set directly by command-line switches |
933 |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" |
934 |
gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS" |
gm_s2="FC CPP IEEE TS MPI JAM DUMPSTATE STANDARDDIRS" |
935 |
|
|
936 |
# The following state is not directly set by command-line switches |
# The following state is not directly set by command-line switches |
937 |
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 " |
1111 |
-noieee | --noieee) |
-noieee | --noieee) |
1112 |
IEEE= ;; |
IEEE= ;; |
1113 |
|
|
1114 |
|
-ts | --ts) |
1115 |
|
TS=true ;; |
1116 |
|
|
1117 |
-mpi | --mpi) |
-mpi | --mpi) |
1118 |
MPI=true ;; |
MPI=true ;; |
1119 |
-mpi=* | --mpi=*) |
-mpi=* | --mpi=*) |
1197 |
|
|
1198 |
# Find the MITgcm ${THISVER} |
# Find the MITgcm ${THISVER} |
1199 |
if test -f "${ROOTDIR}/doc/tag-index" ; then |
if test -f "${ROOTDIR}/doc/tag-index" ; then |
1200 |
THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1` |
THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1` |
1201 |
fi |
fi |
1202 |
|
|
1203 |
if test "x$MAKEFILE" = x ; then |
if test "x$MAKEFILE" = x ; then |
1339 |
EOF |
EOF |
1340 |
exit 1 |
exit 1 |
1341 |
fi |
fi |
1342 |
|
test -L genmake_tlink > /dev/null 2>&1 |
1343 |
|
RETVAL=$? |
1344 |
|
if test "x$RETVAL" = x0 ; then |
1345 |
|
HAVE_TEST_L=t |
1346 |
|
fi |
1347 |
rm -f genmake_test_ln genmake_tlink |
rm -f genmake_test_ln genmake_tlink |
1348 |
|
|
1349 |
# Check for broken *.F/*.f handling and fix if possible |
# Check for broken *.F/*.f handling and fix if possible |
1354 |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" |
1355 |
fi |
fi |
1356 |
|
|
1357 |
|
if test ! "x$TS" = x ; then |
1358 |
|
echo " Turning on timing per timestep" |
1359 |
|
DEFINES="$DEFINES -DTIME_PER_TIMESTEP" |
1360 |
|
fi |
1361 |
|
|
1362 |
printf "\n=== Checking system libraries ===\n" |
printf "\n=== Checking system libraries ===\n" |
1363 |
printf " Do we have the system() command using $FC... " |
printf " Do we have the system() command using $FC... " |
1364 |
cat > genmake_tcomp.$FS <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1381 |
printf " Do we have the fdate() command using $FC... " |
printf " Do we have the fdate() command using $FC... " |
1382 |
cat > genmake_tcomp.$FS <<EOF |
cat > genmake_tcomp.$FS <<EOF |
1383 |
program hello |
program hello |
1384 |
CHARACTER(128) string |
CHARACTER*(128) string |
1385 |
string = ' ' |
string = ' ' |
1386 |
call fdate( string ) |
call fdate( string ) |
1387 |
print *, string |
print *, string |
1430 |
fi |
fi |
1431 |
rm -f genmake_t* |
rm -f genmake_t* |
1432 |
|
|
1433 |
|
printf " Can we unlimit the stack size using $FC... " |
1434 |
|
check_HAVE_SETRLSTK |
1435 |
|
if test "x$HAVE_SETRLSTK" != x ; then |
1436 |
|
echo "yes" |
1437 |
|
else |
1438 |
|
echo "no" |
1439 |
|
fi |
1440 |
|
rm -f genmake_t* |
1441 |
|
|
1442 |
printf " Can we use stat() through C calls... " |
printf " Can we use stat() through C calls... " |
1443 |
check_HAVE_STAT |
check_HAVE_STAT |
1444 |
if test "x$HAVE_STAT" != x ; then |
if test "x$HAVE_STAT" != x ; then |
1926 |
for sf in $sfiles ; do |
for sf in $sfiles ; do |
1927 |
if test ! -r ".links.tmp/$sf" ; then |
if test ! -r ".links.tmp/$sf" ; then |
1928 |
if test -f "$d/$sf" ; then |
if test -f "$d/$sf" ; then |
1929 |
|
ignore_f=f |
1930 |
case $d/$sf in |
case $d/$sf in |
1931 |
./$PACKAGES_DOT_H) |
./$PACKAGES_DOT_H) |
1932 |
;; |
;; |
1937 |
./BUILD_INFO.h) |
./BUILD_INFO.h) |
1938 |
;; |
;; |
1939 |
*) |
*) |
1940 |
touch .links.tmp/$sf |
# For the local directory *ONLY*, |
1941 |
deplist="$deplist $sf" |
# ignore all soft-links |
1942 |
|
if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then |
1943 |
|
ignore_f=t |
1944 |
|
else |
1945 |
|
touch .links.tmp/$sf |
1946 |
|
deplist="$deplist $sf" |
1947 |
|
fi |
1948 |
;; |
;; |
1949 |
esac |
esac |
1950 |
extn=`echo $sf | $AWK -F. '{print $NF}'` |
if test "x$ignore_f" = xf ; then |
1951 |
case $extn in |
extn=`echo $sf | $AWK -F. '{print $NF}'` |
1952 |
F) |
case $extn in |
1953 |
echo " \\" >> srclist.inc |
F) |
1954 |
printf " $sf" >> srclist.inc |
echo " \\" >> srclist.inc |
1955 |
;; |
printf " $sf" >> srclist.inc |
1956 |
F90) |
;; |
1957 |
echo " \\" >> f90srclist.inc |
F90) |
1958 |
printf " $sf" >> f90srclist.inc |
echo " \\" >> f90srclist.inc |
1959 |
;; |
printf " $sf" >> f90srclist.inc |
1960 |
c) |
;; |
1961 |
echo " \\" >> csrclist.inc |
c) |
1962 |
printf " $sf" >> csrclist.inc |
echo " \\" >> csrclist.inc |
1963 |
;; |
printf " $sf" >> csrclist.inc |
1964 |
h) |
;; |
1965 |
echo " \\" >> hlist.inc |
h) |
1966 |
printf " $sf" >> hlist.inc |
echo " \\" >> hlist.inc |
1967 |
;; |
printf " $sf" >> hlist.inc |
1968 |
flow) |
;; |
1969 |
echo " \\" >> ad_flow_files.inc |
flow) |
1970 |
printf " $sf" >> ad_flow_files.inc |
echo " \\" >> ad_flow_files.inc |
1971 |
;; |
printf " $sf" >> ad_flow_files.inc |
1972 |
esac |
;; |
1973 |
|
esac |
1974 |
|
fi |
1975 |
fi |
fi |
1976 |
fi |
fi |
1977 |
done |
done |
2102 |
cat ad_flow_files.inc >> $MAKEFILE |
cat ad_flow_files.inc >> $MAKEFILE |
2103 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2104 |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE |
2105 |
echo 'F90FILES = $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE |
echo 'F90FILES = $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE |
2106 |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE |
2107 |
echo >> $MAKEFILE |
echo >> $MAKEFILE |
2108 |
echo '.SUFFIXES:' >> $MAKEFILE |
echo '.SUFFIXES:' >> $MAKEFILE |