--- MITgcm/tools/genmake2 2004/04/08 23:48:43 1.77 +++ MITgcm/tools/genmake2 2004/07/12 15:49:08 1.84 @@ -1,6 +1,6 @@ -#! /usr/bin/env bash +#! /usr/bin/env sh # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.77 2004/04/08 23:48:43 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.84 2004/07/12 15:49:08 edhill Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -158,35 +158,7 @@ } -# Guess possible config options for this host -find_possible_configs() { - - tmp1=`uname`"_"`uname -m` - tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` - tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` - tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` - 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" - - echo "test" > test - ln -s ./test link - RETVAL=$? - if test "x${RETVAL}" = x0 ; then - LN="ln -s" - else - echo "Error: \"ln -s\" does not appear to work on this system!" - echo " For help, please contact ." - exit 1 - fi - rm -f test link - - if test "x$CPP" = x ; then - CPP="cpp -traditional -P" - fi +look_for_makedepend() { # The "original" makedepend is part of the Imake system that is # most often distributed with XFree86 or with an XFree86 source @@ -242,6 +214,40 @@ rm -f ./genmake_cy_md fi fi +} + + +# Guess possible config options for this host +find_possible_configs() { + + tmp1=`uname`"_"`uname -m` + tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` + tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` + tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'` + 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" + + echo "test" > test + ln -s ./test link + RETVAL=$? + if test "x${RETVAL}" = x0 ; then + LN="ln -s" + else + echo "Error: \"ln -s\" does not appear to work on this system!" + echo " For help, please contact ." + exit 1 + fi + rm -f test link + + if test "x$CPP" = x ; then + CPP="cpp -traditional -P" + fi + + look_for_makedepend # look for possible fortran compilers tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" @@ -371,6 +377,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 @@ -677,6 +688,7 @@ FC_NAMEMANGLE= HAVE_CLOC= HAVE_NETCDF= +HAVE_ETIME= MODS= TOOLSDIR= @@ -727,7 +739,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" @@ -1079,9 +1091,7 @@ else rm -f test_cpp fi -if test "x$MAKEDEPEND" = x ; then - MAKEDEPEND=makedepend -fi +look_for_makedepend if test "x$LN" = x ; then LN="ln -s" fi @@ -1147,6 +1157,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 @@ -1769,7 +1801,7 @@ echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE echo >> $MAKEFILE echo '.SUFFIXES:' >> $MAKEFILE -echo '.SUFFIXES: .o .F .p .'$FS' .c .F90 .'$FS90 >> $MAKEFILE +echo '.SUFFIXES: .o .'$FS' .p .F .c .'$FS90' .F90' >> $MAKEFILE rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc rm -f ad_flow_files.inc @@ -1805,7 +1837,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: