--- MITgcm/tools/genmake2 2009/12/10 07:01:14 1.201 +++ MITgcm/tools/genmake2 2010/05/23 03:45:58 1.205 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.201 2009/12/10 07:01:14 utke Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.205 2010/05/23 03:45:58 jmc Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -480,12 +480,16 @@ # strip the comments and then convert the dependency file into # two arrays: PNAME, DNAME cat $1 | sed -e 's/#.*$//g' \ - | $AWK 'BEGIN{nn=0;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME["nn"]="$1"\nDNAME["nn"]="$i} }' \ + | $AWK 'BEGIN{nn=-1;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME_"nn"="$1"\nDNAME_"nn"="$i}} END{print "nname="nn}' \ > ./.pd_tmp + RETVAL=$? + if test ! "x${RETVAL}" = x0 ; then + echo "Error: unable to parse package dependencies -- please check PDEPEND=\"$1\"" + exit 1 + fi . ./.pd_tmp rm -f ./.pd_tmp - printf "PNAME = "${} } @@ -519,6 +523,9 @@ -pdefault=NAME | --pdefault=NAME Get the default package list from "NAME". + -bash NAME + Explicitly specify the Bourne or BASH shell to use + -make NAME | -m NAME --make=NAME | -m=NAME Use "NAME" for the MAKE program. The default is "make" but @@ -578,6 +585,10 @@ *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. + -ignoretime | -ignore_time | --ignoretime | --ignore_time Ignore all the "wall clock" routines entirely. This will not in any way hurt the model results -- it simply means @@ -621,9 +632,6 @@ (including the Makefile, etc.) used to build the executable [off by default] - -bash NAME - Explicitly specify the Bourne or BASH shell to use - While it is most often a single word, the "NAME" variables specified above can in many cases be a space-delimited string such as: @@ -635,7 +643,7 @@ For more detailed genmake documentation, please see: - http://mitgcm.org/devel_HOWTO/ + http://mitgcm.org/public/devel_HOWTO/ EOF @@ -1065,6 +1073,7 @@ MPIPATH= OMP= OMPFLAG= +USE_R4= TS= PAPIS= PCLS= @@ -1132,7 +1141,7 @@ # The following state can be set directly by command-line switches gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE" -gm_s2="FC CPP IEEE TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS" +gm_s2="FC 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 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM FEXTRAFLAGS" @@ -1297,6 +1306,9 @@ -noieee | --noieee) IEEE= ;; + -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 ) + USE_R4=true ;; + -ts | --ts) TS=true ;; -papis | --papis) @@ -1573,6 +1585,11 @@ DEFINES="$DEFINES -DUSE_OMP_THREADING" fi +if test ! "x$USE_R4" = x ; then + echo " Turning on LET_RS_BE_REAL4 cpp flag" + DEFINES="$DEFINES -DLET_RS_BE_REAL4" +fi + if test ! "x$TS" = x ; then echo " Turning on timing per timestep" if test ! "x$FOOLAD" = x ; then @@ -1848,6 +1865,19 @@ EXECUTABLE=${EXECUTABLE:-mitgcmuv} +# Set Standard Code Directories: +if test "x$STANDARDDIRS" = xUSE_THE_DEFAULT ; then + STANDARDDIRS="eesupp model" +fi +# if model in Standard-Code-Dir, add eesupp (needed to compile model) +echo " $STANDARDDIRS " | grep ' model ' > /dev/null 2>&1 +ckM=$? +echo " $STANDARDDIRS " | grep ' eesupp ' > /dev/null 2>&1 +ckE=$? +if test $ckM = 0 -a $ckE = 1 ; then + STANDARDDIRS="$STANDARDDIRS eesupp" +fi + # We have a special set of source files in eesupp/src which are # generated from some template source files. We'll make them first so # they appear as regular source code @@ -1898,20 +1928,11 @@ echo " getting package dependency info from $PDEPEND" # Strip the comments and then convert the dependency file into # two arrays: PNAME, DNAME -cat $PDEPEND | sed -e 's/#.*$//g' \ - | $AWK 'BEGIN{nn=-1;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME_"nn"="$1"\nDNAME_"nn"="$i}} END{print "nname="nn}' \ - > ./.pd_tmp -RETVAL=$? -if test ! "x${RETVAL}" = x0 ; then - echo "Error: unable to parse package dependencies -- please check PDEPEND=\"$PDEPEND\"" - exit 1 -fi -. ./.pd_tmp -rm -f ./.pd_tmp +get_pdepend_list $PDEPEND # Search for default packages. Note that a "$ROOTDIR/pkg/pkg_groups" -# file should eventually be added so that, for convenience, one can -# specify groups of packages using names like "ocean" and "atmosphere". +# file has been added so that, for convenience, one can specify +# groups of packages using names like "ocean" and "atmosphere". echo " checking default package list: " if test "x${PDEFAULT}" = x ; then for i in "." $MODS ; do @@ -1942,14 +1963,15 @@ for i in $def ; do PACKAGES="$PACKAGES $i" done - echo " before group expansion packages are: $PACKAGES" + echo " before group expansion packages are:$PACKAGES" RET=1 while test $RET = 1 ; do expand_pkg_groups; RET=$?; done - echo " after group expansion packages are: $PACKAGES" + echo " after group expansion packages are: $PACKAGES" fi fi echo " applying DISABLE settings" +echo "" > ./.tmp_pack for i in $PACKAGES ; do echo $i >> ./.tmp_pack done @@ -1987,11 +2009,11 @@ PACKAGES="$PACKAGES $i" done rm -f ./.tmp_pack -echo " packages are: $PACKAGES" +echo " packages are: $PACKAGES" # Check for package MNC: if NetCDF is available, then build the MNC # template files ; otherwise, delete mnc from the list of packages. -echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1 +echo " $PACKAGES " | grep ' mnc ' > /dev/null 2>&1 RETVAL=$? if test "x$RETVAL" = x0 ; then if test "x$HAVE_NETCDF" != xt ; then @@ -2026,7 +2048,7 @@ # Check for package PROFILES: if NetCDF is not available, # then delete profiles from the list of available packages. -echo $PACKAGES | grep ' profiles ' > /dev/null 2>&1 +echo " $PACKAGES " | grep ' profiles ' > /dev/null 2>&1 RETVAL=$? if test "x$RETVAL" = x0 ; then if test "x$HAVE_NETCDF" != xt ; then @@ -2067,6 +2089,10 @@ pin="t" fi done + # or in the current $STANDARDDIRS list? + for p in $STANDARDDIRS ; do + if test "x$p" = "x$pname" ; then pin="t" ; fi + done # Is the DNAME entry a (+) or (-) rule ? tmp="dname=\"\$DNAME_$i\"" @@ -2119,7 +2145,7 @@ done ck=$ck"t" done -echo " packages are: $PACKAGES" +echo " packages are: $PACKAGES" for i in $PACKAGES ; do adr="$ROOTDIR/pkg/$i" if test -d $adr ; then @@ -2175,11 +2201,8 @@ done -echo " Adding STANDARDDIRS" +echo " Adding STANDARDDIRS='$STANDARDDIRS'" BUILDDIR=${BUILDDIR:-.} -if test "x$STANDARDDIRS" = xUSE_THE_DEFAULT ; then - STANDARDDIRS="eesupp model" -fi if test "x$STANDARDDIRS" != x ; then for d in $STANDARDDIRS ; do adr="$ROOTDIR/$d/src" @@ -2474,7 +2497,7 @@ done if test -f $MAKEFILE ; then - mv -f $MAKEFILE "$MAKEFILE.bak" + mv -f $MAKEFILE "$MAKEFILE.old" fi echo " Writing makefile: $MAKEFILE" echo "# Multithreaded + multi-processing makefile for:" > $MAKEFILE @@ -2493,7 +2516,7 @@ cat >>$MAKEFILE <> $MAKEFILE -# add definitions for preprocessed sources -# and note that not all systems allow case sensitive extensions -# hence the $FS and $FS90 here. -# for fixed format f90 files we use ff90 or FF90 resp +# add definitions for preprocessed sources +# and note that not all systems allow case sensitive extensions +# hence the $FS and $FS90 here. +# for fixed format f90 files we use ff90 or FF90 resp # but these are not expected to be the original source files echo 'F77_PP_SRC_FILES = $(F77_SRC_FILES:.F=.'$FS')' >> $MAKEFILE @@ -2643,7 +2666,8 @@ @make clean @make cleanlinks -rm -f \$(SPECIAL_FILES) - -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log f90mkdepend.log *.bak + -rm -f genmake_state genmake_*optfile genmake_warnings genmake_errors + -rm -f make.log run.log f90mkdepend.log *.bak "$MAKEFILE.old" -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log CLEAN: @make Clean @@ -2685,7 +2709,7 @@ decode_files.o : EMBEDDED_FILES.h -## \$(F77_PP_SRC_FILES) +## \$(F77_PP_SRC_FILES) all_fF.tar.gz : \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile @echo Creating \$@ ... -tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile