/[MITgcm]/MITgcm/tools/genmake2
ViewVC logotype

Diff of /MITgcm/tools/genmake2

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.16 by edhill, Tue Oct 21 19:31:24 2003 UTC revision 1.33 by adcroft, Thu Nov 13 15:10:40 2003 UTC
# Line 72  find_possible_configs()  { Line 72  find_possible_configs()  {
72    
73      tmp1=`uname`"_"`uname -m`      tmp1=`uname`"_"`uname -m`
74      tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`      tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
75      PLATFORM=`echo $tmp2 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
76        PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
77      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
78      echo "  The platform appears to be:  $PLATFORM"      echo "  The platform appears to be:  $PLATFORM"
79  #     if test "x$OFLIST" = x ; then  #     if test "x$OFLIST" = x ; then
# Line 103  find_possible_configs()  { Line 104  find_possible_configs()  {
104          CPP="cpp -traditional -P"          CPP="cpp -traditional -P"
105      fi      fi
106    
107        # makedepend is not always available
108        if test "x${MAKEDEPEND}" = x ; then
109          which makedepend >& /dev/null
110          RETVAL=$?
111          if test "x${RETVAL}" = x1 ; then
112             echo "    makedepend was not found. Using xmakedpend instead."
113             MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
114          fi
115        fi
116    
117      # look for possible fortran compilers      # look for possible fortran compilers
118      tmp="$MITGCM_FC $FC g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95"      tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95"
119      p_FC=      p_FC=
120      for c in $tmp ; do      for c in $tmp ; do
121          rm -f ./hello.f ./hello          rm -f ./hello.f ./hello
# Line 121  EOF Line 132  EOF
132              p_FC="$p_FC $c"              p_FC="$p_FC $c"
133          fi          fi
134      done      done
135        rm -f ./hello.f ./hello
136      if test "x${p_FC}" = x ; then      if test "x${p_FC}" = x ; then
137          cat 1>&2 <<EOF          cat 1>&2 <<EOF
138    
# Line 262  usage()  { Line 274  usage()  {
274      exit 1      exit 1
275  }  }
276    
277  #eh3 # This is the generic configuration.  #  Build a CPP macro to automate calling C routines from FORTRAN
278  #eh3 set LN         = ( 'ln -s' )  get_fortran_c_namemangling()  {
279  #eh3 set CPP        = ( '/lib/cpp -P' )      default_nm="#define FC_NAMEMANGLE(X) X ## _"
280  #eh3 set S64        = ( '$(TOOLSDIR)/set64bitConst.sh' )      
281  #eh3 set KPP        = (  )      cat > genmake_test.c <<EOF
282  #eh3 set FC         = ( 'f77' )  void tcall( char * string ) { tsub( string ); }
283  #eh3 set LINK       = $FC  EOF
284  #eh3 set MAKEDEPEND = ( 'makedepend' )      $MAKE genmake_test.o > genmake_test.log 2>&1
285  #eh3 set INCLUDES   = ( -I. )      RETVAL=$?
286  #eh3 set FFLAGS     = (  )      if test "x$RETVAL" != x0 ; then
287  #eh3 set FOPTIM     = (  )          cat genmake_test.log >> genmake_errors
288  #eh3 set CFLAGS     = (  )          FC_NAMEMANGLE=$default_nm
289  #eh3 set KFLAGS1    = (  )          echo
290  #eh3 set KFLAGS2    = (  )          echo "WARNING: C test compile fails -- please see \"genmake_errors\""
291  #eh3 set LIBS       = (  )          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"
292  #eh3 set KPPFILES   = (  )          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."
293  #eh3 if (! $?NOOPTFILES ) set NOOPTFILES = (  )          return 1
294  #eh3 if (! $?NOOPTFLAGS ) set NOOPTFLAGS = (  )      fi
295        c_tcall=`nm genmake_test.o | grep tcall | cut -d ' ' -f 3`
296        RETVAL=$?
297        if test "x$RETVAL" != x0 ; then
298            FC_NAMEMANGLE=$default_nm
299            echo
300            echo "WARNING: The \"nm\" command failed."
301            echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"
302            echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."
303            return 1
304        fi
305        cat > genmake_tcomp.f <<EOF
306          subroutine tcall( string )
307          character*(*) string
308          call tsub( string )
309          end
310    EOF
311        $FC $FFLAGS $DEFINES -c genmake_tcomp.f > genmake_tcomp.log 2>&1
312        RETVAL=$?
313        if test "x$RETVAL" != x0 ; then
314            cat genmake_tcomp.log >> genmake_errors
315            FC_NAMEMANGLE=$default_nm
316            echo
317            echo "WARNING: FORTRAN test compile fails -- please see \"genmake_errors\""
318            echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"
319            echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."
320            return 1
321        fi
322        f_tcall=`nm genmake_tcomp.o | grep tcall | cut -d ' ' -f 3`
323        RETVAL=$?
324        if test "x$RETVAL" != x0 ; then
325            FC_NAMEMANGLE=$default_nm
326            echo
327            echo "WARNING: The \"nm\" command failed."
328            echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"
329            echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."
330            return 1
331        fi
332    
333        c_a=`echo $c_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 1 | sed -e 's|Y||'`
334        f_a=`echo $f_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 1 | sed -e 's|Y||'`
335        c_b=`echo $c_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 2 | sed -e 's|Y||'`
336        f_b=`echo $f_tcall | sed -e 's|tcall|Y Y|' | cut -d ' ' -f 2 | sed -e 's|Y||'`
337    
338        nmangle="X"
339        if test "x$c_a" != "x$f_a" ; then
340            comm="echo x$f_a | sed -e 's|x$c_a||'"
341            a=`eval $comm`
342            nmangle="$a ## $nmangle"
343        fi
344        if test "x$c_b" != "x$f_b" ; then
345            comm="echo x$f_b | sed -e 's|x$c_b||'"
346            b=`eval $comm`
347            nmangle="$nmangle ## $b"
348        fi
349    
350        FC_NAMEMANGLE="#define FC_NAMEMANGLE(X)  $nmangle"
351    
352        #  cleanup the testing files
353        rm -f genmake_tcomp.* genmake_test.*
354    }
355    
356  #  Set defaults here  #  Set defaults here
357  COMMANDL="$0 $@"  COMMANDL="$0 $@"
# Line 290  S64= Line 362  S64=
362  KPP=  KPP=
363  FC=  FC=
364  LINK=  LINK=
365  DEFINES="-DWORDLENGTH=4"  # DEFINES="-DWORDLENGTH=4"
366    DEFINES=
367  PACKAGES=  PACKAGES=
368  ENABLE=  ENABLE=
369  DISABLE=  DISABLE=
# Line 311  KPPFILES= Line 384  KPPFILES=
384  NOOPTFILES=  NOOPTFILES=
385  NOOPTFLAGS=  NOOPTFLAGS=
386    
387    # DEFINES checked by test compilation
388    HAVE_SYSTEM=
389    HAVE_FDATE=
390    FC_NAMEMANGLE=
391    
392  MODS=  MODS=
393  TOOLSDIR=  TOOLSDIR=
394  SOURCEDIRS=  SOURCEDIRS=
# Line 335  fi Line 413  fi
413    
414  AUTODIFF_PKG_USED=f  AUTODIFF_PKG_USED=f
415  AD_OPTFILE=  AD_OPTFILE=
416    TAF=
417    AD_TAF_FLAGS=
418    FTL_TAF_FLAGS=
419    SVD_TAF_FLAGS=
420    TAF_EXTRA=
421    TAMC=
422    AD_TAMC_FLAGS=
423    FTL_TAF_FLAGS=
424    SVD_TAMC_FLAGS=
425    TAMC_EXTRA=
426    
427    
428  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
429  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT"
# Line 345  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPE Line 434  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPE
434  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
435  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"
436  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
437    gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE"
438    
439  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
440  gm_s7="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF DIFF_FLAGS AD_TAMC_FLAGS AD_TAF_FLAGS"  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"
441  gm_s8="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS"  gm_s11="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS"
442  gm_s9=""  gm_s12="TAF_EXTRA TAMC_EXTRA"
443    
444  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7 $gm_s8"  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7"
445    gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"
446    
447    
448  echo  echo
# Line 496  for ac_option ; do Line 587  for ac_option ; do
587          -ds | --ds)          -ds | --ds)
588              DUMPSTATE=t ;;              DUMPSTATE=t ;;
589                    
590            -taf_extra | --taf_extra)
591                ac_prev=TAF_EXTRA ;;
592            -taf_extra=* | --taf_extra=*)
593                TAF_EXTRA=$ac_optarg ;;
594    
595            -tamc_extra | --tamc_extra)
596                ac_prev=TAMC_EXTRA ;;
597            -tamc_extra=* | --tamc_extra=*)
598                TAMC_EXTRA=$ac_optarg ;;
599    
600          -*)          -*)
601              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
602              usage              usage
# Line 630  Error: C pre-processor "$CPP" failed the Line 731  Error: C pre-processor "$CPP" failed the
731    
732    1) within the options file ("CPP=...") as specified by "-of=OPTFILE"    1) within the options file ("CPP=...") as specified by "-of=OPTFILE"
733    2) the "./genmake_local" file    2) the "./genmake_local" file
734      3) with the CPP environment variable
735    
736  EOF  EOF
737      exit 1      exit 1
# Line 640  if test "x$MAKEDEPEND" = x ; then Line 742  if test "x$MAKEDEPEND" = x ; then
742      MAKEDEPEND=makedepend      MAKEDEPEND=makedepend
743  fi  fi
744    
745    
746    printf "\n===  Checking system libraries  ===\n"
747    echo -n "  Do we have the system() command using $FC...  "
748    cat > genmake_tcomp.f <<EOF
749          program hello
750          call system('echo hi')
751          end
752    EOF
753    $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1
754    RETVAL=$?
755    if test "x$RETVAL" = x0 ; then
756        HAVE_SYSTEM=t
757        DEFINES="$DEFINES -DHAVE_SYSTEM"
758        echo "yes"
759    else
760        HAVE_SYSTEM=
761        echo "no"
762    fi
763    rm -f genmake_tcomp*
764    
765    echo -n "  Do we have the fdate() command using $FC...  "
766    cat > genmake_tcomp.f <<EOF
767          program hello
768          CHARACTER(128) string
769          string = ' '
770          call fdate( string )
771          print *, string
772          end
773    EOF
774    $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1
775    RETVAL=$?
776    if test "x$RETVAL" = x0 ; then
777        HAVE_FDATE=t
778        DEFINES="$DEFINES -DHAVE_FDATE"
779        echo "yes"
780    else
781        HAVE_FDATE=
782        echo "no"
783    fi
784    rm -f genmake_tcomp*
785    
786    echo "  The name mangling convention for $FC is...  "
787    #FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _"
788    if test "x$FC_NAMEMANGLE" = x ; then
789        get_fortran_c_namemangling
790    fi
791    echo "    '$FC_NAMEMANGLE'"
792    echo "$FC_NAMEMANGLE" > FC_NAMEMANGLE.h.template
793    cmp FC_NAMEMANGLE.h FC_NAMEMANGLE.h.template > /dev/null 2>&1
794    RETVAL=$?
795    if test "x$RETVAL" != x0 ; then
796        mv -f FC_NAMEMANGLE.h.template FC_NAMEMANGLE.h
797    fi
798    
799    
800  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
801  echo -n "  Adding MODS directories:  "  echo -n "  Adding MODS directories:  "
802  for d in $MODS ; do  for d in $MODS ; do
# Line 887  for i in $PACKAGES ; do Line 1044  for i in $PACKAGES ; do
1044      fi      fi
1045  done  done
1046    
 #  This is compatible with the old genmake.  The "DISABLE_*" flags  
 #  need to be replaced by the "ALLOW_*" flags set below.  
 #  
 # echo -n "  Setting package-specific CPP flags:  "  
 # pkrm=( mom_fluxform mom_vecinv generic_advdiff )  
 # pkrmdef=( -DDISABLE_MOM_FLUXFORM -DDISABLE_MOM_VECINV -DDISABLE_GENERIC_ADVDIFF -DDISABLE_DEBUGMODE )  
 # echo -n "  "  
 # i=0  
 # while test $i -lt "${#pkrm[@]}" ; do  
 #     echo "$PACKAGES" | grep "${pk[$i]}" > /dev/null 2>&1  
 #     RETVAL=$?  
 #     if test "x$RETVAL" = x1 ; then  
 #       DEFINES="$DEFINES ${pkdef[$i]}"  
 #       echo -n " ${pkdef[$i]}"  
 #     fi  
 #     i=$(( $i + 1 ))  
 # done  
 # echo  
1047    
1048  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
1049  PACKAGES_DOT_H=PACKAGES_CONFIG.h  PACKAGES_DOT_H=PACKAGES_CONFIG.h
# Line 938  for n in $names ; do Line 1077  for n in $names ; do
1077          if test "x$has_pack" = xf ; then          if test "x$has_pack" = xf ; then
1078              undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`              undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`
1079              echo "#undef $undef" >> $PACKAGES_DOT_H".tmp"              echo "#undef $undef" >> $PACKAGES_DOT_H".tmp"
 #           DEFINES="$DEFINES -U$undef"  
   
 #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  
             case $n in  
                 mom_fluxform)  
                     DEFINES="$DEFINES -DDISABLE_MOM_FLUXFORM"  
                     ;;  
                 mom_vecinv)  
                     DEFINES="$DEFINES -DDISABLE_MOM_VECINV"  
                     ;;  
                 debug)  
                     DEFINES="$DEFINES -DDISABLE_DEBUGMODE"  
                     ;;  
             esac  
 #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  
   
1080          fi          fi
1081      fi      fi
1082  done  done
# Line 1019  for d in $STANDARDDIRS ; do Line 1142  for d in $STANDARDDIRS ; do
1142      fi      fi
1143  done  done
1144    
1145  echo " Searching for CPP_OPTIONS.h in order to warn about the presence"  echo "  Searching for CPP_OPTIONS.h in order to warn about the presence"
1146  echo " of \"#define ALLOW_PKGNAME\"-type statements:"  echo "    of \"#define ALLOW_PKGNAME\"-type statements:"
1147  CPP_OPTIONS=  CPP_OPTIONS=
1148  spaths=". $INCLUDEDIRS"  spaths=". $INCLUDEDIRS"
1149  for i in $spaths ; do  for i in $spaths ; do
# Line 1151  echo "# by the command:" >> $MAKEFILE Line 1274  echo "# by the command:" >> $MAKEFILE
1274  echo "#    $0 $@" >> $MAKEFILE  echo "#    $0 $@" >> $MAKEFILE
1275  echo "# executed by:" >> $MAKEFILE  echo "# executed by:" >> $MAKEFILE
1276  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE
1277    
1278    EXE_AD=$EXECUTABLE"_ad"
1279    EXE_FTL=$EXECUTABLE"_ftl"
1280    EXE_SVD=$EXECUTABLE"_svd"
1281    
1282  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
1283  #  #
1284  # BUILDDIR     : Directory where object files are written  # BUILDDIR     : Directory where object files are written
# Line 1181  TOOLSDIR    = ${TOOLSDIR} Line 1309  TOOLSDIR    = ${TOOLSDIR}
1309    
1310  #eh3  new defines for the adjoint work  #eh3  new defines for the adjoint work
1311  AUTODIFF    = ${ROOTDIR}/pkg/autodiff  AUTODIFF    = ${ROOTDIR}/pkg/autodiff
1312    EXE_AD      = ${EXE_AD}
1313    EXE_FTL     = ${EXE_FTL}
1314    EXE_SVD     = ${EXE_SVD}
1315    
1316  EOF  EOF
1317    
# Line 1262  output.txt: \$(EXECUTABLE) Line 1393  output.txt: \$(EXECUTABLE)
1393          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
1394    
1395  clean:  clean:
1396            -cat AD_CONFIG.template > AD_CONFIG.h
1397          -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl}          -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl}
1398  Clean:  Clean:
1399          @make clean          @make clean
1400          @make cleanlinks          @make cleanlinks
1401          -rm -f Makefile.bak genmake_state genmake_optfile make.log          -rm -f Makefile.bak genmake_state genmake_*optfile make.log
1402  CLEAN:  CLEAN:
1403          @make Clean          @make Clean
1404          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
# Line 1274  CLEAN: Line 1406  CLEAN:
1406          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
1407          -rm -f \$(EXECUTABLE) output.txt          -rm -f \$(EXECUTABLE) output.txt
1408    
1409  Makefile: makefile  #eh3 Makefile: makefile
1410  makefile:  makefile:
1411          ${0} $@          ${0} $@
1412  cleanlinks:  cleanlinks:
# Line 1304  cleanlinks: Line 1436  cleanlinks:
1436  TAMC           = ${TAMC}  TAMC           = ${TAMC}
1437  TAF            = ${TAF}  TAF            = ${TAF}
1438    
1439    TAF_EXTRA      = ${TAF_EXTRA}
1440    TAMC_EXTRA     = ${TAMC_EXTRA}
1441    
1442  EOF  EOF
1443    
1444  ad_vars="AD_TAMC_FLAGS AD_TAF_FLAGS"  ad_vars="AD_TAMC_FLAGS AD_TAF_FLAGS"
# Line 1326  for i in $AD_FILES ; do Line 1461  for i in $AD_FILES ; do
1461      echo -n " $i" >> $MAKEFILE      echo -n " $i" >> $MAKEFILE
1462  done  done
1463  echo >> $MAKEFILE  echo >> $MAKEFILE
1464    rm -f ad_files
1465    
1466  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
1467    
1468    # ... AD ...
1469  ad_input_code.f: \$(F77FILES)  adall: ad_taf
1470    adtaf: ad_taf_output.f
1471    adtamc: ad_tamc_output.f
1472    
1473    ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1474            cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
1475            @make \$(F77FILES)
1476          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
1477          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f
1478    
 # ... AD ...  
1479  ad_taf_output.f: ad_input_code.f  ad_taf_output.f: ad_input_code.f
1480          \$(TAF) \$(AD_TAF_FLAGS) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1481          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f
1482    
1483  ad_taf: ad_taf_output.o \$(OBJFILES)  ad_taf: ad_taf_output.o \$(OBJFILES)
1484          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
1485    
1486  ad_tamc_output.f: ad_input_code.f  ad_tamc_output.f: ad_input_code.f
1487          \$(TAMC) \$(AD_TAMC_FLAGS) ad_input_code.f          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f
1488          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_tamc_output.f          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_tamc_output.f
1489    
1490  ad_tamc: ad_tamc_output.o \$(OBJFILES)  ad_tamc: ad_tamc_output.o \$(OBJFILES)
1491          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
1492    
1493    
1494    # ... FTL ...
1495    ftlall: ftl_taf
1496    ftltaf: ftl_taf_output.f
1497    ftltamc: ftl_tamc_output.f
1498    
1499    ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1500            cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h
1501            @make \$(F77FILES)
1502            @make \$(AD_FLOW_FILES)
1503            cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f
1504    
1505  # ... FLT ...  ftl_taf_output.f: ftl_input_code.f
1506  flt_taf_output.f: ad_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1507          \$(TAF) \$(FTL_TAF_FLAGS) ad_input_code.f          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f
         cat ad_input_code_ad.f | sed -f adjoint_sed > flt_taf_output.f  
