--- MITgcm/tools/genmake2 2004/04/08 21:32:11 1.76 +++ MITgcm/tools/genmake2 2004/06/30 01:19:29 1.82 @@ -1,6 +1,6 @@ -#! /usr/bin/env bash +#! /usr/bin/env sh # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.76 2004/04/08 21:32:11 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.82 2004/06/30 01:19:29 cnh Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -97,8 +97,8 @@ RETVAL=$? if test "x$RETVAL" != x0 ; then if test "x$FS" = x ; then - FS='fs' - FS90='fs90' + FS='for' + FS90='fr9' check_for_broken_Ff else cat <&1 @@ -124,6 +124,7 @@ EOF test -e Makefile && mv -f Makefile Makefile.bak cat <> Makefile +%.$tfs : %.F .SUFFIXES: genmake_hello.$tfs: genmake_hello.F $LN genmake_hello.F genmake_hello.$tfs @@ -132,8 +133,8 @@ RETVAL=$? if test "x$RETVAL" != x0 -o ! -e "genmake_hello."$tfs ; then if test "x$FS" = x ; then - FS='fs' - FS90='fs9' + FS='for' + FS90='fr9' check_for_broken_Ff else cat <&1 @@ -167,6 +168,7 @@ tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'` PLATFORM=$tmp3 + echo $PLATFORM | grep cygwin > /dev/null 2>&1 && PLATFORM=cygwin_ia32 OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` echo " The platform appears to be: $PLATFORM" @@ -206,8 +208,16 @@ # if test "x${MAKEDEPEND}" = x ; then which makedepend > /dev/null 2>&1 - RETVAL=$? - if test ! "x${RETVAL}" = x0 ; then + RV0=$? + cat <> genmake_tc.f + program test + write(*,*) 'test' + stop + end +EOF + makedepend genmake_tc.f > /dev/null 2>&1 + RV1=$? + if test ! "x${RV0}${RV1}" = x00 ; then echo " a system-default makedepend was not found." # Try to build the cyrus impl @@ -215,8 +225,11 @@ ( cd $ROOTDIR/tools/cyrus-imapd-makedepend \ && ./configure > /dev/null 2>&1 \ - && make > /dev/null 2>&1 \ - && ./makedepend ifparser.c > /dev/null 2>&1 \ + && make > /dev/null 2>&1 + if test -x ./makedepend.exe ; then + $LN ./makedepend.exe ./makedepend + fi + ./makedepend ifparser.c > /dev/null 2>&1 \ && echo "true" ) > ./genmake_cy_md grep true ./genmake_cy_md > /dev/null 2>&1 @@ -358,6 +371,11 @@ -help | --help | -h | --h Print this help message and exit. + -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME + -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME + Use "NAME" as the adoptfile. By default, the file at + "tools/adjoint_options/adjoint_default" will be used. + -nooptfile | --nooptfile -optfile NAME | --optfile NAME | -of NAME | --of NAME -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME @@ -664,6 +682,7 @@ FC_NAMEMANGLE= HAVE_CLOC= HAVE_NETCDF= +HAVE_ETIME= MODS= TOOLSDIR= @@ -714,7 +733,7 @@ gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE" gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" -gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE" +gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME" # The following are all related to adjoint/tangent-linear stuff gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS" @@ -987,7 +1006,7 @@ fi # Check for broken systems that cannot correctly distinguish *.F and *.f files -check_for_broken_Ff +# check_for_broken_Ff echo " getting AD_OPTFILE information: " if test "x${AD_OPTFILE}" = x ; then @@ -1086,6 +1105,9 @@ fi rm -f genmake_test_ln genmake_tlink +# Check for broken *.F/*.f handling and fix if possible +check_for_broken_Ff + if test ! "x$MPI" = x ; then echo " Turning on MPI cpp macros" DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" @@ -1131,6 +1153,28 @@ fi rm -f genmake_tcomp* +printf " Do we have the etime() command using $FC... " +cat > genmake_tcomp.f < genmake_tcomp.log 2>&1 +RETVAL=$? +if test "x$RETVAL" = x0 ; then + HAVE_ETIME=t + DEFINES="$DEFINES -DHAVE_ETIME" + echo "yes" +else + HAVE_ETIME= + echo "no" +fi +rm -f genmake_tcomp* + printf " Can we call simple C routines (here, \"cloc()\") using $FC... " check_HAVE_CLOC if test "x$HAVE_CLOC" != x ; then @@ -1789,7 +1833,7 @@ -find \$(EXEDIR) -name "*.meta" -exec rm {} \; -find \$(EXEDIR) -name "*.data" -exec rm {} \; -find \$(EXEDIR) -name "fort.*" -exec rm {} \; - -rm -f \$(EXECUTABLE) output.txt + -rm -f \$(EXECUTABLE) output.txt STD* #eh3 Makefile: makefile makefile: