--- MITgcm/tools/genmake2 2010/11/05 16:28:59 1.213 +++ MITgcm/tools/genmake2 2010/11/06 19:03:41 1.214 @@ -1,6 +1,7 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.213 2010/11/05 16:28:59 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.214 2010/11/06 19:03:41 jmc Exp $ +# $Name: $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -8,6 +9,167 @@ # modified by aja 01/00 # rewritten in bash by eh3 08/03 +# Explain usage +usage() { +cat <> $LOGFILE @@ -338,6 +495,8 @@ # Guess possible config options for this host find_possible_optfile() { + echo >> $LOGFILE + echo "running: find_possible_optfile()" >> $LOGFILE tmp1=`uname`"_"`uname -m` tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` @@ -347,48 +506,32 @@ 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_C_compilers + echo " The platform appears to be: $PLATFORM" | tee -a $LOGFILE #================================================================ # look for possible FORTRAN compilers - tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 gfortran g95" + echo " look for possible FORTRAN compilers" >> $LOGFILE + tmp="$MITGCM_FC $FC efc gfortran g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 g95" p_FC= - for c in $tmp ; do - rm -f ./hello.f ./hello - cat >> hello.f <> genmake_hello.f < /dev/null 2>&1 + for f in $tmp ; do + COMM="$f -o genmake_hello genmake_hello.f" + echo $COMM >> $LOGFILE + $COMM >> $LOGFILE 2>&1 RETVAL=$? if test "x${RETVAL}" = x0 ; then - p_FC="$p_FC $c" + echo " $f test successful" >> $LOGFILE + p_FC="$p_FC $f" fi done - rm -f ./hello.f ./hello + rm -f ./genmake_hello.f ./genmake_hello if test "x${p_FC}" = x ; then cat 1>&2 < genmake_test.c <> $LOGFILE 2>&1 COMM="$CC $CFLAGS -c genmake_test.c" echo ' '$COMM >> $LOGFILE $COMM >> $LOGFILE 2>&1 @@ -746,7 +727,6 @@ echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE } - check_HAVE_CLOC() { echo >> $LOGFILE echo "running: check_HAVE_CLOC()" >> $LOGFILE @@ -792,7 +772,6 @@ echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE } - check_HAVE_SIGREG() { if test ! "x$HAVE_SIGREG" = x ; then return @@ -855,7 +834,6 @@ echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE } - check_HAVE_SETRLSTK() { if test "x$HAVE_SETRLSTK" = xt ; then DEFINES="$DEFINES -DHAVE_SETRLSTK" @@ -904,7 +882,6 @@ echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE } - check_HAVE_STAT() { echo >> $LOGFILE echo "running: check_HAVE_STAT()" >> $LOGFILE @@ -952,7 +929,6 @@ echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE } - check_netcdf_libs() { if test ! "x$SKIP_NETCDF_CHECK" = x ; then return @@ -1046,7 +1022,6 @@ } - ############################################################################### # Sequential part of script starts here ############################################################################### @@ -1157,7 +1132,7 @@ # The following state can be set directly by command-line switches gm_s1="OPTFILE PKG_DEPEND PKG_GROUPS MAKEFILE MAKEDEPEND PLATFORM ROOTDIR MODS DISABLE ENABLE" -gm_s2="FC IEEE USE_R4 TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS" +gm_s2="FC CC IEEE USE_R4 TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS" # The following state is not directly set by command-line switches gm_s3="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM FEXTRAFLAGS" @@ -1395,7 +1370,6 @@ done - if test -f ./.genmakerc ; then echo echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" @@ -1527,14 +1501,6 @@ if test "x$CC" = x ; then look_for_C_compilers -# CC=cc -# cat <&2 -# Error: no C compiler: please specify using one of the following: -# 1) within the options file ("CC=...") as specified by "-of=OPTFILE" -# 2) the "-cc=XXX" command-line option -# 3) the "./genmake_local" file -# EOF -# exit 1 fi if test "x$LINK" = x ; then @@ -1821,7 +1787,6 @@ ENABLE="$ENABLE embed_files" fi - printf "\n=== Setting defaults ===\n" printf " Adding MODS directories: " for d in $MODS ; do @@ -2797,6 +2762,8 @@ \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ .$FS.o: \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< +.F.o: + \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< .F90.$FS90: \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ .FF90.f$FS90: @@ -2931,7 +2898,6 @@ ftl_tamc: ftl_tamc_output.o \$(OBJFILES) \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) - # ... SVD ... svdtaf: ad_taf_output.$FS ftl_taf_output.$FS @echo "--->>> Only ran TAF to generate SVD code! <<<---" @@ -3255,7 +3221,6 @@ $BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > AD_CONFIG.h fi - # Write the "state" for future records if test "x$DUMPSTATE" = xt ; then printf "" > genmake_state