--- MITgcm/tools/genmake2 2010/12/13 22:07:20 1.216 +++ MITgcm/tools/genmake2 2011/06/24 22:03:39 1.221 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.216 2010/12/13 22:07:20 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.221 2011/06/24 22:03:39 jmc Exp $ # $Name: $ # # Makefile generator for MITgcm UV codes @@ -96,11 +96,6 @@ will search for a working compiler by trying a list of "usual suspects" such as gcc, c89, cc, etc. - -[no]ieee | --[no]ieee - Do or don't use IEEE numerics. Note that this option - *only* works if it is supported by the OPTFILE that - is being used. - -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 Use "real*4" type for _RS variable (#undef REAL4_IS_SLOW) *only* works if CPP_EEOPTIONS.h allows this. @@ -126,10 +121,14 @@ -hpmt | --hpmt Performance analysis with the HPM Toolkit - -gsl | --gsl - Use GSL to control floating point rounding and precision + -ieee | --ieee + use IEEE numerics. Note that this option *only* works + if it is supported by the OPTFILE that is being used. -devel | --devel Add additional warning and debugging flags for development + (if supported by the OPTFILE); also switch to IEEE numerics. + -gsl | --gsl + Use GSL to control floating point rounding and precision -mpi | --mpi Include MPI header files and link to MPI libraries @@ -346,6 +345,27 @@ # 3) locally build and use the cyrus implementation # 4) fall back to the buggy local xmakedpend script # + echo >> $LOGFILE + echo "running: look_for_makedepend()" >> $LOGFILE + if test "x${MAKEDEPEND}" != x ; then + echo "${MAKEDEPEND}" | grep -i cyrus > /dev/null 2>&1 + RETVAL=$? + if test x"$RETVAL" = x0 ; then + build_cyrus_makedepend + RETVAL=$? + if test "x$RETVAL" != x0 ; then + echo "WARNING: unable to build cyrus-makedepend. Try 'makedepend'" + MAKEDEPEND= + fi + else + echo "${MAKEDEPEND}" | grep 'tools.xmakedepend' > /dev/null 2>&1 + RETVAL=$? + if test "x$RETVAL" = x0 ; then + MAKEDEPEND='$(TOOLSDIR)/xmakedepend' + fi + echo " --> MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE + fi + fi if test "x${MAKEDEPEND}" = x ; then which makedepend > /dev/null 2>&1 RV0=$? @@ -370,27 +390,24 @@ test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE if test "x${RV0}${RV1}" = x00 ; then MAKEDEPEND=makedepend + echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE else - echo " a system-default makedepend was not found." + echo " system-default makedepend not found. Try to build cyrus-makedepend" # Try to build the cyrus implementation build_cyrus_makedepend RETVAL=$? if test "x$RETVAL" != x0 ; then + echo "WARNING: unable to build cyrus-makedepend. Use local xmakedepend" MAKEDEPEND='$(TOOLSDIR)/xmakedepend' + echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE fi - rm -f ./genmake_cy_md - fi - else - # echo "MAKEDEPEND=${MAKEDEPEND}" - echo "${MAKEDEPEND}" | grep -i cyrus > /dev/null 2>&1 - RETVAL=$? - if test x"$RETVAL" = x0 ; then - build_cyrus_makedepend fi fi } build_cyrus_makedepend() { + echo >> $LOGFILE + echo "running: build_cyrus_makedepend()" >> $LOGFILE rm -f ./genmake_cy_md ( cd $ROOTDIR/tools/cyrus-imapd-makedepend \ @@ -407,9 +424,10 @@ rm -f ./genmake_cy_md if test "x$RETVAL" = x0 ; then MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend' + echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE return 0 else - echo "WARNING: unable to build cyrus-imapd-makedepend" + echo "WARNING: fail to build cyrus-imapd-makedepend" >> $LOGFILE return 1 fi } @@ -1133,7 +1151,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 CC IEEE USE_R4 TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS" +gm_s2="FC CC USE_R4 TS PAPIS PCLS PAPI PCL HPMT IEEE DEVEL GSL 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" @@ -1297,13 +1315,17 @@ -fs90=* | --fs90=*) FS90=$ac_optarg ;; + -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 ) + USE_R4=true ;; + -ieee | --ieee) IEEE=true ;; -noieee | --noieee) - IEEE= ;; - - -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 ) - USE_R4=true ;; + echo "Warning: ignore option '$ac_option' (default is already without '-ieee')" ;; + -devel | --devel) + IEEE=true ; DEVEL=true ;; + -gsl | --gsl) + GSL=true ;; -ts | --ts) TS=true ;; @@ -1320,12 +1342,6 @@ -hpmt | --hpmt) HPMT=true ;; - -gsl | --gsl) - GSL=true ;; - - -devel | --devel) - DEVEL=true ;; - -mpi | --mpi) MPI=true ;; -mpi=* | --mpi=*) @@ -1376,7 +1392,7 @@ echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" echo " file. This file format is no longer supported. For directions on" echo " how to setup and use the new \"genmake2\" script, please see:" - echo " http://mitgcm.org/devel_HOWTO/" + echo " http://mitgcm.org/public/devel_HOWTO/" echo " and send an email to MITgcm-support@mitgcm.org if you need help." echo "WARNING: ignore \"./.genmakerc\" and continue." echo @@ -1391,8 +1407,8 @@ for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then ROOTDIR=$d - printf "Warning: ROOTDIR was not specified but there appears to be" - echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it." + printf "Warning: ROOTDIR was not specified ;" + echo " try using a local copy of MITgcm found at \"$ROOTDIR\"" break fi done @@ -1502,7 +1518,7 @@ if test "x$GET_FC_VERSION" != x ; then echo "Get compiler version using: $FC $GET_FC_VERSION" >> $LOGFILE $FC $GET_FC_VERSION >> $LOGFILE 2>&1 - echo "--- compiler version ----" >> $LOGFILE + echo "<-- compiler version ----" >> $LOGFILE fi if test "x$CC" = x ; then @@ -2705,7 +2721,8 @@ CLEAN: @make Clean -rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak - -rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log + -rm -f $LOGFILE genmake_state genmake_*optfile + -rm -f SIZE.h.mpi genmake.tr_log make.tr_log -find \$(EXEDIR) -name "*.meta" -exec rm {} \; -find \$(EXEDIR) -name "*.data" -exec rm {} \; -find \$(EXEDIR) -name "fort.*" -exec rm {} \;