1508    
1509  flt_taf: flt_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
1510          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) flt_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
1511    
1512  flt_tamc_output.f: ad_input_code.f  ftl_tamc_output.f: ftl_input_code.f
1513          \$(TAMC) \$(FTL_TAF_FLAGS) ad_input_code.f          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f
1514          cat ad_input_code_ad.f | sed -f adjoint_sed > flt_tamc_output.f          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f
1515    
1516  flt_tamc: flt_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
1517          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) flt_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
1518    
1519    
1520  # ... SVD ...  # ... SVD ...
1521  svd_taf_output.f: ad_input_code.f  svd: svd_taf
1522          \$(TAF) \$(SVD_TAF_FLAGS) ad_input_code.f  svd_taf_f: svd_taf_output.f
1523          cat ad_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f  
1524    svd_input_code.f: \$(SRCFILES)
1525            cmp svd_config.template AD_CONFIG.h || cat svd_config.template > AD_CONFIG.h
1526            @make \$(F77FILES)
1527            @make \$(AD_FLOW_FILES)
1528            cat \$(AD_FLOW_FILES) \$(AD_FILES) > svd_input_code.f
1529    
1530    svd_taf_output.f: svd_input_code.f
1531            \$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) svd_input_code.f
1532            cat svd_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f
1533    
1534  svd_taf: svd_taf_output.o \$(OBJFILES)  svd_taf: svd_taf_output.o \$(OBJFILES)
1535          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_SVD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS)
1536    
1537    
1538  #=========================================  #=========================================
# Line 1413  printf "\n\n# DO NOT DELETE\n" >> $MAKEF Line 1573  printf "\n\n# DO NOT DELETE\n" >> $MAKEF
1573    
1574  printf "\n===  Done  ===\n"  printf "\n===  Done  ===\n"
1575    
1576    #  Write the "template" files for the adjoint builds
1577    cat >AD_CONFIG.template <<EOF
1578    C  WARNING: This file is automatically generated by genmake2 and
1579    C    used by the Makefile rules.  Please DO NOT EDIT this file
1580    C    unless you are CERTAIN that you know what you are doing.
1581    
1582    #undef ALLOW_ADJOINT_RUN
1583    #undef ALLOW_TANGENTLINEAR_RUN
1584    #undef ALLOW_ECCO_OPTIMIZATION
1585    EOF
1586    cat >ad_config.template <<EOF
1587    C  WARNING: This file is automatically generated by genmake2 and
1588    C    used by the Makefile rules.  Please DO NOT EDIT this file
1589    C    unless you are CERTAIN that you know what you are doing.
1590    
1591    #define ALLOW_ADJOINT_RUN
1592    #undef ALLOW_TANGENTLINEAR_RUN
1593    #undef ALLOW_ECCO_OPTIMIZATION
1594    EOF
1595    cat >ftl_config.template <<EOF
1596    C  WARNING: This file is automatically generated by genmake2 and
1597    C    used by the Makefile rules.  Please DO NOT EDIT this file
1598    C    unless you are CERTAIN that you know what you are doing.
1599    
1600    #undef ALLOW_ADJOINT_RUN
1601    #define ALLOW_TANGENTLINEAR_RUN
1602    #undef ALLOW_ECCO_OPTIMIZATION
1603    EOF
1604    cat >svd_config.template <<EOF
1605    C  WARNING: This file is automatically generated by genmake2 and
1606    C    used by the Makefile rules.  Please DO NOT EDIT this file
1607    C    unless you are CERTAIN that you know what you are doing.
1608    
1609    #undef ALLOW_ADJOINT_RUN
1610    #undef ALLOW_TANGENTLINEAR_RUN
1611    #undef ALLOW_ECCO_OPTIMIZATION
1612    EOF
1613    cp AD_CONFIG.template AD_CONFIG.h
1614    
1615    
1616  #  Write the "state" for future records  #  Write the "state" for future records
1617  if test "x$DUMPSTATE" != xf ; then  if test "x$DUMPSTATE" != xf ; then

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.33

  ViewVC Help
Powered by ViewVC 1.1.22