--- MITgcm/tools/genmake2 2010/12/26 01:04:45 1.218 +++ MITgcm/tools/genmake2 2013/07/21 23:21:36 1.251 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.218 2010/12/26 01:04:45 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.251 2013/07/21 23:21:36 jmc Exp $ # $Name: $ # # Makefile generator for MITgcm UV codes @@ -17,140 +17,139 @@ where [OPTIONS] can be: -help | --help | -h | --h - Print this help message and exit. + 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. + 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 - Use "NAME" as the optfile. By default, an attempt will be - made to find an appropriate "standard" optfile in the - tools/build_options/ directory. + Use "NAME" as the optfile. By default, an attempt will be + made to find an appropriate "standard" optfile in the + tools/build_options/ directory. -pdepend NAME | --pdepend NAME -pdepend=NAME | --pdepend=NAME - Get package dependency information from "NAME". + Get package dependency information from "NAME". -pgroups NAME | --pgroups NAME -pgroups=NAME | --pgroups=NAME - Get the package groups information from "NAME". + Get the package groups information from "NAME". -bash NAME - Explicitly specify the Bourne or BASH shell to use + 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 - many platforms, "gmake" is the preferred choice. + Use "NAME" for the MAKE program. The default is "make" but + many platforms, "gmake" is the preferred choice. -makefile NAME | -mf NAME --makefile=NAME | -mf=NAME - Call the makefile "NAME". The default is "Makefile". + Call the makefile "NAME". The default is "Makefile". -makedepend NAME | -md NAME --makedepend=NAME | -md=NAME - Use "NAME" for the MAKEDEPEND program. + Use "NAME" for the MAKEDEPEND program. -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME - Specify the location of the MITgcm ROOTDIR as "NAME". - By default, genamke will try to find the location by - looking in parent directories (up to the 5th parent). + Specify the location of the MITgcm ROOTDIR as "NAME". + By default, genamke will try to find the location by + looking in parent directories (up to the 5th parent). -mods NAME | --mods NAME | -mo NAME | --mo NAME -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME - Here, "NAME" specifies a list of directories that are - used for additional source code. Files found in the - "mods list" are given preference over files of the same - name found elsewhere. + Here, "NAME" specifies a list of directories that are + used for additional source code. Files found in the + "mods list" are given preference over files of the same + name found elsewhere. -disable NAME | --disable NAME -disable=NAME | --disable=NAME - Here "NAME" specifies a list of packages that we don't - want to use. If this violates package dependencies, - genamke will exit with an error message. + Here "NAME" specifies a list of packages that we don't + want to use. If this violates package dependencies, + genamke will exit with an error message. -enable NAME | --enable NAME -enable=NAME | --enable=NAME - Here "NAME" specifies a list of packages that we wish - to specifically enable. If this violates package - dependencies, genamke will exit with an error message. + Here "NAME" specifies a list of packages that we wish + to specifically enable. If this violates package + dependencies, genamke will exit with an error message. -standarddirs NAME | --standarddirs NAME -standarddirs=NAME | --standarddirs=NAME - Here, "NAME" specifies a list of directories to be - used as the "standard" code. + Here, "NAME" specifies a list of directories to be + used as the "standard" code. -fortran NAME | --fortran NAME | -fc NAME | --fc NAME -fc=NAME | --fc=NAME - Use "NAME" as the fortran compiler. By default, genmake - will search for a working compiler by trying a list of - "usual suspects" such as g77, f77, etc. + Use "NAME" as the fortran compiler. By default, genmake + will search for a working compiler by trying a list of + "usual suspects" such as g77, f77, etc. -cc NAME | --cc NAME | -cc=NAME | --cc=NAME - Use "NAME" as the C compiler. By default, genmake - 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 "NAME" as the C compiler. By default, genmake + will search for a working compiler by trying a list of + "usual suspects" such as gcc, c89, cc, etc. -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. + 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 - that the code that checks how long the model spends in - various routines will give junk values. + Ignore all the "wall clock" routines entirely. This will + not in any way hurt the model results -- it simply means + that the code that checks how long the model spends in + various routines will give junk values. -ts | --ts - Produce timing information per timestep + Produce timing information per timestep -papis | --papis - Produce summary MFlop/s (and IPC) with PAPI per timestep + Produce summary MFlop/s (and IPC) with PAPI per timestep -pcls | --pcls - Produce summary MFlop/s etc. with PCL per timestep + Produce summary MFlop/s etc. with PCL per timestep -foolad | --foolad - Fool the AD code generator + Fool the AD code generator -papi | --papi - Performance analysis with PAPI + Performance analysis with PAPI -pcl | --pcl - Performance analysis with PCL + Performance analysis with PCL -hpmt | --hpmt - Performance analysis with the HPM Toolkit + 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 + 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 + Include MPI header files and link to MPI libraries -mpi=PATH | --mpi=PATH - Include MPI header files and link to MPI libraries using MPI_ROOT - set to PATH. i.e. Include files from \$PATH/include, link to libraries - from \$PATH/lib and use binaries from \$PATH/bin. + Include MPI header files and link to MPI libraries using MPI_ROOT + set to PATH. i.e. Include files from \$PATH/include, link to libraries + from \$PATH/lib and use binaries from \$PATH/bin. -omp | --omp - Activate OpenMP code + use Compiler option OMPFLAG + Activate OpenMP code + use Compiler option OMPFLAG -omp=OMPFLAG | --omp=OMPFLAG - Activate OpenMP code + use Compiler option OMPFLAG + Activate OpenMP code + use Compiler option OMPFLAG -es | --es | -embed-source | --embed-source - Embed a tarball containing the full source code - (including the Makefile, etc.) used to build the - executable [off by default] + Embed a tarball containing the full source code + (including the Makefile, etc.) used to build the + executable [off by default] -ds | --ds - Report genmake internal variables status (DUMPSTATE) - to file "genmake_state" (for debug purpose) + Report genmake internal variables status (DUMPSTATE) + to file "genmake_state" (for debug purpose) While it is most often a single word, the "NAME" variables specified above can in many cases be a space-delimited string such as: @@ -175,28 +174,18 @@ test_for_package_in_cpp_options() { cpp_options=$1 pkg=$2 - test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg[ ]" - test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg[ ]" - test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg[ ]" - test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg[ ]" - test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg$" - test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg$" - test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg$" - test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg$" + test_for_string_in_file $cpp_options "^ *# *define *\" + test_for_string_in_file $cpp_options "^ *# *undef *\" + test_for_string_in_file $cpp_options "^ *# *define *\" + test_for_string_in_file $cpp_options "^ *# *undef *\" } # Search for particular CPP #cmds associated with MPI # usage: test_for_mpi_in_cpp_eeoptions CPP_file test_for_mpi_in_cpp_eeoptions() { cpp_options=$1 - test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI[ ]" - test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI[ ]" - test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI[ ]" - test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI[ ]" - test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI$" - test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI$" - test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI$" - test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI$" + test_for_string_in_file $cpp_options "^ *# *define *\" + test_for_string_in_file $cpp_options "^ *# *undef *\" } # Search for particular string in a file. Return 1 if detected, 0 if not @@ -204,11 +193,11 @@ test_for_string_in_file() { file=$1 strng=$2 - grep -i "$strng" $file > /dev/null 2>&1 + grep "$strng" $file > /dev/null 2>&1 RETVAL=$? if test "x${RETVAL}" = x0 ; then printf "Error: In $file there is an illegal line: " - grep -i "$strng" $file + grep -i "$strng" $file exit 99 fi return 0 @@ -298,7 +287,7 @@ .F.$tfs: $LN \$< \$@ EOF - $MAKE "genmake_hello."$tfs > /dev/null 2>&1 + $MAKE -f $MAKEFILE "genmake_hello."$tfs > /dev/null 2>&1 RETVAL=$? if test "x$RETVAL" != x0 -o ! -f "genmake_hello."$tfs ; then if test "x$FS" = x ; then @@ -306,13 +295,12 @@ FS90='fr9' check_for_broken_Ff else - cat <&1 -ERROR: Your file system cannot distinguish between *.F and *.f files - (fails the "make/ln" test) and this program cannot find a suitable - replacement extension. Please try a different build environment or - contact the list for help. - -EOF + echo "ERROR: test: '$MAKE -f $MAKEFILE genmake_hello.$tfs' Failed" + echo " see simple makefile: '$MAKEFILE' (left here)" + echo " Please check (1) your '$MAKE' command, (2) your '$LN' command" + echo " and (3) the allowed sufix '.F' and '.$tfs' in makefile" + echo " or contact the list for help." + echo "" exit -1 return fi @@ -336,15 +324,14 @@ # # 1) a makedepend implementation shipped with the cyrus-imapd # package: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ - # - # 2) a known-buggy xmakedpend shell script + # 2) a local tools/xmakedepend shell script # # So the choices are, in order: - # # 1) use the user-specified program - # 2) use a system-wide default - # 3) locally build and use the cyrus implementation - # 4) fall back to the buggy local xmakedpend script + # 2) use the local xmakedepend script (get all dependencies, but slower) + # 3) use a system-wide default + # 4) locally build and use the cyrus makedepend + # (faster, but can miss some dependencies) # echo >> $LOGFILE echo "running: look_for_makedepend()" >> $LOGFILE @@ -355,16 +342,19 @@ build_cyrus_makedepend RETVAL=$? if test "x$RETVAL" != x0 ; then - echo "WARNING: unable to build cyrus-makedepend. Try 'makedepend'" + echo "WARNING: unable to build cyrus-makedepend. Try other '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=$? test -f $MAKEFILE && mv -f $MAKEFILE $MAKEFILE".tst" # echo 'MAKEFILE="'$MAKEFILE'"' cat <> $MAKEFILE @@ -380,22 +370,39 @@ stop end EOF - makedepend genmake_tc.f > /dev/null 2>&1 + $ROOTDIR/tools/xmakedepend -f $MAKEFILE genmake_tc.f > /dev/null 2>&1 RV1=$? + which makedepend > /dev/null 2>&1 + RV2=$? + if test "x${RV2}" = x0 ; then + makedepend -f $MAKEFILE genmake_tc.f > /dev/null 2>&1 + RV3=$? ; loc_msg='not working.' + else RV3=$RV2 ; loc_msg='not found.' + fi test -f $MAKEFILE && rm -f $MAKEFILE test -f $MAKEFILE".tst" && mv -f $MAKEFILE".tst" $MAKEFILE - if test "x${RV0}${RV1}" = x00 ; then + echo " check makedepend (local: $RV1, system: $RV2, $RV3)" + if test "x${RV1}" = x0 ; then + MAKEDEPEND='$(TOOLSDIR)/xmakedepend' + echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE + elif test "x${RV3}" = x0 ; then + echo " local tools/xmakedepend not working. Use system-default makedepend" MAKEDEPEND=makedepend echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE else - echo " system-default makedepend not found. Try to build cyrus-makedepend" + echo " local tools/xmakedepend not working; system-default makedepend $loc_msg" + echo -n " 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 + if test "x$RETVAL" = x0 ; then + echo " Works" + else + echo " Fails" ; echo "" >> $LOGFILE + echo "ERROR: no working makedepend found ; look_for_makedepend FAILED" | tee -a $LOGFILE + echo "" + exit -1 + return fi fi fi @@ -408,7 +415,7 @@ ( cd $ROOTDIR/tools/cyrus-imapd-makedepend \ && ./configure > /dev/null 2>&1 \ - && make > /dev/null 2>&1 + && $MAKE > /dev/null 2>&1 if test -x ./makedepend.exe ; then $LN ./makedepend.exe ./makedepend fi @@ -432,13 +439,13 @@ { printf " building the embed-encode utility... " if test ! -e "$ROOTDIR/tools/embed_encode/encode_files" ; then - if test ! -d "$ROOTDIR/tools/embed_encode" ; then - echo - echo " Error: can't locate \"$ROOTDIR/tools/embed_encode\"" - echo - EMBED_SRC=f + if test ! -d "$ROOTDIR/tools/embed_encode" ; then + echo + echo " Error: can't locate \"$ROOTDIR/tools/embed_encode\"" + echo + EMBED_SRC=f return 1 - fi + fi clist="cc gcc c89 $CC" for ic in $clist ; do comm="$ic -o encode_files encode_files.c" @@ -446,7 +453,6 @@ RETVAL=$? if test "x$RETVAL" = x0 ; then echo "OK" - DEFINES="$DEFINES -DHAVE_EMBED_SRC" return 0 fi done @@ -458,7 +464,6 @@ return 1 fi echo "OK" - DEFINES="$DEFINES -DHAVE_EMBED_SRC" } # look for possible C compilers @@ -576,8 +581,8 @@ if test "x$OPTFILE" = x ; then OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$FC if test ! -r $OPTFILE ; then - echo " I looked for the file "$OPTFILE" but did not find it" - fi + echo " I looked for the file "$OPTFILE" but did not find it" + fi fi if test "x$OPTFILE" = x ; then @@ -595,35 +600,61 @@ EOF exit 1 fi +} -# # look for possible MPI libraries -# mpi_libs= -# mpi_fort=`which mpif77 2>/dev/null` -# RETVAL=$? -# if test "x${RETVAL}" = x0 ; then -# cat >>test.f < out" -# RETVAL=$? -# if test "x${RETVAL}" = x0 ; then -# a=`cat out` -# for i in $a ; do -# case $i in -# -*) -# mpi_libs="$mpi_libs $i" ;; -# esac -# done -# echo "The MPI libs appear to be:" -# echo " "$mpi_libs -# fi -# rm -f test.f out -# fi +# Do a local copy of MPI headers files (in local dir ./mpi_headers/) after +# checking for additional included headers (in case of chain of included header) +mpi_headers_do_local_copy() { + + dBug=0 + #----- check for additional headers (chain of included headers) + listIni=$MPI_HEADER_FILES + echo $listIni | grep "\" > /dev/null 2>&1 + outp=$? + #- always check mpif.h (the only mpi-header included in standard MITgcm code) + if test $outp != 0 ; then listIni="mpif.h $listIni" ; fi + if test $dBug = 1 ; then echo "listIni='$listIni'" ; fi + doCheck=1 ; list2copy='' ; list2check=$listIni + while test $doCheck = 1 ; do + newList='' + for i in $list2check ; do + if test -f $MPIINCLUDEDIR/$i ; then + newInc=`grep '^ *include ' $MPIINCLUDEDIR/$i | \ + sed -e 's/^ *include //' -e 's/\!.*$//' -e "s/'//g" -e 's/\"//g'` + if test $dBug = 1 ; then echo -n "checking $i : newInc='$newInc'" ; fi + for j in $newInc ; do + echo $listIni $list2copy $newList | grep "\<$j\>" > /dev/null 2>&1 + outp=$? + if test $outp != 0 ; then + if test $dBug = 1 ; then echo -n " ; adding $j" ; fi + newList="$newList $j" + fi + done + if test $dBug = 1 ; then echo "" ; fi + fi + done + if test "x$newList" = x ; then doCheck=0 + else list2check=$newList ; list2copy="$list2copy $newList" + fi + done + list2copy="$MPI_HEADER_FILES $list2copy" + if test $dBug = 1 ; then echo "list2copy='$list2copy'" ; fi + #----- make local copy and update LOCAL_MPI_HEADERS (if not already set) + mkListInc=0 + for i in $list2copy ; do + if test -f $MPIINCLUDEDIR/$i ; then + cp -p $MPIINCLUDEDIR/$i ./mpi_headers + if test $i = 'mpif.h' ; then + perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h + fi + if test $mkListInc = 1 ; then + LOCAL_MPI_HEADERS="$LOCAL_MPI_HEADERS ./mpi_headers/$i" + fi + if test "x$LOCAL_MPI_HEADERS" = x ; then + LOCAL_MPI_HEADERS="./mpi_headers/$i" ; mkListInc=1 + fi + fi + done } # Parse the package dependency information @@ -648,7 +679,7 @@ #echo "FC_NAMEMANGLE = \"$FC_NAMEMANGLE\"" if test ! "x$FC_NAMEMANGLE" = x ; then - return 0 + return 0 fi echo " running: get_fortran_c_namemangling()" >> $LOGFILE @@ -780,7 +811,6 @@ RETVAL=$? if test "x$RETVAL" = x0 ; then HAVE_CLOC=t - DEFINES="$DEFINES -DHAVE_CLOC" fi rm -f genmake_tc* echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE @@ -842,17 +872,12 @@ RETVAL=$? if test "x$RETVAL" = x0 ; then HAVE_SIGREG=t - DEFINES="$DEFINES -DHAVE_SIGREG" fi rm -f genmake_tc* echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE } check_HAVE_SETRLSTK() { - if test "x$HAVE_SETRLSTK" = xt ; then - DEFINES="$DEFINES -DHAVE_SETRLSTK" - return - fi if test ! "x$HAVE_SETRLSTK" = x ; then return fi @@ -890,7 +915,6 @@ RETVAL=$? if test "x$RETVAL" = x0 ; then HAVE_SETRLSTK=t - DEFINES="$DEFINES -DHAVE_SETRLSTK" fi rm -f genmake_tc* echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE @@ -937,7 +961,6 @@ RETVAL=$? if test "x$RETVAL" = x0 ; then HAVE_STAT=t - DEFINES="$DEFINES -DHAVE_STAT" fi rm -f genmake_tc* echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE @@ -953,9 +976,9 @@ program fgennc #include "netcdf.inc" EOF - if test ! "x$MPI" = x ; then - echo '#include "mpif.h"' >> genmake_tnc.F - fi + #if test ! "x$MPI" = x ; then + # echo '#include "mpif.h"' >> genmake_tnc.F + #fi cat <> genmake_tnc.F integer iret, ncid, xid iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid) @@ -1035,6 +1058,148 @@ echo " --> set HAVE_NETCDF='$HAVE_NETCDF'" >> $LOGFILE } +check_lapack_libs() { + if test ! "x$SKIP_LAPACK_CHECK" = x ; then + return + fi + echo >> $LOGFILE + echo "running: check_lapack_libs()" >> $LOGFILE + cat < genmake_tla.F + program fgenla + integer info + integer ipiv( 2 ) + double precision ab( 4, 2 ), b( 2 ) + data ab / 0., 0., 1., 2., 0., 2., 1., 0. / + data b / 1., 1. / + call dgbsv( 2, 1, 1, 1, ab, 4, ipiv, b, 2, info ) + IF (info .NE. 0) write(*,*) 'Error:', info + write(*,*) b + end +EOF + echo "=== genmake_tla.F >>>" > genmake_tla.log + cat genmake_tla.F >> genmake_tla.log + echo "<<< genmake_tla.F ===" >> genmake_tla.log + RET_CPP=f + COMM="cat genmake_tla.F | $CPP $DEFINES $INCLUDES" + echo "$COMM" >> genmake_tla.log + eval $COMM > genmake_tla.$FS 2>/dev/null && RET_CPP=t + if test "x$RET_CPP" = xf ; then + echo " WARNING: CPP failed to pre-process the lapack test." \ + >> genmake_tla.log + echo " Please check that \$INCLUDES is properly set." \ + >> genmake_tla.log + fi + echo "$FC $FFLAGS $FOPTIM -c genmake_tla.$FS \ " >> genmake_tla.log + echo " && $LINK $FFLAGS $FOPTIM -o genmake_tla.o $LIBS" >> genmake_tla.log + $FC $FFLAGS $FOPTIM -c genmake_tla.$FS >> genmake_tla.log 2>&1 \ + && $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS >> genmake_tla.log 2>&1 + RET_COMPILE=$? + cat genmake_tla.log >> $LOGFILE + + # test program execution not always possible (see check_netcdf_libs) + # + #test -x ./genmake_tla && ./genmake_tla >> genmake_tla.log 2>&1 + #RETVAL=$? + #if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then + + if test "x$RET_COMPILE" = x0 ; then + HAVE_LAPACK=t + echo "check_lapack: successful" >> $LOGFILE + else + # try again with "-llapack" added to the libs + echo "==> try again with added '-llapack'" > genmake_tla.log + echo "cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS \ " >> genmake_tla.log + echo " && $FC $FFLAGS $FOPTIM -c genmake_tla.$FS \ " >> genmake_tla.log + echo " && $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack" >> genmake_tla.log + cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS 2>/dev/null \ + && $FC $FFLAGS $FOPTIM -c genmake_tla.$FS >> genmake_tla.log 2>&1 \ + && $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack >> genmake_tla.log 2>&1 + RET_COMPILE=$? + echo >> $LOGFILE + cat genmake_tla.log >> $LOGFILE + if test "x$RET_COMPILE" = x0 ; then + LIBS="$LIBS -llapack" + HAVE_LAPACK=t + echo "check_lapack: successful" >> $LOGFILE + else + # try again with "-lf77blas -lcblas" added to the libs + echo "==> try again with added '-llapack -lf77blas -lcblas'" > genmake_tla.log + echo "cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS \ " >> genmake_tla.log + echo " && $FC $FFLAGS $FOPTIM -c genmake_tla.$FS \ " >> genmake_tla.log + echo " && $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack -lf77blas -lcblas" >> genmake_tla.log + cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS 2>/dev/null \ + && $FC $FFLAGS $FOPTIM -c genmake_tla.$FS >> genmake_tla.log 2>&1 \ + && $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack -lf77blas -lcblas >> genmake_tla.log 2>&1 + RET_COMPILE=$? + echo >> $LOGFILE + cat genmake_tla.log >> $LOGFILE + if test "x$RET_COMPILE" = x0 ; then + LIBS="$LIBS -llapack -lf77blas -lcblas" + HAVE_LAPACK=t + echo "check_lapack: successful" >> $LOGFILE + else + # try again with "-latlas" added to the libs + echo "==> try again with added '-llapack -lf77blas -lcblas -latlas'" > genmake_tla.log + echo "cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS \ " >> genmake_tla.log + echo " && $FC $FFLAGS $FOPTIM -c genmake_tla.$FS \ " >> genmake_tla.log + echo " && $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack -lf77blas -lcblas -latlas" >> genmake_tla.log + cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS 2>/dev/null \ + && $FC $FFLAGS $FOPTIM -c genmake_tla.$FS >> genmake_tla.log 2>&1 \ + && $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack -lf77blas -lcblas -latlas >> genmake_tla.log 2>&1 + RET_COMPILE=$? + echo >> $LOGFILE + cat genmake_tla.log >> $LOGFILE + if test "x$RET_COMPILE" = x0 ; then + LIBS="$LIBS -llapack -lf77blas -lcblas -latlas" + HAVE_LAPACK=t + echo "check_lapack: successful" >> $LOGFILE + fi + fi + fi + fi + rm -f genmake_tla* + echo " --> set HAVE_LAPACK='$HAVE_LAPACK'" >> $LOGFILE +} + +check_HAVE_FLUSH() { + if test ! "x$SKIP_CHECK_FLUSH" = x ; then + return + fi + echo >> $LOGFILE + echo "running: check_HAVE_FLUSH()" >> $LOGFILE + cat < genmake_tflsh.$FS + program fgenflsh + integer iounit + character*9 fname + iounit = 26 + fname = 'tmp.tflsh' + open(iounit,FILE=fname,STATUS='unknown') + write(iounit,*) 'genmake_tflsh: hello' + call flush(iounit) + close(iounit) + end +EOF + echo "=== genmake_tflsh.$FS >>>" > genmake_tflsh.log + cat genmake_tflsh.$FS >> genmake_tflsh.log + echo "<<< genmake_tflsh.$FS ===" >> genmake_tflsh.log + + echo "$FC $FFLAGS $FOPTIM -c genmake_tflsh.$FS \ " >> genmake_tflsh.log + echo " && $LINK $FFLAGS $FOPTIM -o genmake_tflsh.o $LIBS" >> genmake_tflsh.log + $FC $FFLAGS $FOPTIM -c genmake_tflsh.$FS >> genmake_tflsh.log 2>&1 \ + && $LINK $FFLAGS $FOPTIM -o genmake_tflsh genmake_tflsh.o $LIBS >> genmake_tflsh.log 2>&1 + RET_COMPILE=$? + + if test "x$RET_COMPILE" = x0 ; then + HAVE_FLUSH=t + #cat genmake_tflsh.log >> $LOGFILE + echo " check_HAVE_FLUSH: successful" >> $LOGFILE + else + HAVE_FLUSH=f + cat genmake_tflsh.log >> $LOGFILE + fi + rm -f genmake_tflsh* + echo " --> set HAVE_FLUSH='$HAVE_FLUSH'" >> $LOGFILE +} ############################################################################### # Sequential part of script starts here @@ -1092,6 +1257,9 @@ DEVEL= HAVE_TEST_L= +# comment this line out to enable lapack test +SKIP_LAPACK_CHECK=t + # DEFINES checked by test compilation or command-line HAVE_SYSTEM= HAVE_FDATE= @@ -1102,6 +1270,8 @@ HAVE_NETCDF= HAVE_ETIME= IGNORE_TIME= +HAVE_LAPACK= +HAVE_FLUSH= MODS= TOOLSDIR= @@ -1109,6 +1279,9 @@ INCLUDEDIRS= STANDARDDIRS="USE_THE_DEFAULT" +#- local config file +gm_local="genmake_local" + G2ARGS= BASH= PWD=`pwd` @@ -1124,7 +1297,6 @@ EXECUTABLE= EXEHOOK= EXEDIR= -PACKAGES_CONF= IEEE= if test "x$MITGCM_IEEE" != x ; then IEEE=$MITGCM_IEEE @@ -1145,23 +1317,29 @@ SVD_TAMC_FLAGS= TAMC_EXTRA= +DIVA= +MPIINCLUDEDIR= +MPI_HEADER_FILES= +LOCAL_MPI_HEADERS= + # 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_s1="ROOTDIR STANDARDDIRS MODS PKG_DEPEND PKG_GROUPS DISABLE ENABLE" +gm_s2="PLATFORM OPTFILE MAKE MAKEFILE MAKEDEPEND FC CC MPI OMP USE_R4" +gm_s3="FEXTRAFLAGS IEEE DEVEL GSL TS PAPIS PCLS PAPI PCL HPMT DUMPSTATE" # The following state is not directly set by command-line switches -gm_s3="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM FEXTRAFLAGS" -gm_s4="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS" -gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD THISHOST THISUSER THISDATE THISVER MACHINE" -gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" -gm_s7="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME" +gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM" +gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS" +gm_s6="PWD TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK" +gm_s7="THISHOST THISUSER THISDATE THISVER MACHINE FC_NAMEMANGLE" +gm_s8="HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME HAVE_LAPACK HAVE_FLUSH" # 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" gm_s11="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS" -gm_s12="TAF_EXTRA TAMC_EXTRA" +gm_s12="TAF_EXTRA TAMC_EXTRA DIVA MPIINCLUDEDIR MPI_HEADER_FILES" -gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7" +gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7 $gm_s8" gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12" cat <> $LOGFILE - $FC $GET_FC_VERSION >> $LOGFILE 2>&1 + ff=`echo $FC | sed 's/ .*//'` ; xx=`echo $ff | sed 's/^./& /' | sed 's/ .*//'` + if test $xx != '/' ; then which $ff >> $LOGFILE ; fi + $FC $GET_FC_VERSION > genmake_fc_vers1 2> genmake_fc_vers2 + if test -s genmake_fc_vers1 ; then + cat genmake_fc_vers1 >> $LOGFILE + else + cat genmake_fc_vers2 >> $LOGFILE + fi echo "<-- compiler version ----" >> $LOGFILE + rm -f genmake_fc_vers1 genmake_fc_vers2 fi if test "x$CC" = x ; then @@ -1588,7 +1775,9 @@ if test ! "x$MPI" = x ; then echo " Turning on MPI cpp macros" - DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI" + DEFINES="$DEFINES -DALLOW_USE_MPI" +#- To compile code older than checkpoint63s (2012/09/05), un-comment the following line: +# DEFINES="$DEFINES -DALWAYS_USE_MPI" fi if test ! "x$OMP" = x ; then echo " Add OMPFLAG and turn on OpenMP cpp macros" @@ -1605,7 +1794,7 @@ if test ! "x$TS" = x ; then echo " Turning on timing per timestep" if test ! "x$FOOLAD" = x ; then - DEFINES="$DEFINES -DTIME_PER_TIMESTEP_SFP" + DEFINES="$DEFINES -DTIME_PER_TIMESTEP_SFP" else DEFINES="$DEFINES -DTIME_PER_TIMESTEP" fi @@ -1641,7 +1830,7 @@ echo " Sticking with PAPI flop summary per timestep!" else echo " Turning on performance analysis with PAPI" - echo " Please make sure PAPIINC, PAPILIB are defined" + echo " Please make sure PAPIINC, PAPILIB are defined" DEFINES="$DEFINES -DUSE_PAPI" INCLUDES="$INCLUDES $PAPIINC" LIBS="$LIBS $PAPILIB" @@ -1653,7 +1842,7 @@ echo " Sticking with PCL flop summary per timestep!" else echo " Turning on performance analysis with PCL" - echo " Please make sure PCLINC, PCLLIB are defined" + echo " Please make sure PCLINC, PCLLIB are defined" DEFINES="$DEFINES -DUSE_PCL" INCLUDES="$INCLUDES $PCLINC" LIBS="$LIBS $PCLLIB" @@ -1663,16 +1852,17 @@ if test ! "x$PAPI" = x ; then echo " PAPI and the HPM Toolkit cannot co-exist!" echo " Sticking with PAPI!" - else if test ! "x$PCL" = x ; then + else + if test ! "x$PCL" = x ; then echo " PCL and the HPM Toolkit cannot co-exist!" echo " Sticking with PCL!" - else + else echo " Turning on performance analysis with the HPM Toolkit" - echo " Please make sure HPMTINC, HPMTLIB are defined" + echo " Please make sure HPMTINC, HPMTLIB are defined" DEFINES="$DEFINES -DUSE_LIBHPM" - INCLUDES="$INCLUDES $HPMTINC" + INCLUDES="$INCLUDES $HPMTINC" LIBS="$LIBS $HPMTLIB" - fi + fi fi fi if test ! "x$GSL" = x ; then @@ -1753,6 +1943,7 @@ printf " Can we call simple C routines (here, \"cloc()\") using $FC... " check_HAVE_CLOC if test "x$HAVE_CLOC" != x ; then + DEFINES="$DEFINES -DHAVE_CLOC" echo "yes" else echo "no" @@ -1767,6 +1958,7 @@ printf " Can we unlimit the stack size using $FC... " check_HAVE_SETRLSTK if test "x$HAVE_SETRLSTK" = xt ; then + DEFINES="$DEFINES -DHAVE_SETRLSTK" echo "yes" else echo "no" @@ -1776,6 +1968,7 @@ printf " Can we register a signal handler using $FC... " check_HAVE_SIGREG if test "x$HAVE_SIGREG" = xt ; then + DEFINES="$DEFINES -DHAVE_SIGREG" echo "yes" else echo "no" @@ -1785,6 +1978,7 @@ printf " Can we use stat() through C calls... " check_HAVE_STAT if test "x$HAVE_STAT" != x ; then + DEFINES="$DEFINES -DHAVE_STAT" echo "yes" else echo "no" @@ -1794,17 +1988,37 @@ printf " Can we create NetCDF-enabled binaries... " check_netcdf_libs if test "x$HAVE_NETCDF" != x ; then + DEFINES="$DEFINES -DHAVE_NETCDF" + echo "yes" +else + echo "no" +fi + +printf " Can we create LAPACK-enabled binaries... " +check_lapack_libs +if test "x$HAVE_LAPACK" != x ; then + DEFINES="$DEFINES -DHAVE_LAPACK" echo "yes" else echo "no" fi -DEFINES="$DEFINES $IGNORE_TIME" +printf " Can we call FLUSH intrinsic subroutine... " +check_HAVE_FLUSH +if test "x$HAVE_FLUSH" = xt ; then + DEFINES="$DEFINES -DHAVE_FLUSH" + echo "yes" +else + echo "no" +fi + +DEFINES="$DEFINES $IGNORE_TIME" if test "x$EMBED_SRC" = xt ; then build_embed_encode fi if test "x$EMBED_SRC" = xt ; then ENABLE="$ENABLE embed_files" +# DEFINES="$DEFINES -DHAVE_EMBED_SRC" fi printf "\n=== Setting defaults ===\n" @@ -1982,7 +2196,7 @@ exit 1 else echo " using PKG_LIST=\"$PKG_LIST\"" - # Strip the comments and add all the names + # Strip the comments and add all the names pkg_list=`cat $PKG_LIST | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'` RETVAL=$? if test "x${RETVAL}" != x0 ; then @@ -2032,7 +2246,7 @@ j=`echo $i | sed 's/[-+]//'` if test ! -d "$ROOTDIR/pkg/$j" ; then echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'" - exit 1 + exit 1 fi echo $i >> ./.tmp_pack done @@ -2077,7 +2291,7 @@ echo "Error: problem encountered while building source files in pkg/mnc:" cat make_mnc.errors 1>&2 if test "x$mnc_in" = x0 ; then - exit 1 + exit 1 else DISABLE="$DISABLE mnc" fi @@ -2110,6 +2324,27 @@ fi fi +# Check for package RADTRANS: if LAPACK is not available, +# then issue a warning that the direct radtrans solver is not available. +if test "x$HAVE_LAPACK" != xt ; then + echo " $PACKAGES " | grep ' radtrans ' > /dev/null 2>&1 + RETVAL=$? + if test "x$RETVAL" = x0 ; then + cat < cannot create pseudo-MPI include directory" # exit -1 fi + fi fi echo " Determining the list of source and include files" @@ -2375,6 +2604,11 @@ OAD_DONT_TRANSFORM="/dev/null" OAD_KEEP_ORIGINAL="/dev/null" OAD_CB2M_FILES="/dev/null" + OADTOOLS="$TOOLSDIR/OAD_support" + test -f "oadtempflile" && \rm -f "oadtempflile" +cat >> "oadtempflile" <> hsrclist.tmp printf " $sf" >> hsrclist.tmp ;; - flow) + flow) echo " \\" >> ad_flow_files.tmp printf " $sf" >> ad_flow_files.tmp ;; @@ -2514,7 +2748,7 @@ done if test "x$deplist" != x ; then if test "$d" != "." ; then - echo "" >> srclinks.tmp + echo "" >> srclinks.tmp echo "# These files are linked from $d" >> srclinks.tmp echo "$deplist :" >> srclinks.tmp # We need to make sure that the link isn't already there. @@ -2535,7 +2769,7 @@ CMDLINE=$0 for xx in "$@" ; do nw=`echo $xx | wc -w` if test $nw = '1' ; then CMDLINE="$CMDLINE $xx" - else CMDLINE="$CMDLINE '$xx'" ; fi + else CMDLINE="$CMDLINE '$xx'" ; fi done if test -f $MAKEFILE ; then @@ -2569,8 +2803,6 @@ # INCLUDES : Directories searched for header files # DEFINES : Macro definitions for CPP # MAKEDEPEND : Dependency generator -# KPP : Special preprocessor command (specific to platform) -# KFLAGS : Flags for KPP # FC : Fortran compiler command # FFLAGS : Configuration/debugging options for FC # FOPTIM : Optimization options for FC @@ -2584,6 +2816,7 @@ EXEDIR = ${EXEDIR} EXECUTABLE = \$(EXEDIR)/${EXECUTABLE} TOOLSDIR = ${TOOLSDIR} +OADTOOLS = ${OADTOOLS} #eh3 new defines for the adjoint work AUTODIFF = ${ROOTDIR}/pkg/autodiff @@ -2604,11 +2837,12 @@ echo "EMBEDDED_FILES = " >>$MAKEFILE fi +# extract default cpp search path so we can pass it to makedepend +CPPINCLUDES=`cat /dev/null | $CPP -v 2>&1 | awk '/^End of search/{f=0}!/^\#/{if(f){printf " -I%s", $1;}}/^\#include "..." search start/{f=1}'` + cat >>$MAKEFILE <> $MAKEFILE echo 'F90_PP_SRC_FILES = $(F90_SRC_FILES:.F90=.'$FS90')' >> $MAKEFILE echo 'OBJFILES= $(F77_SRC_FILES:.F=.o) $(C_SRC_FILES:.c=.o) $(F90_SRC_FILES:.F90=.o)' >> $MAKEFILE -echo 'FLOFILES = $(AD_FLOW_FILES:.flow=.flowdir)' >> $MAKEFILE +echo 'FLOWFILES = $(AD_FLOW_FILES:.flow=.flowdir)' >> $MAKEFILE echo >> $MAKEFILE echo '.SUFFIXES:' >> $MAKEFILE echo '.SUFFIXES: .o .'$FS' .p .F .c .f'$FS90' .'$FS90' .FF90 .F90 .flowdir .flow' >> $MAKEFILE cat >>$MAKEFILE < ad_config.template + @cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h + @-rm -f ad_config.template + \$(MAKE) -f \$(MAKEFILE) \$(EXECUTABLE) + \$(EXECUTABLE): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(OBJFILES) \$(EMBEDDED_FILES) @echo Creating \$@ ... \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) + depend: - @make links - \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES) + @\$(MAKE) -f \$(MAKEFILE) links + \$(MAKEDEPEND) -f \$(MAKEFILE) -o .$FS \$(DEFINES) \$(INCLUDES) \$(CPPINCLUDES) \$(F77_SRC_FILES) \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) -rm -f makedepend.out @@ -2691,6 +2937,8 @@ ar rcv libmitgcmuv.a \$(OBJFILES) ar d libmitgcmuv.a main.o +obj: \$(OBJFILES) + links: \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(SPECIAL_FILES) small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES) @@ -2708,24 +2956,25 @@ # remove most of the files that "make" and "make depend" generate Clean: - @make clean - @make cleanlinks + @\$(MAKE) -f \$(MAKEFILE) clean + @\$(MAKE) -f \$(MAKEFILE) cleanlinks -rm -f \$(SPECIAL_FILES) f90mkdepend.log $MAKEFILE.old - -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log - -rm -f genmake_warnings genmake_errors make.log + -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log taf_ftl.log # remove also the executable, files that "genmake2" generates (except Makefile) # and output from a run (plus log files from testreport) CLEAN: - @make Clean - -rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak - -rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log + @\$(MAKE) -f \$(MAKEFILE) Clean + -rm -f \$(EXECUTABLE) \$(EXE_AD) \$(EXE_FTL) *.bak + -rm -f $LOGFILE genmake_state genmake_*optfile + -rm -f SIZE.h.mpi genmake.tr_log make.tr_log + -rm -rf mpi_headers mnc_test_* -find \$(EXEDIR) -name "*.meta" -exec rm {} \; -find \$(EXEDIR) -name "*.data" -exec rm {} \; -find \$(EXEDIR) -name "fort.*" -exec rm {} \; -rm -f *.txt STD* *diagnostics.log datetime - -rm -f *_MIT_CE_000.opt0000 costfunction*0000 - -rm -rf mnc_test_* + -rm -f *_MIT_CE_000.opt0000 costfunction*0000 costfinal + -rm -f divided.ctrl snapshot* oad_cp.000.[0-9][0-9][0-9][0-9][0-9] makefile: $THIS_SCRIPT $G2ARGS @@ -2735,10 +2984,10 @@ # Special targets (SPECIAL_FILES) which are created by make ${PACKAGES_DOT_H}: @echo Creating \$@ ... - @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@ + @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@ AD_CONFIG.h: @echo Creating \$@ ... - @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@ + @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Default version" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > \$@ FC_NAMEMANGLE.h: @echo Creating \$@ ... echo "$FC_NAMEMANGLE" > \$@ @@ -2778,16 +3027,19 @@ ## This nullifies any default implicit rules concerning these two file types: ## %.o : %.F +# C preprocessing and replacing the _d in constants: +CPPCMD = cat \$< | ${CPP} \$(DEFINES) \$(INCLUDES) | ${S64} + .F.$FS: - \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ + \$(CPPCMD) > \$@ .$FS.o: \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< .F.o: \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< .F90.$FS90: - \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ + \$(CPPCMD) > \$@ .FF90.f$FS90: - \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ + \$(CPPCMD) > \$@ .$FS90.o: \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< .f$FS90.o: @@ -2796,11 +3048,11 @@ .c.o: \$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$< .flow.flowdir: - \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ + \$(CPPCMD) > \$@ # Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain .F.p: - \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ + \$(CPPCMD) > \$@ .p.$FS: \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< @@ -2819,6 +3071,7 @@ TAF_EXTRA = ${TAF_EXTRA} TAMC_EXTRA = ${TAMC_EXTRA} +LOCAL_MPI_HEADERS = ${LOCAL_MPI_HEADERS} EOF @@ -2847,17 +3100,24 @@ cat >>$MAKEFILE < ad_config.template +ad_exe_target: + @echo Update AD_CONFIG.h and make \$(EXE_AD) + @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Adjoint version" -bAD_CONFIG_H -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > ad_config.template + @cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h + @-rm -f ad_config.template + \$(MAKE) -f \$(MAKEFILE) \$(EXE_AD) + +ad_input_code.$FS: \$(AD_FILES) \$(AD_FLOW_FILES) + @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Adjoint version" -bAD_CONFIG_H -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > ad_config.template cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h - -rm -f ad_config.template - @make \$(F77_PP_SRC_FILES) - @make \$(FLOFILES) - cat \$(FLOFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS + @-rm -f ad_config.template + @\$(MAKE) -f \$(MAKEFILE) \$(F77_PP_SRC_FILES) + @\$(MAKE) -f \$(MAKEFILE) \$(FLOWFILES) + cat \$(FLOWFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS ad_taf_output.$FS: ad_input_code.$FS \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS @@ -2869,7 +3129,7 @@ ls -l ad_input_code_ad.$FS cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS -\${EXE_AD}: ad_taf_output.o \$(OBJFILES) +\$(EXE_AD): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) ad_taf_output.o \$(OBJFILES) \$(EMBEDDED_FILES) \$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) ad_tamc_output.$FS: ad_input_code.$FS @@ -2885,18 +3145,27 @@ adtrick: patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff +adobj: ad_taf_output.o \$(OBJFILES) + # ... FTL ... -ftlall: ftl_taf +ftlall: ftl_exe_target ftltaf: ftl_taf_output.$FS ftltamc: ftl_tamc_output.$FS -ftl_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES) - @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template - cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h - -rm -f ftl_config.template - @make \$(F77_PP_SRC_FILES) - @make \$(AD_FLOW_FILES) - cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS +ftl_exe_target: + @echo Update AD_CONFIG.h and make \$(EXE_FTL) + @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "TangLin version" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN > ad_config.template + @cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h + @-rm -f ad_config.template + \$(MAKE) -f \$(MAKEFILE) \$(EXE_FTL) + +ftl_input_code.$FS: \$(AD_FILES) + @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "TangLin version" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN > ad_config.template + cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h + @-rm -f ad_config.template + @\$(MAKE) -f \$(MAKEFILE) \$(F77_PP_SRC_FILES) + @\$(MAKE) -f \$(MAKEFILE) \$(AD_FLOW_FILES) + cat \$(AD_FLOW_FILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ftl_input_code.$FS ftl_taf_output.$FS: ftl_input_code.$FS \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS @@ -2908,8 +3177,8 @@ ls -l ftl_input_code_ftl.$FS cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS -ftl_taf: ftl_taf_output.o \$(OBJFILES) - \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) +\$(EXE_FTL): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) ftl_taf_output.o \$(OBJFILES) \$(EMBEDDED_FILES) + \$(LINK) -o \${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) ftl_tamc_output.$FS: ftl_input_code.$FS \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS @@ -2938,9 +3207,9 @@ touch ad_taf_output.$FS ftl_taf_output.$FS \$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS \$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS - @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template - cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h - -rm -f ftl_config.template + @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "SVD version" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN > ad_config.template + cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h + @-rm -f ad_config.template EOF @@ -3015,7 +3284,7 @@ .PHONY: adDepend adDepend: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(addsuffix _mod.FF90, \$(CB2M_F90_SRC_NAMES)) \$(F77_SRC_FILES:.F=_cb2m.FF90) - \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES) + \$(MAKEDEPEND) -f \$(MAKEFILE) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES) \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) -rm -f makedepend.out @@ -3024,7 +3293,8 @@ OAD_active.F90 \ OAD_cp.F90 \ OAD_rev.F90 \ -OAD_tape.F90 +OAD_tape.F90 \ +revolve.F90 OPENAD_SUPPORT_C_SRC_FILES = \ iaddr.c \ @@ -3040,47 +3310,26 @@ f95 -fixed -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1 f95 -fixed -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1 -# the file included below is created by the -# postProcessor and its inclusion sets the -# variable POSTPROCESSEDFILES -# used below. Because the file is made during -# make it won't be read until the second (recursive) -# invocation in the rule below --include postProcess.make +CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90) -AD_OBJ_FILES_S1=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) \$(POSTPROCESSEDFILES:.f$FS90=.o) +AD_OBJ_FILES_S1=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) OAD_intrinsics_oad.o \$(CB2M_AD_FILES:.f$FS90=_oad.o) AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o) -postProcess.comp: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.tag \$(AD_OBJ_FILES_S1) -ifeq (\$(MAKELEVEL),0) - \$(MAKE) adAll -else - touch \$@ -endif - -\$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.comp \$(AD_OBJ_FILES_S2) -ifeq (\$(MAKELEVEL),1) +\$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.tag \$(AD_OBJ_FILES_S2) \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS) -else - touch \$@ -endif - -# makefile debug rule -openad: ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 -.PHONY: openad -# create the module files -%_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk - ../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk - -# create the header files -%_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk - ../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES) - -# change everybody else to use the new module files: -%_cb2m.FF90 : %.F ../OAD_support/cb2mUseModules.bash - ../OAD_support/cb2mUseModules.bash $< ${MPI} +# create sources files modules from header files containing common blocks +%_mod.FF90 : %.h \${OADTOOLS}/cb2mGetModules.csh \${OADTOOLS}/cb2mGetModules.awk + \${OADTOOLS}/cb2mGetModules.csh $< \${OADTOOLS}/cb2mGetModules.awk + +# create new header files with USE statements for the new modules made above +%_mod.h : %.h \${OADTOOLS}/cb2mGetHeaders.csh \${OADTOOLS}/cb2mGetHeaders.awk + \${OADTOOLS}/cb2mGetHeaders.csh $< \${OADTOOLS}/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES) + +# change the include directives of everybody to refer to the new header files with the USE statements +%_cb2m.FF90 : %.F \${OADTOOLS}/cb2mUseModules.bash + \${OADTOOLS}/cb2mUseModules.bash $< ${MPI} # makefile debug rule small_f: \$(CB2M_F90_PP_SRC_FILES) @@ -3093,93 +3342,59 @@ @printf 'running ... ' @./\$(EXE_AD) > \$@ -CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90) ad_input_code.f$FS90: \$(CB2M_AD_FILES) cat \$^ > \$@ -# strip all comments and blanks to reduce -# the file size in order to reduce perl's memory requirements -ad_input_code_sf.f$FS90 : ad_input_code.f$FS90 - cat \$^ | sed -f ../OAD_support/strip.sed | sed -f ../OAD_support/stop2print.sed > \$@ - -# mfef90 preprocessing -# expand statement functions -# expose mfef90 specific substring handling -# add the w2f__types module -ad_input_code_sf.w2f.f$FS90: ad_input_code_sf.f$FS90 mfef90 whirl2f whirl2f_be w2f__types.f90 - ./mfef90 -r8 -z -F -N132 \$< - mv \$<.B \$(basename \$<).B - ./whirl2f -openad \$(basename \$<).B - cat w2f__types.f90 \$(basename \$<).w2f.f > \$@ - # canonicalizer -ad_input_code_sf.w2f.pre.f$FS90: ad_input_code_sf.w2f.f$FS90 preProcess.py - ./preProcess.py --timing --r8 -H -S \$< -o \$@ +ad_input_code_sf.pre.f90 : \$(CB2M_AD_FILES) + \${OPENADFORTTK_BASE}/tools/SourceProcessing/preProcess.py --timing --r8 -H -S -o \$@ \$^ + +# replace stop statements (to avoid the implied unstructured control flow) with print statements +ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90 + cat \$< | sed -f \${OADTOOLS}/stop2print.sed > ad_input_code_sf.pre.s2p.f90 # F -> WHIRL -# note that the canonicalized version cuts off at col 72 -# doing this also for string constants which is ok as long -# as we are in fixed mode and cut of exactly there. -# Otherwise mfef90 patches in spaces to fill up to 72 (or 132) -# characters respectively. -ad_input_code_sf.w2f.pre.B: ad_input_code_sf.w2f.pre.f$FS90 mfef90 - ./mfef90 -r8 -z -F \$< - mv \$<.B \$@ +ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90 + \${OPEN64ROOT}/crayf90/sgi/mfef90 -r8 -z -F ad_input_code_sf.pre.s2p.f90 # WHIRL -> XAIF -ad_input_code_sf.w2f.pre.xaif : ad_input_code_sf.w2f.pre.B whirl2xaif - ./whirl2xaif -s -n --debug 1 -o \$@ \$< +ad_input_code_sf.pre.s2p.xaif : ad_input_code_sf.pre.s2p.B + \${OPENADFORTTK}/bin/whirl2xaif -s -n --debug 1 -o \$@ \$< # XAIF -> XAIF' -ad_input_code_sf.w2f.pre.xb.xaif : ad_input_code_sf.w2f.pre.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd oadDriver - ./oadDriver -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r +ad_input_code_sf.pre.s2p.xb.xaif : ad_input_code_sf.pre.s2p.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd + \${XAIFBOOSTERROOT}/xaifBooster/algorithms/BasicBlockPreaccumulationReverse/driver/oadDriver -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r # XAIF' -> WHIRL' -ad_input_code_sf.w2f.pre.xb.x2w.B : ad_input_code_sf.w2f.pre.xb.xaif xaif2whirl - ./xaif2whirl --debug 1 ad_input_code_sf.w2f.pre.B \$< +ad_input_code_sf.pre.s2p.xb.x2w.B : ad_input_code_sf.pre.s2p.xb.xaif + \${OPENADFORTTK}/bin/xaif2whirl --debug 1 ad_input_code_sf.pre.s2p.B \$< # WHIRL' -> F' -ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.B whirl2f whirl2f_be - ./whirl2f -FLIST:ftn_file=\$@ -openad \$< +ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.B + \${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$< # insert template directives -ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash - ../OAD_support/insertTemplateDir.bash \$< \$@ +ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 \${OADTOOLS}/insertTemplateDir.bash + \${OADTOOLS}/insertTemplateDir.bash \$< \$@ -PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F +PPEXTRAS=\$(wildcard \${OADTOOLS}/ad_template.*.F) \${OADTOOLS}/ad_inline.F # postprocess F' -postProcess.tag: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90 postProcess.py \$(PPEXTRAS:.F=.f) - # the target is a placeholder to signal execution of the rule +postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90 + \${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i \${OADTOOLS}/ad_inline.f \$< + # the target is a placeholder to trigger a single execution of the rule touch \$@ - # this step also creates the file postProcess.make but we cannot - # name it as the target or else make will try to remake it for - # the include directive above for any rule, e.g. make clean - ./postProcess.py --progress --timing --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$< +# put this so make knows about the postprocessing output +OAD_intrinsics_oad.f \$(CB2M_AD_FILES:.f$FS90=_oad.f): postProcess.tag -# setup some links +# link the XAIF schema files %.xsd: \$(LN) \${XAIFSCHEMAROOT}/schema/\$@ . -mfef90: - \$(LN) \${OPEN64ROOT}/crayf90/sgi/mfef90 . - # link the support files: \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES): - \$(LN) ../OAD_support/\$@ . - -whirl2xaif xaif2whirl: - \$(LN) \${OPENADFORTTK}/bin/\$@ . - -preProcess.py postProcess.py: - \$(LN) \${OPENADFORTTK_BASE}/tools/SourceProcessing/\$@ . - -whirl2f whirl2f_be: - \$(LN) \${OPEN64ROOT}/whirl2f/\$@ . - -oadDriver: - \$(LN) \${XAIFBOOSTERROOT}/xaifBooster/algorithms/BasicBlockPreaccumulationReverse/driver/oadDriver \$@ + \$(LN) \${OADTOOLS}/\$@ . -AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.make postProcess.tag postProcess.comp \$(PPEXTRAS:.F=.f) +AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag \$(PPEXTRAS:.F=.f) # ============ end OpenAD specific section ============== @@ -3224,7 +3439,7 @@ printf "\n=== Done ===\n" # Create special header files -$BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" $DISABLED_PACKAGES " " "Enabled packages:" $ENABLED_PACKAGES > $PACKAGES_DOT_H".tmp" +$BASH $TOOLSDIR/convert_cpp_cmd2defines -bPACKAGES_CONFIG_H "Disabled packages:" $DISABLED_PACKAGES " " "Enabled packages:" $ENABLED_PACKAGES > $PACKAGES_DOT_H".tmp" if test ! -f $PACKAGES_DOT_H ; then mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H else @@ -3238,7 +3453,7 @@ fi fi if test ! -f AD_CONFIG.h ; then - $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 + $BASH $TOOLSDIR/convert_cpp_cmd2defines "Default version" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > AD_CONFIG.h fi # Write the "state" for future records @@ -3247,6 +3462,6 @@ for i in $gm_state ; do t1="t2=\$$i" eval $t1 - echo "$i='$t2'" >> genmake_state + echo "$i='$t2'" | sed -e 's/ */ /g' >> genmake_state done fi