--- MITgcm/tools/genmake2 2006/04/07 02:53:55 1.146 +++ MITgcm/tools/genmake2 2009/03/27 20:18:07 1.185 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.146 2006/04/07 02:53:55 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.185 2009/03/27 20:18:07 jmc Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -325,7 +325,7 @@ #================================================================ # look for possible C compilers - tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc" + tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc" p_CC= for c in $tmp ; do rm -f ./genmake_hello.c ./genmake_hello @@ -364,7 +364,7 @@ #================================================================ # look for possible FORTRAN compilers - tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 gfortran" + tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 gfortran g95" p_FC= for c in $tmp ; do rm -f ./hello.f ./hello @@ -587,16 +587,22 @@ -ts | --ts Produce timing information per timestep -papis | --papis - Produce summary MFlop/s 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 -foolad | --foolad Fool the AD code generator -papi | --papi Performance analysis with PAPI + -pcl | --pcl + Performance analysis with PCL -hpmt | --hpmt Performance analysis with the HPM Toolkit -gsl | --gsl Use GSL to control floating point rounding and precision + -devel | --devel + Add additional warning and debugging flags for development -mpi | --mpi Include MPI header files and link to MPI libraries @@ -740,7 +746,9 @@ *curtim = *curtim/1.E6; } EOF - make genmake_tc_1.o >> genmake_warnings 2>&1 + COMM="$CC $CFLAGS -c genmake_tc_1.c" + echo $COMM >> genmake_warnings + $COMM >> genmake_warnings 2>&1 RET_C=$? cat < genmake_tc_2.$FS program hello @@ -750,7 +758,9 @@ print *," HELLO WORLD", wtime end EOF - $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1 + COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o" + echo $COMM >> genmake_warnings + $COMM >> genmake_warnings 2>&1 RET_F=$? test -x ./genmake_tc && ./genmake_tc >> genmake_warnings 2>&1 RETVAL=$? @@ -763,6 +773,9 @@ check_HAVE_SIGREG() { + if test ! "x$HAVE_SIGREG" = x ; then + return + fi get_fortran_c_namemangling cat < genmake_tc_1.c $FC_NAMEMANGLE @@ -794,7 +807,9 @@ return; } EOF - make genmake_tc_1.o >> genmake_warnings 2>&1 + COMM="$CC $CFLAGS -c genmake_tc_1.c" + echo $COMM >> genmake_warnings + $COMM >> genmake_warnings 2>&1 RET_C=$? cat < genmake_tc_2.$FS program hello @@ -820,6 +835,13 @@ 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 get_fortran_c_namemangling cat < genmake_tc_1.c $FC_NAMEMANGLE @@ -835,7 +857,9 @@ return; } EOF - make genmake_tc_1.o >> genmake_warnings 2>&1 + COMM="$CC $CFLAGS -c genmake_tc_1.c" + echo $COMM >> genmake_warnings + $COMM >> genmake_warnings 2>&1 RET_C=$? cat < genmake_tc_2.$FS program hello @@ -879,7 +903,9 @@ *nbyte = -1; } EOF - make genmake_tc_1.o >> genmake_tc.log 2>&1 + COMM="$CC $CFLAGS -c genmake_tc_1.c" + echo $COMM >> genmake_warnings + $COMM >> genmake_tc.log 2>&1 RET_C=$? cat < genmake_tc_2.$FS program hello @@ -930,9 +956,9 @@ cat genmake_tnc.F >> genmake_tnc.log echo "=== genmake_tnc.F ===" >> genmake_tnc.log RET_CPP=f - COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F" + COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES" echo "$COMM" >> genmake_tnc.log - $COMM > genmake_tnc.$FS 2>/dev/null && RET_CPP=t + eval $COMM > genmake_tnc.$FS 2>/dev/null && RET_CPP=t if test "x$RET_CPP" = xf ; then echo " WARNING: CPP failed to pre-process the netcdf test." \ >> genmake_tnc.log @@ -940,9 +966,9 @@ >> genmake_tnc.log fi echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log - echo " && $LINK -o genmake_tnc.o $LIBS" >> genmake_tnc.log + echo " && $LINK $FFLAGS $FOPTIM -o genmake_tnc.o $LIBS" >> genmake_tnc.log $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ - && $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 + && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1 RET_COMPILE=$? cat genmake_tnc.log >> genmake_warnings @@ -958,17 +984,32 @@ else # try again with "-lnetcdf" added to the libs echo "try again with added '-lnetcdf'" > genmake_tnc.log - echo "$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS \ " >> genmake_tnc.log + echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log - echo " && $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log - $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null \ + echo " && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log + cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS 2>/dev/null \ && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ - && $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 + && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1 RET_COMPILE=$? cat genmake_tnc.log >> genmake_warnings if test "x$RET_COMPILE" = x0 ; then LIBS="$LIBS -lnetcdf" HAVE_NETCDF=t + else + # try again with "-lnetcdff" added to the libs + echo "try again with added '-lnetcdff -lnetcdf'" > genmake_tnc.log + echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log + echo " && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log + echo " && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log + cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS 2>/dev/null \ + && $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1 \ + && $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdff -lnetcdf >> genmake_tnc.log 2>&1 + RET_COMPILE=$? + cat genmake_tnc.log >> genmake_warnings + if test "x$RET_COMPILE" = x0 ; then + LIBS="$LIBS -lnetcdff -lnetcdf" + HAVE_NETCDF=t + fi fi fi rm -f genmake_tnc* @@ -1004,6 +1045,9 @@ INCLUDES="-I. $INCLUDES" FFLAGS= FOPTIM= +FEXTRAFLAGS= +USE_EXTENDED_SRC= +EXTENDED_SRC_FLAG= CFLAGS= KFLAGS1= KFLAGS2= @@ -1016,10 +1060,13 @@ MPIPATH= TS= PAPIS= +PCLS= FOOLAD= PAPI= +PCL= HPMT= GSL= +DEVEL= HAVE_TEST_L= # DEFINES checked by test compilation or command-line @@ -1027,7 +1074,7 @@ HAVE_FDATE= FC_NAMEMANGLE= HAVE_CLOC= -HAVE_SETRLSTK= +# HAVE_SETRLSTK= HAVE_STAT= HAVE_NETCDF= HAVE_ETIME= @@ -1078,10 +1125,10 @@ # 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 PAPI HPMT GSL MPI JAM DUMPSTATE STANDARDDIRS" +gm_s2="FC CPP IEEE TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI JAM 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 " +gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM FEXTRAFLAGS" gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS" gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE" gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF" @@ -1108,12 +1155,6 @@ echo "=== Processing options files and arguments ===" gm_local="genmake_local" -for i in . $MODS ; do - if test -r $i/$gm_local ; then - . $i/$gm_local - break - fi -done printf " getting local config information: " if test -f $gm_local ; then echo "using $gm_local" @@ -1262,16 +1303,23 @@ TS=true ;; -papis | --papis) PAPIS=true ;; + -pcls | --pcls) + PCLS=true ;; -foolad | --foolad) FOOLAD=true ;; -papi | --papi) PAPI=true ;; + -pcl | --pcl) + PCL=true ;; -hpmt | --hpmt) HPMT=true ;; -gsl | --gsl) GSL=true ;; + -devel | --devel) + DEVEL=true ;; + -mpi | --mpi) MPI=true ;; -mpi=* | --mpi=*) @@ -1320,19 +1368,18 @@ if test -f ./.genmakerc ; then echo echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\"" - echo " file. This file format is no longer supported. Please see:" - echo + 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 - echo " for directions on how to setup and use the new \"genmake2\" input" - echo " files and send an email to MITgcm-support@mitgcm.org if you want help." + echo " and send an email to MITgcm-support@mitgcm.org if you need help." + echo "WARNING: ignore \"./.genmakerc\" and continue." echo fi # Find the MITgcm ${ROOTDIR} if test "x${ROOTDIR}" = x ; then tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'` - if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then + if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesupp -a -d ../pkg ; then ROOTDIR=".." else for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do @@ -1357,8 +1404,14 @@ fi # Find the MITgcm ${THISVER} -if test -f "${ROOTDIR}/doc/tag-index" ; then - THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1` +version_file="${ROOTDIR}/doc/tag-index" +if test -f $version_file ; then + THISVER=`grep '^checkpoint' $version_file | head -1` +#- remove ./BUILD_INFO.h file if older than version_file + if test -f ./BUILD_INFO.h -a ./BUILD_INFO.h -ot $version_file ; then + echo " remove ./BUILD_INFO.h (older than ${version_file})" + rm -f ./BUILD_INFO.h + fi fi if test "x$MAKEFILE" = x ; then @@ -1522,6 +1575,7 @@ else DEFINES="$DEFINES -DTIME_PER_TIMESTEP" fi + PACKAGES="$PACKAGES showflops" fi if test ! "x$PAPIS" = x ; then echo " Turning on PAPI flop summary per timestep" @@ -1533,6 +1587,19 @@ fi INCLUDES="$INCLUDES $PAPIINC" LIBS="$LIBS $PAPILIB" + PACKAGES="$PACKAGES showflops" +fi +if test ! "x$PCLS" = x ; then + echo " Turning on PCL counter summary per timestep" + echo " Please make sure PCLINC, PCLLIB are defined" + if test ! "x$FOOLAD" = x ; then + DEFINES="$DEFINES -DUSE_PCL_FLOPS_SFP" + else + DEFINES="$DEFINES -DUSE_PCL_FLOPS" + fi + INCLUDES="$INCLUDES $PCLINC" + LIBS="$LIBS $PCLLIB" + PACKAGES="$PACKAGES showflops" fi if test ! "x$PAPI" = x ; then if test ! "x$PAPIS" = x ; then @@ -1546,10 +1613,25 @@ LIBS="$LIBS $PAPILIB" fi fi +if test ! "x$PCL" = x ; then + if test ! "x$PCLS" = x ; then + echo " PCL performance analysis and flop summary per timestep cannot co-exist!" + echo " Sticking with PCL flop summary per timestep!" + else + echo " Turning on performance analysis with PCL" + echo " Please make sure PCLINC, PCLLIB are defined" + DEFINES="$DEFINES -DUSE_PCL" + INCLUDES="$INCLUDES $PCLINC" + LIBS="$LIBS $PCLLIB" + fi +fi if test ! "x$HPMT" = x ; then 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 + echo " PCL and the HPM Toolkit cannot co-exist!" + echo " Sticking with PCL!" else echo " Turning on performance analysis with the HPM Toolkit" echo " Please make sure HPMTINC, HPMTLIB are defined" @@ -1557,6 +1639,7 @@ INCLUDES="$INCLUDES $HPMTINC" LIBS="$LIBS $HPMTLIB" fi + fi fi if test ! "x$GSL" = x ; then echo " Turning on use of GSL to control floating point calculations" @@ -1565,6 +1648,11 @@ INCLUDES="$INCLUDES $GSLINC" LIBS="$LIBS $GSLLIB" fi +#- if USE_EXTENDED_SRC is set, add EXTENDED_SRC_FLAG to FFLAGS : +if test ! "x$USE_EXTENDED_SRC" = x ; then + FFLAGS="$FFLAGS $EXTENDED_SRC_FLAG" + F90FIXEDFORMAT="$F90FIXEDFORMAT $EXTENDED_SRC_FLAG" +fi printf "\n=== Checking system libraries ===\n" printf " Do we have the system() command using $FC... " @@ -1644,7 +1732,7 @@ printf " Can we unlimit the stack size using $FC... " check_HAVE_SETRLSTK -if test "x$HAVE_SETRLSTK" != x ; then +if test "x$HAVE_SETRLSTK" = xt ; then echo "yes" else echo "no" @@ -1653,7 +1741,7 @@ printf " Can we register a signal handler using $FC... " check_HAVE_SIGREG -if test "x$HAVE_SIGREG" != x ; then +if test "x$HAVE_SIGREG" = xt ; then echo "yes" else echo "no" @@ -1687,16 +1775,58 @@ printf "\n=== Setting defaults ===\n" -printf " Adding MODS directories: " +printf " Adding MODS directories: " +MPI_LNKF= for d in $MODS ; do if test ! -d $d ; then echo echo "Error: MODS directory \"$d\" not found!" exit 1 else - printf " $d" + printf "$d " SOURCEDIRS="$SOURCEDIRS $d" INCLUDEDIRS="$INCLUDEDIRS $d" + #------------------------------------------------------- + # Put special links so that MPI specific files are used + MPI_FILES=`(cd $d ; find . -name "*_mpi" -print)` + for i in $MPI_FILES ; do + ii=`echo $i | sed 's:^\./::'` + name=`echo $ii | sed 's:_mpi::' ` + if test "x$MPI" = x ; then + # NO: We undo an _mpi symbolically linked file + if test -L $name ; then + cmp $name "$d/$ii" > /dev/null 2>&1 + RETVAL=$? + if test "x$RETVAL" = x0 ; then + printf "Un-linking $name ; " + rm -f $name + fi + fi + else + # YES: We symbolically link this file (with conditions if already there) + if test -L $name ; then + cmp $d/$ii $name > /dev/null 2>&1 + RETVAL=$? + xx=`echo $MPI_LNKF | grep -c $name` + if test "x$RETVAL" != x0 -a $xx == 0 ; then + # remove sym-link if different and has not just been linked + printf "Un-link + " + rm -f $name + fi + if test "x$RETVAL" = x0 ; then + # if identical, keep sym-link and keep record of it + MPI_LNKF="$MPI_LNKF $name" + fi + fi + if ! test -f $name ; then + # make sym-link and keep record of it + printf "Linking $ii to $name ; " + ln -s $d/$ii $name + MPI_LNKF="$MPI_LNKF $name" + fi + fi + done + #------------------------------------------------------- fi done echo @@ -1771,19 +1901,21 @@ fi fi -#same for exch2 -if test -r $ROOTDIR"/pkg/exch2/Makefile" ; then - echo " Making source files in exch2 from templates" - ( cd $ROOTDIR"/pkg/exch2/" && $MAKE ) > make_exch2.errors 2>&1 - RETVAL=$? - if test "x${RETVAL}" = x0 ; then - rm -f make_exch2.errors - else - echo "Error: problem encountered while building source files in exch2:" - cat make_exch2.errors 1>&2 - exit 1 +#same for pkg/exch2 and pkg/regrid +for pdir in exch2 regrid ; do + if test -r $ROOTDIR"/pkg/${pdir}/Makefile" ; then + echo " Making source files in pkg/${pdir} from templates" + ( cd $ROOTDIR"/pkg/"${pdir} && $MAKE ) > make_${pdir}.errors 2>&1 + RETVAL=$? + if test "x${RETVAL}" = x0 ; then + rm -f make_${pdir}.errors + else + echo "Error: problem encountered while building source files in pkg/${pdir}:" + cat make_${pdir}.errors 1>&2 + exit 1 + fi fi -fi +done printf "\n=== Determining package settings ===\n" if test "x${PDEPEND}" = x ; then @@ -1894,8 +2026,8 @@ rm -f ./.tmp_pack echo " packages are: $PACKAGES" -# Check availability of NetCDF and then either build the MNC template -# files or delete mnc from the list of available 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 RETVAL=$? if test "x$RETVAL" = x0 ; then @@ -1929,13 +2061,38 @@ fi fi +# 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 +RETVAL=$? +if test "x$RETVAL" = x0 ; then + if test "x$HAVE_NETCDF" != xt ; then + cat </dev/null )` for j in $list_files ; do - cat $i/$j >> ad_files + cat $i/$j >> adSrcFiles.tmp done done if test ! "x"$FS = "x.f" ; then - cat ad_files | sed -e "s/\.f/.$FS/g" > ad_files_f - mv -f ad_files_f ad_files + cat adSrcFiles.tmp | sed -e "s/\.f/.$FS/g" > adSrcFiles.tmp_f + mv -f adSrcFiles.tmp_f adSrcFiles.tmp fi echo @@ -2158,7 +2316,7 @@ perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h else echo " We cannot create a copy of mpif.h!" - exit -1 +# exit -1 fi fi @@ -2183,18 +2341,63 @@ exit 1 fi rm -f .links.tmp/foo + +if test "x$OPENAD" != x ; then + OAD_DONT_COMPILE="/dev/null" + OAD_DONT_TRANSFORM="/dev/null" + OAD_KEEP_ORIGINAL="/dev/null" + OAD_CB2M_FILES="/dev/null" + echo " looking for dontCompile file: " + for i in "." $MODS ; do + if test -r $i"/dontCompile" ; then + OAD_DONT_COMPILE=$i"/dontCompile" + echo " found $OAD_DONT_COMPILE" + break + fi + done + echo " looking for dontTransform file: " + for i in "." $MODS ; do + if test -r $i"/dontTransform" ; then + OAD_DONT_TRANSFORM=$i"/dontTransform" + echo " found $OAD_DONT_TRANSFORM" + break + fi + done + echo " looking for keepOriginal file: " + for i in "." $MODS ; do + if test -r $i"/keepOriginal" ; then + OAD_KEEP_ORIGINAL=$i"/keepOriginal" + echo " found $OAD_KEEP_ORIGINAL" + break + fi + done + echo " looking for cb2mFiles: " + for i in "." $MODS ; do + if test -r $i"/cb2mFiles" ; then + OAD_CB2M_FILES=$i"/cb2mFiles" + echo " found $OAD_CB2M_FILES" + break + fi + done + echo " OpenAD exceptions: " +fi + echo "# This section creates symbolic links" > srclinks.tmp echo "" >> srclinks.tmp -printf 'SRCFILES = ' > srclist.inc -printf 'CSRCFILES = ' > csrclist.inc -printf 'F90SRCFILES = ' > f90srclist.inc -printf 'HEADERFILES = ' > hlist.inc -printf 'AD_FLOW_FILES = ' > ad_flow_files.inc +printf 'F77_SRC_FILES = ' > F77srclist.tmp +printf 'NON_AD_F77_SRC_FILES = ' > nonADF77srclist.tmp +printf 'C_SRC_FILES = ' > csrclist.tmp +printf 'F90_SRC_FILES = ' > F90srclist.tmp +printf 'H_SRC_FILES = ' > hsrclist.tmp +printf 'AD_FLOW_FILES = ' > ad_flow_files.tmp alldirs="$SOURCEDIRS $INCLUDEDIRS ." for d in $alldirs ; do deplist= sfiles=`( cd $d; echo *.[h,c,F] *.flow )` sfiles=`( echo $sfiles; cd $d; echo *.F90 )` + if test "x$OPENAD" != x ; then + sfiles=`( echo $sfiles | grep -v _cb2m\. )` + fi for sf in $sfiles ; do if test ! -r ".links.tmp/$sf" ; then if test -f "$d/$sf" ; then @@ -2229,44 +2432,77 @@ if test "x$ignore_f" = xf ; then extn=`echo $sf | $AWK -F. '{print $NF}'` case $extn in - F) - echo " \\" >> srclist.inc - printf " $sf" >> srclist.inc - ;; - F90) - echo " \\" >> f90srclist.inc - printf " $sf" >> f90srclist.inc - ;; - c) - echo " \\" >> csrclist.inc - printf " $sf" >> csrclist.inc - ;; - h) - echo " \\" >> hlist.inc - printf " $sf" >> hlist.inc - ;; - flow) - echo " \\" >> ad_flow_files.inc - printf " $sf" >> ad_flow_files.inc - ;; - esac - fi + F) + echo " \\" >> F77srclist.tmp + printf " $sf" >> F77srclist.tmp + if test "x$OPENAD" != x ; then + basename=${sf%%.F} + isAD=`egrep ^$basename.f'[ ]*' adSrcFiles.tmp` + if test -z "$isAD" ; then + toBeIgnored=`egrep ^$basename'[ ]*' ${OAD_DONT_COMPILE}` + if test -z "$toBeIgnored" ; then + echo " \\" >> nonADF77srclist.tmp + printf " $sf" >> nonADF77srclist.tmp + else + echo " not to be compiled : $sf" + fi + else # file is initially listed as an AD file we want to exclude it + # or we want to retain the untransformed version + notToBeTransformed=`egrep ^$basename'[ ]*' ${OAD_DONT_TRANSFORM}` + untransformedVersionToBeKept=`egrep ^$basename'[ ]*' ${OAD_KEEP_ORIGINAL}` + if test -n "$notToBeTransformed"; then + echo " not to be transformed: $sf" + fi + if test -n "$untransformedVersionToBeKept" ; then + echo " original to be kept : $sf" + fi + if test -n "$notToBeTransformed" -o -n "$untransformedVersionToBeKept" ; then + echo " \\" >> nonADF77srclist.tmp + printf " $sf" >> nonADF77srclist.tmp + fi + fi + fi + ;; + F90) + echo " \\" >> F90srclist.tmp + printf " $sf" >> F90srclist.tmp + ;; + c) + echo " \\" >> csrclist.tmp + printf " $sf" >> csrclist.tmp + ;; + h) + echo " \\" >> hsrclist.tmp + printf " $sf" >> hsrclist.tmp + ;; + flow) + echo " \\" >> ad_flow_files.tmp + printf " $sf" >> ad_flow_files.tmp + ;; + esac + fi fi fi done if test "x$deplist" != x ; then - echo "" >> srclinks.tmp + if test "$d" != "." ; then + echo "" >> srclinks.tmp echo "# These files are linked from $d" >> srclinks.tmp echo "$deplist :" >> srclinks.tmp - printf "\t\$(LN) %s/\$@ \$@\n" $d >> srclinks.tmp +# We need to make sure that the link isn't already there. +# This may happen when make thinks that a header file has to be "remade" +# because a module it depends on has changed. In this case we do nothing. + printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> srclinks.tmp + fi fi done rm -rf .links.tmp -echo "" >> srclist.inc -echo "" >> csrclist.inc -echo "" >> f90srclist.inc -echo "" >> hlist.inc -echo "" >> ad_flow_files.inc +echo "" >> F77srclist.tmp +echo "" >> nonADF77srclist.tmp +echo "" >> csrclist.tmp +echo "" >> F90srclist.tmp +echo "" >> hsrclist.tmp +echo "" >> ad_flow_files.tmp if test -f $MAKEFILE ; then mv -f $MAKEFILE "$MAKEFILE.bak" @@ -2361,11 +2597,12 @@ KFLAGS1 = ${KFLAGS1} KFLAGS2 = ${KFLAGS2} # Optim./debug for FC -FFLAGS = ${FFLAGS} +FFLAGS = ${FFLAGS} ${FEXTRAFLAGS} FOPTIM = ${FOPTIM} # Optim./debug for FC F90FLAGS = ${F90FLAGS} F90OPTIM = ${F90OPTIM} +F90FIXEDFORMAT = ${F90FIXEDFORMAT} # Flags for CC CFLAGS = ${CFLAGS} # Files that should not be optimized @@ -2378,30 +2615,40 @@ EOF -cat srclist.inc >> $MAKEFILE -cat csrclist.inc >> $MAKEFILE -cat f90srclist.inc >> $MAKEFILE -cat hlist.inc >> $MAKEFILE -cat ad_flow_files.inc >> $MAKEFILE +cat F77srclist.tmp >> $MAKEFILE +cat nonADF77srclist.tmp >> $MAKEFILE +cat csrclist.tmp >> $MAKEFILE +cat F90srclist.tmp >> $MAKEFILE +cat hsrclist.tmp >> $MAKEFILE +cat ad_flow_files.tmp >> $MAKEFILE + +rm -f F77srclist.tmp nonADF77srclist.tmp csrclist.tmp F90srclist.tmp hsrclist.tmp ad_flow_files.tmp + echo >> $MAKEFILE -echo 'F77FILES = $(SRCFILES:.F=.'$FS')' >> $MAKEFILE -echo 'F90FILES = $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE -echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $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 +# but these are not expected to be the original source files + +echo 'F77_PP_SRC_FILES = $(F77_SRC_FILES:.F=.'$FS')' >> $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 >> $MAKEFILE echo '.SUFFIXES:' >> $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 +echo '.SUFFIXES: .o .'$FS' .p .F .c .f'$FS90' .'$FS90' .FF90 .F90 .flowdir .flow' >> $MAKEFILE cat >>$MAKEFILE <> \$(MAKEFILE) -rm -f makedepend.out @@ -2409,28 +2656,35 @@ libmitgcmuv.a: \$(OBJFILES) ar rcv libmitgcmuv.a \$(OBJFILES) + ar d libmitgcmuv.a main.o -links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES) +links: \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(SPECIAL_FILES) -small_f: \$(F77FILES) \$(F90FILES) +small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES) output.txt: \$(EXECUTABLE) @printf 'running ... ' @\$(EXECUTABLE) > \$@ clean: - -rm -rf *.o *.$FS *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template + -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template + -rm -rf *.o + -rm -rf *.$FS *.flowdir + -rm -rf *.f$FS90 *_mod.h *_mod.F90 *.FF90 *.mod-whirl ad_input* + -rm -rf temp.sed Clean: @make clean @make cleanlinks -rm -f \$(SPECIAL_FILES) - -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak + -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log f90mkdepend.log *.bak + -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log CLEAN: @make Clean -find \$(EXEDIR) -name "*.meta" -exec rm {} \; -find \$(EXEDIR) -name "*.data" -exec rm {} \; -find \$(EXEDIR) -name "fort.*" -exec rm {} \; - -rm -f \$(EXECUTABLE) *.txt STD* *diagnostics.log datetime + -rm -f \$(EXECUTABLE) \$(EXE_AD) *.txt STD* *diagnostics.log datetime + -rm -f *_MIT_CE_000.opt0000 costfunction*0000 -rm -rf mnc_test_* #eh3 Makefile: makefile @@ -2439,7 +2693,7 @@ cleanlinks: -find . -type l -exec rm {} \; -# Special targets (SPECIAL_FILES) which are create by make +# 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) > \$@ @@ -2464,10 +2718,10 @@ decode_files.o : EMBEDDED_FILES.h -## \$(F77FILES) -all_fF.tar.gz : \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile +## \$(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) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile + -tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile -rm -f all_fF.tar.gz -gzip all_fF.tar @@ -2491,10 +2745,17 @@ \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$< .F90.$FS90: \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ +.FF90.f$FS90: + \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ .$FS90.o: \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$< +.f$FS90.o: + cp \$< \$(basename \$<).f90 + \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$(F90FIXEDFORMAT) \$(basename \$<).f90 .c.o: \$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$< +.flow.flowdir: + \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@ # Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain .F.p: @@ -2502,8 +2763,15 @@ .p.$FS: \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$< +EOF + #========================================= #=== Automatic Differentiation Rules === +#=== for TAMC/TAF ====================== + +if test "x$OPENAD" == x ; then + +cat >>$MAKEFILE <> $MAKEFILE done echo " Add the source list for AD code generation" echo >> $MAKEFILE printf "AD_FILES = " >> $MAKEFILE -AD_FILES=`cat ad_files` +AD_FILES=`cat adSrcFiles.tmp` for i in $AD_FILES ; do echo " \\" >> $MAKEFILE printf " $i" >> $MAKEFILE done echo >> $MAKEFILE -rm -f ad_files +rm -f adSrcFiles.tmp 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 \$(F77FILES) - @make \$(AD_FLOW_FILES) - cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.$FS + @make \$(F77_PP_SRC_FILES) + @make \$(FLOFILES) + cat \$(FLOFILES) \$(AD_FILES) > ad_input_code.$FS ad_taf_output.$FS: ad_input_code.$FS \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS + ls -l ad_input_code_ad.$FS cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS adtafonly: \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS + ls -l ad_input_code_ad.$FS cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS -ad_taf: ad_taf_output.o \$(OBJFILES) - \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) +\${EXE_AD}: ad_taf_output.o \$(OBJFILES) + \$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS) ad_tamc_output.$FS: ad_input_code.$FS \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS @@ -2579,20 +2849,22 @@ ftltaf: ftl_taf_output.$FS ftltamc: ftl_tamc_output.$FS -ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES) +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 \$(F77FILES) + @make \$(F77_PP_SRC_FILES) @make \$(AD_FLOW_FILES) cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS ftl_taf_output.$FS: ftl_input_code.$FS \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS + ls -l ftl_input_code_ftl.$FS cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS ftltafonly: \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS + 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) @@ -2630,10 +2902,242 @@ cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h -rm -f ftl_config.template -#========================================= +EOF + +fi + +#=== for OpenAD ======================== + +if test "x$OPENAD" != x ; then + +# ============ begin OpenAD specific section ============== + +cat >>$MAKEFILE <> $MAKEFILE +printf "CB2M_F90_SRC_NAMES = " >> $MAKEFILE +for i in `cat ${OAD_CB2M_FILES}` ; do + echo " \\" >> $MAKEFILE + printf " $i" >> $MAKEFILE +done +echo >> $MAKEFILE + +echo " Add the source list for AD code generation" +echo >> $MAKEFILE +printf "AD_FILES = " >> $MAKEFILE +for i in `cat ${OAD_CB2M_FILES}` ; do + echo " \\" >> $MAKEFILE + printf " ${i}_mod.f$FS90" >> $MAKEFILE +done +AD_FILES=`cat adSrcFiles.tmp` +for i in $AD_FILES ; do + basename=${i%%.f} + toBeIgnored=`egrep ^$basename'[ ]*' ${OAD_DONT_COMPILE} ${OAD_DONT_TRANSFORM}` + if test -z "$toBeIgnored" ; then + echo " \\" >> $MAKEFILE + printf " $i" >> $MAKEFILE + fi +done +echo >> $MAKEFILE +rm -f adSrcFiles.tmp + +cat >>$MAKEFILE <> \$(MAKEFILE) + -rm -f makedepend.out + +OPENAD_SUPPORT_F90_SRC_FILES = \ +w2f__types.F90 \ +OAD_active.F90 \ +OAD_cp.F90 \ +OAD_rev.F90 \ +OAD_tape.F90 + +OPENAD_SUPPORT_C_SRC_FILES = \ +iaddr.c \ +timeRatio.c + +f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES:F90=$FS90) + cat \$^ > \$@ + +f95_test.f90: all_mods.xb.x2w.w2f.pp.f$FS90 \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90) ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 + cat \$^ > \$@ + +f95_test.out: f95_test_mods.f90 f95_test.f90 + 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 + +AD_OBJ_FILES=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) all_mods.xb.x2w.w2f.pp.o ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.o \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o) + +\$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(AD_OBJ_FILES) + @echo Creating \$@ ... + \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES) \$(LIBS) + +# 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} + +# makefile debug rule +small_f: \$(CB2M_F90_PP_SRC_FILES) +.PHONY: small_f + +ad_output.txt: \$(EXE_AD) + @printf 'linking data files ... ' + \$(LN) -f ../input_ad/data* ../input_ad/eedata . + \$(LN) -f ../../global_ocean.90x40x15/input/*.bin . + @printf 'running ... ' + @./\$(EXE_AD) > \$@ + +CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90) +ad_input_code.f$FS90: ../OAD_support/maxMinDefs.f \$(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 -H -S \$< -o \$@ + +# 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 \$@ + +# WHIRL -> XAIF +ad_input_code_sf.w2f.pre.xaif : ad_input_code_sf.w2f.pre.B whirl2xaif + ./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 + +# XAIF' -> WHIRL' +ad_input_code_sf.w2f.pre.xb.x2w.B : ad_input_code_sf.w2f.pre.xb.xaif xaif2whirl + ./xaif2whirl --debug 1 --structured ad_input_code_sf.w2f.pre.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 \$< + +# 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 \$< \$@ + +PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F +# postprocess F' +ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.pp.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90 multi-pp.pl \$(PPEXTRAS:.F=.f) + perl multi-pp.pl -inline=../OAD_support/ad_inline.f \$< + # the postprocessor still gets the name wrong + cat \$<.pp | sed 's/RETURN//' > \$@ + +# extract all transformed modules +all_mods.xb.x2w.w2f.pp.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 + cat \$< | sed -n '/MODULE /,/END MODULE/p' > \$@ + +# remove the transformed globals module from the +# transformed ad_input_code file +# and remove for now the duplicate variables +# and fix 2 data statements +ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.pp.f$FS90 + cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^ INTEGER(w2f__i4) DOLOOP_UB/d' > \$@ + +# setup some links +%.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/\$@ . + +%.pl: + \$(LN) \${OPENADFORTTK}/bin/\$@ . + +preProcess.py: + \$(LN) \${OPENADFORTTK_BASE}/tools/SourceProcessing/\$@ . + +whirl2f whirl2f_be: + \$(LN) \${OPEN64ROOT}/whirl2f/\$@ . + +oadDriver: + \$(LN) \${XAIFBOOSTERROOT}/xaifBooster/algorithms/BasicBlockPreaccumulationReverse/driver/oadDriver \$@ + +# ============ end OpenAD specific section ============== + +EOF + +fi + +#========================================= + if test "x$EXEHOOK" != x ; then printf "\nexehook:\n\t%s\n" $EXEHOOK >> $MAKEFILE fi