/[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.11.2.3 by edhill, Wed Oct 1 20:47:26 2003 UTC revision 1.13.2.3 by edhill, Mon Oct 20 21:56:24 2003 UTC
# Line 39  test_for_package_in_cpp_options() { Line 39  test_for_package_in_cpp_options() {
39     fi     fi
40  }  }
41    
42    # Read the $ROOTDIR/pkg/pkg_groups file and expand any references to
43    # the package list.
44    expand_pkg_groups() {
45        new_packages=
46        PKG_GROUPS=$ROOTDIR"/pkg/pkg_groups"
47        if test -r $PKG_GROUPS ; then
48            cat $PKG_GROUPS | sed -e 's/#.*$//g' | sed -e 's/:/ : /g' > ./p1.tmp
49            cat ./p1.tmp | awk '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp
50            matched=0
51            for i in $PACKAGES ; do
52                line=`grep "^ *$i" ./p2.tmp`
53                RETVAL=$?
54                if test "x$RETVAL" = x0 ; then
55                    matched=1
56                    replace=`echo $line | awk '{ $1=""; $2=""; print $0 }'`
57                    echo "    replacing \"$i\" with: $replace"
58                    new_packages="$new_packages $replace"
59                else
60                    new_packages="$new_packages $i"
61                fi
62            done
63            PACKAGES=$new_packages
64            rm -f ./p[1,2].tmp
65        else
66            echo "Warning: can't read package groups definition file: $PKG_GROUPS"
67        fi
68    }
69    
70  # Guess possible config options for this host  # Guess possible config options for this host
71  find_possible_configs()  {  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/'`      PLATFORM=`echo $tmp2 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
76      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
77      echo "  The platform appears to be:  $PLATFORM"      echo "  The platform appears to be:  $PLATFORM"
78  #     if test "x$OFLIST" = x ; then  #     if test "x$OFLIST" = x ; then
# Line 212  usage()  { Line 239  usage()  {
239      echo "      -disable=NAME | --disable=NAME"      echo "      -disable=NAME | --disable=NAME"
240      echo "    -enable NAME | --enable NAME"      echo "    -enable NAME | --enable NAME"
241      echo "      -enable=NAME | --enable=NAME"      echo "      -enable=NAME | --enable=NAME"
242        echo "    -standarddirs NAME | --standarddirs NAME"
243        echo "      -standarddirs=NAME | --standarddirs=NAME"
244      echo "    -noopt NAME | --noopt NAME"      echo "    -noopt NAME | --noopt NAME"
245      echo "      -noopt=NAME | --noopt=NAME"      echo "      -noopt=NAME | --noopt=NAME"
246  #    echo "    -cpp NAME | --cpp NAME"  #    echo "    -cpp NAME | --cpp NAME"
# Line 286  MODS= Line 315  MODS=
315  TOOLSDIR=  TOOLSDIR=
316  SOURCEDIRS=  SOURCEDIRS=
317  INCLUDEDIRS=  INCLUDEDIRS=
318    STANDARDDIRS=
319    
320  PWD=`pwd`  PWD=`pwd`
321  MAKE=make  MAKE=make
# Line 296  MACHINE=`uname -a` Line 326  MACHINE=`uname -a`
326  EXECUTABLE=  EXECUTABLE=
327  EXEHOOK=  EXEHOOK=
328  EXEDIR=  EXEDIR=
329    PACKAGES_CONF=
330    IEEE=
331    if test "x$MITGCM_IEEE" != x ; then
332        IEEE=$MITGCM_IEEE
333    fi
334    
335    AUTODIFF_PKG_USED=f
336    AD_OPTFILE=
337    
338  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
339  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT"
340  gm_s2="FC IEEE MPI JAM DUMPSTATE"  gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS"
341    
342  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
343  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 "
344  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
345  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"
346  gm_s6="EXECUTABLE EXEHOOK EXEDIR"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
347    
348  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6"  #  The following are all related to adjoint/tangent-linear stuff
349    gm_s7="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF DIFF_FLAGS AD_TAMC_FLAGS AD_TAF_FLAGS"
350    gm_s8="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS"
351    gm_s9=""
352    
353    gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7 $gm_s8"
354    
355    
356  echo  echo
357  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
358  gm_local="./gm_local"  gm_local="genmake_local"
359    for i in . $MODS ; do
360        if test -r $i/$gm_local ; then
361            source $i/$gm_local
362            break
363        fi
364    done
365  echo -n "  getting local config information:  "  echo -n "  getting local config information:  "
366  if test -e $gm_local ; then  if test -e $gm_local ; then
367      echo "using $gm_local"      echo "using $gm_local"
# Line 334  fi Line 383  fi
383  #   n=$(( $n + 1 ))  #   n=$(( $n + 1 ))
384  #done  #done
385  #parse_options  #parse_options
   
386  ac_prev=  ac_prev=
387  for ac_option ; do  for ac_option ; do
388    
# Line 359  for ac_option ; do Line 407  for ac_option ; do
407          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
408              OPTFILE=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
409                    
410            -adoptfile | --adoptfile | -ad | --ad)
411                ac_prev=AD_OPTFILE ;;
412            -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)
413                AD_OPTFILE=$ac_optarg ;;
414            
415          -pdepend | --pdepend)          -pdepend | --pdepend)
416              ac_prev=PDEPEND ;;              ac_prev=PDEPEND ;;
417          -pdepend=* | --pdepend=*)          -pdepend=* | --pdepend=*)
# Line 404  for ac_option ; do Line 457  for ac_option ; do
457          -enable=* | --enable=*)          -enable=* | --enable=*)
458              ENABLE=$ac_optarg ;;              ENABLE=$ac_optarg ;;
459                    
460            -standarddirs | --standarddirs)
461                ac_prev=STANDARDDIRS ;;
462            -standarddirs=* | --standarddirs=*)
463                STANDARDDIRS=$ac_optarg ;;
464    
465          -noopt | --noopt)          -noopt | --noopt)
466              ac_prev=NOOPT ;;              ac_prev=NOOPT ;;
467          -noopt=* | --noopt=*)          -noopt=* | --noopt=*)
# Line 420  for ac_option ; do Line 478  for ac_option ; do
478              FC=$ac_optarg ;;              FC=$ac_optarg ;;
479                    
480          -ieee | --ieee)          -ieee | --ieee)
481              IEEE=1 ;;              IEEE=true ;;
482          -noieee | --noieee)          -noieee | --noieee)
483              IEEE=0 ;;              IEEE= ;;
484                    
485          -mpi | --mpi)          -mpi | --mpi)
486              MPI=1 ;;              MPI=true ;;
487          -nompi | --nompi)          -nompi | --nompi)
488              MPI=0 ;;              MPI= ;;
489                    
490          -jam | --jam)          -jam | --jam)
491              JAM=1 ;;              JAM=1 ;;
# Line 451  for ac_option ; do Line 509  for ac_option ; do
509            
510  done  done
511    
512    if test -f ./.genmakerc ; then
513        echo
514        echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
515        echo "  file.  This file format is no longer supported.  Please see:"
516        echo
517        echo "    http://mitgcm.org/devel_HOWTO/"
518        echo
519        echo "  for directions on how to setup and use the new \"genmake2\" input"
520        echo "  files and send an email to MITgcm-support@mitgcm.org if you want help."
521        echo
522    fi
523    
524  if test "x${ROOTDIR}" = x ; then  if test "x${ROOTDIR}" = x ; then
525      if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then      if test "${PWD##/*/}" = "bin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then
526          ROOTDIR=".."          ROOTDIR=".."
# Line 497  if test "x$OPTFILE" != xNONE ; then Line 567  if test "x$OPTFILE" != xNONE ; then
567              exit 1              exit 1
568          fi          fi
569          if test "x$DUMPSTATE" != xf ; then          if test "x$DUMPSTATE" != xf ; then
570              cp -f $OPTFILE "gm_optfile"              cp -f $OPTFILE "genmake_optfile"
571          fi          fi
572      else      else
573          echo "Error: can't read OPTFILE=\"$OPTFILE\""          echo "Error: can't read OPTFILE=\"$OPTFILE\""
# Line 505  if test "x$OPTFILE" != xNONE ; then Line 575  if test "x$OPTFILE" != xNONE ; then
575      fi      fi
576  fi  fi
577    
578    echo "  getting AD_OPTFILE information:  "
579    if test "x${AD_OPTFILE}" = x ; then
580        if test "x$MITGCM_AD_OF" = x ; then
581            AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default
582        else
583            AD_OPTFILE=$MITGCM_AD_OF
584        fi
585    fi
586    if test "x${AD_OPTFILE}" != xNONE ; then
587        if test -f "$AD_OPTFILE" -a -r "$AD_OPTFILE" ; then
588            echo "    using AD_OPTFILE=\"$AD_OPTFILE\""
589            source "$AD_OPTFILE"
590            RETVAL=$?
591            if test "x$RETVAL" != x0 ; then
592                echo -n "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""
593                echo "--please check that variable syntax is bash-compatible"
594                exit 1
595            fi
596            if test "x$DUMPSTATE" != xf ; then
597                cp -f $AD_OPTFILE "genmake_ad_optfile"
598            fi
599        else
600            echo "Error: can't read AD_OPTFILE=\"$AD_OPTFILE\""
601            exit 1
602        fi
603    fi
604    
605  #  Check that FC, LINK, CPP, and S64 are defined.  If not, complain  #  Check that FC, LINK, CPP, and S64 are defined.  If not, complain
606  #  and abort!  #  and abort!
607  if test "x$FC" = x ; then  if test "x$FC" = x ; then
# Line 513  if test "x$FC" = x ; then Line 610  if test "x$FC" = x ; then
610  Error: no Fortran compiler: please specify using one of the following:  Error: no Fortran compiler: please specify using one of the following:
611    1) within the options file ("FC=...") as specified by "-of=OPTFILE"    1) within the options file ("FC=...") as specified by "-of=OPTFILE"
612    2) the "-fc=XXX" command-line option    2) the "-fc=XXX" command-line option
613    3) the "./gm_local" file    3) the "./genmake_local" file
614  EOF  EOF
615      exit 1      exit 1
616  fi  fi
# Line 523  fi Line 620  fi
620  if test "x$CPP" = x ; then  if test "x$CPP" = x ; then
621      CPP="cpp"      CPP="cpp"
622  fi  fi
623  echo "#define A a" | cpp > test_cpp 2>&1  echo "#define A a" | $CPP > test_cpp 2>&1
624  RETVAL=$?  RETVAL=$?
625  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
626      cat <<EOF 1>&2      cat <<EOF 1>&2
# Line 531  if test "x$RETVAL" != x0 ; then Line 628  if test "x$RETVAL" != x0 ; then
628  Error: C pre-processor "$CPP" failed the test case: please specify using:  Error: C pre-processor "$CPP" failed the test case: please specify using:
629    
630    1) within the options file ("CPP=...") as specified by "-of=OPTFILE"    1) within the options file ("CPP=...") as specified by "-of=OPTFILE"
631    2) the "./gm_local" file    2) the "./genmake_local" file
632    
633  EOF  EOF
634      exit 1      exit 1
# Line 668  else Line 765  else
765          for i in $def ; do          for i in $def ; do
766              PACKAGES="$PACKAGES $i"              PACKAGES="$PACKAGES $i"
767          done          done
768          echo "    packages are:  $PACKAGES"          echo "    before group expansion packages are: $PACKAGES"
769            expand_pkg_groups
770            echo "    after group expansion packages are:  $PACKAGES"
771      fi      fi
772  fi  fi
773    
# Line 778  for i in $PACKAGES ; do Line 877  for i in $PACKAGES ; do
877      if test -d $adr ; then      if test -d $adr ; then
878          SOURCEDIRS="$SOURCEDIRS $adr"          SOURCEDIRS="$SOURCEDIRS $adr"
879          INCLUDEDIRS="$INCLUDEDIRS $adr"          INCLUDEDIRS="$INCLUDEDIRS $adr"
880            if test "x$i" = xautodiff ; then
881                AUTODIFF_PKG_USED=t
882            fi
883      else      else
884          echo "Error: the directory \"$adr\" for package $i doesn't exist"          echo "Error: the directory \"$adr\" for package $i doesn't exist"
885          exit 1          exit 1
# Line 804  done Line 906  done
906  # echo  # echo
907    
908  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
909  PACKAGES_DOT_H=PACKAGES.h  PACKAGES_DOT_H=PACKAGES_CONFIG.h
910  if test -e $PACKAGES_DOT_H ; then  cat <<EOF >$PACKAGES_DOT_H".tmp"
     cat $PACKAGES_DOT_H \  
         | awk 'BEGIN{p=1;} ($1=="C===" && $2=="GENMAKE"){p=0;} {if (p==1) print $0}' \  
         > $PACKAGES_DOT_H".tmp"  
 fi  
 cat <<EOF >>$PACKAGES_DOT_H".tmp"  
911  C=== GENMAKE v2 ===  C=== GENMAKE v2 ===
912  C  The following defines have been set by GENMAKE, so please do not  C  The following defines have been set by GENMAKE, so please do not
913  C  edit anything below these comments.  In general, you should  C  edit anything below these comments.  In general, you should
914  C  add or remove packages by re-running genmake with different  C  add or remove packages by re-running genmake with different
915  C  "-enable" and/or "-disable" options.  C  "-enable" and/or "-disable" options.
916    
917    #ifndef PACKAGES_H
918    #define PACKAGES_H
919    
920  C  Packages disabled by genmake:  C  Packages disabled by genmake:
921  EOF  EOF
922  #  The following UGLY HACK sets multiple "#undef"s and it needs to go  #  The following UGLY HACK sets multiple "#undef"s and it needs to go
# Line 876  for i in $PACKAGES ; do Line 976  for i in $PACKAGES ; do
976  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
977    
978  done  done
979  cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H  cat <<EOF >>$PACKAGES_DOT_H".tmp"
980  RETVAL=$?  
981  if test "x$RETVAL" = x0 ; then  #endif /* PACKAGES_H */
982      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H".bak"  EOF
983    
984    if test ! -f $PACKAGES_DOT_H ; then
985      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
986    else
987        cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
988        RETVAL=$?
989        if test "x$RETVAL" = x0 ; then
990            rm -f $PACKAGES_DOT_H".tmp"
991        else
992            mv -f $PACKAGES_DOT_H $PACKAGES_DOT_H".bak"
993            mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
994        fi
995  fi  fi
996    
997  echo "  Adding STANDARDDIRS"  echo "  Adding STANDARDDIRS"
998  BUILDDIR=${BUILDDIR:-.}  BUILDDIR=${BUILDDIR:-.}
999  STANDARDDIRS=${STANDARDDIRS:-"eesupp model"}  if test "x$STANDARDDIRS" = x ; then
1000        STANDARDDIRS="eesupp model"
1001    fi
1002  for d in $STANDARDDIRS ; do  for d in $STANDARDDIRS ; do
1003      adr="$ROOTDIR/$d/src"      adr="$ROOTDIR/$d/src"
1004      if test ! -d $adr ; then      if test ! -d $adr ; then
# Line 929  for n in $names ; do Line 1042  for n in $names ; do
1042  done  done
1043    
1044    
1045    #  Here, we build the list of files to be "run through" the adjoint
1046    #  compiler.
1047    if test -f ./ad_files ; then
1048        rm -f ./ad_files
1049    fi
1050    echo "  Creating the list of files for the adjoint compiler."
1051    for i in $SOURCEDIRS ; do
1052        list_files=`( cd $i && ls -1 *.list 2>/dev/null )`
1053        for j in $list_files ; do
1054            cat $i/$j >> ad_files
1055        done
1056    done
1057    
1058    cat <<EOF > adjoint_sed
1059    s/call adopen(/call adopen ( mythid,\\
1060         \&           /g
1061    s/call adclose(/call adclose( mythid,\\
1062         \&           /g
1063    s/call adread(/call adread ( mythid,\\
1064         \&           /g
1065    s/call adwrite(/call adwrite( mythid,\\
1066         \&           /g
1067    
1068    EOF
1069    chmod +x adjoint_sed
1070    
1071    
1072  echo  echo
1073  echo "===  Creating the Makefile  ==="  echo "===  Creating the Makefile  ==="
1074  echo "  setting INCLUDES"  echo "  setting INCLUDES"
# Line 949  echo -n 'SRCFILES = '    > srclist.inc Line 1089  echo -n 'SRCFILES = '    > srclist.inc
1089  echo -n 'CSRCFILES = '   > csrclist.inc  echo -n 'CSRCFILES = '   > csrclist.inc
1090  echo -n 'F90SRCFILES = ' > f90srclist.inc  echo -n 'F90SRCFILES = ' > f90srclist.inc
1091  echo -n 'HEADERFILES = ' > hlist.inc  echo -n 'HEADERFILES = ' > hlist.inc
1092    echo -n 'AD_FLOW_FILES = ' > ad_flow_files.inc
1093  alldirs="$SOURCEDIRS $INCLUDEDIRS ."  alldirs="$SOURCEDIRS $INCLUDEDIRS ."
1094  for d in $alldirs ; do  for d in $alldirs ; do
1095      deplist=      deplist=
1096      sfiles=`( cd $d; echo *.[h,c,F] )`      sfiles=`( cd $d; echo *.[h,c,F] *.flow )`
1097      sfiles=`( echo $sfiles; cd $d; echo *.F90 )`      sfiles=`( echo $sfiles; cd $d; echo *.F90 )`
1098      for sf in $sfiles ; do      for sf in $sfiles ; do
1099          if test ! -r ".links.tmp/$sf" ; then          if test ! -r ".links.tmp/$sf" ; then
# Line 977  for d in $alldirs ; do Line 1118  for d in $alldirs ; do
1118                          echo    " \\"  >> hlist.inc                          echo    " \\"  >> hlist.inc
1119                          echo -n " $sf" >> hlist.inc                          echo -n " $sf" >> hlist.inc
1120                          ;;                          ;;
1121                        flow)
1122                            echo    " \\"  >> ad_flow_files.inc
1123                            echo -n " $sf" >> ad_flow_files.inc
1124                            ;;
1125                  esac                  esac
1126              fi              fi
1127          fi          fi
# Line 993  echo "" >> srclist.inc Line 1138  echo "" >> srclist.inc
1138  echo "" >> csrclist.inc  echo "" >> csrclist.inc
1139  echo "" >> f90srclist.inc  echo "" >> f90srclist.inc
1140  echo "" >> hlist.inc  echo "" >> hlist.inc
1141    echo "" >> ad_flow_files.inc
1142    
1143  if test -e $MAKEFILE ; then  if test -e $MAKEFILE ; then
1144      mv -f $MAKEFILE "$MAKEFILE.bak"      mv -f $MAKEFILE "$MAKEFILE.bak"
# Line 1034  EXEDIR      = ${EXEDIR} Line 1180  EXEDIR      = ${EXEDIR}
1180  EXECUTABLE  = \$(EXEDIR)/${EXECUTABLE}  EXECUTABLE  = \$(EXEDIR)/${EXECUTABLE}
1181  TOOLSDIR    = ${TOOLSDIR}  TOOLSDIR    = ${TOOLSDIR}
1182    
1183    #eh3  new defines for the adjoint work
1184    AUTODIFF    = ${ROOTDIR}/pkg/autodiff
1185    
1186  EOF  EOF
1187    
1188  #  Note: figure out some way to add Hyades JAM libraries here  #  Note: figure out some way to add Hyades JAM libraries here
# Line 1079  MAKEFILE=${MAKEFILE} Line 1228  MAKEFILE=${MAKEFILE}
1228    
1229  EOF  EOF
1230    
1231  cat srclist.inc    >> $MAKEFILE  cat srclist.inc       >> $MAKEFILE
1232  cat csrclist.inc   >> $MAKEFILE  cat csrclist.inc      >> $MAKEFILE
1233  cat f90srclist.inc >> $MAKEFILE  cat f90srclist.inc    >> $MAKEFILE
1234  cat hlist.inc      >> $MAKEFILE  cat hlist.inc         >> $MAKEFILE
1235    cat ad_flow_files.inc >> $MAKEFILE
1236    echo               >> $MAKEFILE
1237  echo 'F77FILES =  $(SRCFILES:.F=.f)'                                           >> $MAKEFILE  echo 'F77FILES =  $(SRCFILES:.F=.f)'                                           >> $MAKEFILE
1238  echo 'F90FILES =  $(F90SRCFILES:.F90=.f90)'                                    >> $MAKEFILE  echo 'F90FILES =  $(F90SRCFILES:.F90=.f90)'                                    >> $MAKEFILE
1239  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE
# Line 1115  clean: Line 1266  clean:
1266  Clean:  Clean:
1267          @make clean          @make clean
1268          @make cleanlinks          @make cleanlinks
1269          -rm -f Makefile.bak gm_state gm_optfile make.log PACKAGES.h*          -rm -f Makefile.bak genmake_state genmake_optfile make.log
1270  CLEAN:  CLEAN:
1271          @make Clean          @make Clean
1272          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
# Line 1146  cleanlinks: Line 1297  cleanlinks:
1297  .p.f:  .p.f:
1298          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
1299    
1300    #=========================================
1301    #===  Automatic Differentiation Rules  ===
1302    
1303    TAMC           = ${TAMC}
1304    TAF            = ${TAF}
1305    
1306    EOF
1307    
1308    ad_vars="AD_TAMC_FLAGS AD_TAF_FLAGS"
1309    ad_vars="$ad_vars FTL_TAMC_FLAGS FTL_TAF_FLAGS"
1310    ad_vars="$ad_vars SVD_TAMC_FLAGS SVD_TAF_FLAGS"
1311    for i in $ad_vars ; do
1312        name=$i
1313        t1="t2=\$"`echo $i`
1314        eval $t1
1315        printf "%-20s = " $name >> $MAKEFILE
1316        echo $t2 >> $MAKEFILE
1317    done
1318    
1319    echo "  Add the source list for AD code generation"
1320    echo >> $MAKEFILE
1321    echo -n "AD_FILES = " >> $MAKEFILE
1322    AD_FILES=`cat ad_files`
1323    for i in $AD_FILES ; do
1324        echo    " \\" >> $MAKEFILE
1325        echo -n " $i" >> $MAKEFILE
1326    done
1327    echo >> $MAKEFILE
1328    
1329    cat >>$MAKEFILE <<EOF
1330    
1331    # AD_FILES_SMALLF = \$(AD_FILES:.F=.f)
1332    
1333    EXE_AD_TAMC    = ${EXECUTABLE}_ad_tamc
1334    \$(EXE_AD_TAMC): \$(OBJFILES)
1335    
1336    ad_input_code.f: \$(F77FILES)
1337            @make \$(AD_FLOW_FILES)
1338            cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f
1339    
1340    ad_taf_output.f: ad_input_code.f
1341            \$(TAF) \$(AD_TAF_FLAGS) ad_input_code.f
1342            cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f
1343    
1344    ad_taf: ad_taf_output.o \$(OBJFILES)
1345            \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
1346    
1347    EXE_FTL_TAMC   = ${EXECUTABLE}_ftl_tamc
1348    EXE_FTL_TAF    = ${EXECUTABLE}_ftl_taf
1349    
1350    EXE_SVD_TAF    = ${EXECUTABLE}_ftl_taf
1351    EXE_BOTH_TAF   = ${EXECUTABLE}_ftl_taf
1352    
1353    #=========================================
1354    
1355  EOF  EOF
1356    
1357  if test "x$EXEHOOK" != x ; then  if test "x$EXEHOOK" != x ; then
# Line 1185  printf "\n===  Done  ===\n" Line 1391  printf "\n===  Done  ===\n"
1391    
1392  #  Write the "state" for future records  #  Write the "state" for future records
1393  if test "x$DUMPSTATE" != xf ; then  if test "x$DUMPSTATE" != xf ; then
1394      echo -n "" > gm_state      echo -n "" > genmake_state
1395      for i in $gm_state ; do      for i in $gm_state ; do
1396          t1="t2=\$$i"          t1="t2=\$$i"
1397          eval $t1          eval $t1
1398          echo "$i='$t2'" >> gm_state          echo "$i='$t2'" >> genmake_state
1399      done      done
1400  fi  fi

Legend:
Removed from v.1.11.2.3  
changed lines
  Added in v.1.13.2.3

  ViewVC Help
Powered by ViewVC 1.1.22