/[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.43 by edhill, Sun Nov 23 20:01:50 2003 UTC revision 1.44 by adcroft, Mon Nov 24 14:54:12 2003 UTC
# Line 941  fi Line 941  fi
941  if test "x$S64" = x ; then  if test "x$S64" = x ; then
942      S64='$(TOOLSDIR)/set64bitConst.sh'      S64='$(TOOLSDIR)/set64bitConst.sh'
943  fi  fi
944    THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'`
945    
946  EXECUTABLE=${EXECUTABLE:-mitgcmuv}  EXECUTABLE=${EXECUTABLE:-mitgcmuv}
947    
# Line 1164  EOF Line 1165  EOF
1165  #  statements could be separated and handled only by genmake.  #  statements could be separated and handled only by genmake.
1166  names=`ls -1 "$ROOTDIR/pkg"`  names=`ls -1 "$ROOTDIR/pkg"`
1167  all_pack=  all_pack=
1168    DISABLED_PACKAGES=
1169  for n in $names ; do  for n in $names ; do
1170      if test -d "$ROOTDIR/pkg/$n" -a "x$n" != xCVS ; then      if test -d "$ROOTDIR/pkg/$n" -a "x$n" != xCVS ; then
1171          has_pack="f"          has_pack="f"
# Line 1176  for n in $names ; do Line 1178  for n in $names ; do
1178          if test "x$has_pack" = xf ; then          if test "x$has_pack" = xf ; then
1179              undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`              undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`
1180              echo "#undef $undef" >> $PACKAGES_DOT_H".tmp"              echo "#undef $undef" >> $PACKAGES_DOT_H".tmp"
1181                DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef"
1182          fi          fi
1183      fi      fi
1184  done  done
# Line 1183  cat <<EOF >>$PACKAGES_DOT_H".tmp" Line 1186  cat <<EOF >>$PACKAGES_DOT_H".tmp"
1186    
1187  C  Packages enabled by genmake:  C  Packages enabled by genmake:
1188  EOF  EOF
1189    ENABLED_PACKAGES=
1190  for i in $PACKAGES ; do  for i in $PACKAGES ; do
1191      def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'`      def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'`
1192      echo "#define $def" >> $PACKAGES_DOT_H".tmp"      echo "#define $def" >> $PACKAGES_DOT_H".tmp"
1193        ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def"
1194  #eh3 DEFINES="$DEFINES -D$def"  #eh3 DEFINES="$DEFINES -D$def"
1195    
1196  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
# Line 1278  for i in $SOURCEDIRS ; do Line 1283  for i in $SOURCEDIRS ; do
1283      done      done
1284  done  done
1285    
 cat <<EOF > adjoint_sed  
 s/call adopen(/call adopen ( mythid,\\  
      \&           /g  
 s/call adclose(/call adclose( mythid,\\  
      \&           /g  
 s/call adread(/call adread ( mythid,\\  
      \&           /g  
 s/call adwrite(/call adwrite( mythid,\\  
      \&           /g  
   
 EOF  
   
1286  echo  echo
1287  echo "===  Creating the Makefile  ==="  echo "===  Creating the Makefile  ==="
1288  echo "  setting INCLUDES"  echo "  setting INCLUDES"
# Line 1319  for d in $alldirs ; do Line 1312  for d in $alldirs ; do
1312      for sf in $sfiles ; do      for sf in $sfiles ; do
1313          if test ! -r ".links.tmp/$sf" ; then          if test ! -r ".links.tmp/$sf" ; then
1314              if test -f "$d/$sf" ; then              if test -f "$d/$sf" ; then
1315                    case $d/$sf in
1316                      ./$PACKAGES_DOT_H)
1317                            ;;
1318                      ./AD_CONFIG.h)
1319                            ;;
1320                      ./FC_NAMEMANGLE.h)
1321                            ;;
1322                      *)
1323                            touch .links.tmp/$sf
1324                            deplist="$deplist $sf"
1325                            ;;
1326                    esac
1327                  extn=`echo $sf | $AWK -F '.' '{print $NF}'`                  extn=`echo $sf | $AWK -F '.' '{print $NF}'`
                 touch .links.tmp/$sf  
                 deplist="$deplist $sf"  
1328                  case $extn in                  case $extn in
1329                      F)                      F)
1330                          echo    " \\"  >> srclist.inc                          echo    " \\"  >> srclist.inc
# Line 1412  EXE_AD      = ${EXE_AD} Line 1415  EXE_AD      = ${EXE_AD}
1415  EXE_FTL     = ${EXE_FTL}  EXE_FTL     = ${EXE_FTL}
1416  EXE_SVD     = ${EXE_SVD}  EXE_SVD     = ${EXE_SVD}
1417    
1418    ENABLED_PACKAGES = ${ENABLED_PACKAGES}
1419    DISABLED_PACKAGES = ${DISABLED_PACKAGES}
1420    
1421  EOF  EOF
1422    
1423  #  Note: figure out some way to add Hyades JAM libraries here  #  Note: figure out some way to add Hyades JAM libraries here
# Line 1476  cat >>$MAKEFILE <<EOF Line 1482  cat >>$MAKEFILE <<EOF
1482  .SUFFIXES: .o .f .p .F .c .F90 .f90  .SUFFIXES: .o .f .p .F .c .F90 .f90
1483    
1484  all: \$(EXECUTABLE)  all: \$(EXECUTABLE)
1485  \$(EXECUTABLE): \$(OBJFILES)  \$(EXECUTABLE): links \$(OBJFILES)
1486            @echo Creating \$@ ...
1487          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
1488  depend:  depend:
1489          @make links          @make links
1490          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
1491          ${TOOLSDIR}/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
1492    
1493  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) ${PACKAGES_DOT_H} AD_CONFIG.h
1494    
1495  small_f: \$(F77FILES) \$(F90FILES)  small_f: \$(F77FILES) \$(F90FILES)
1496    
# Line 1492  output.txt: \$(EXECUTABLE) Line 1499  output.txt: \$(EXECUTABLE)
1499          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
1500    
1501  clean:  clean:
1502          -cat AD_CONFIG.template > AD_CONFIG.h          -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} *.template
         -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl}  
1503  Clean:  Clean:
1504          @make clean          @make clean
1505          @make cleanlinks          @make cleanlinks
1506            -rm -f ${PACKAGES_DOT_H} AD_CONFIG.h
1507          -rm -f Makefile.bak genmake_state genmake_*optfile genmake_warnings make.log          -rm -f Makefile.bak genmake_state genmake_*optfile genmake_warnings make.log
1508  CLEAN:  CLEAN:
1509          @make Clean          @make Clean
# Line 1507  CLEAN: Line 1514  CLEAN:
1514    
1515  #eh3 Makefile: makefile  #eh3 Makefile: makefile
1516  makefile:  makefile:
1517          ${0} $@          $THIS_SCRIPT $@
1518  cleanlinks:  cleanlinks:
1519          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
1520    
1521    # Special targets
1522    ${PACKAGES_DOT_H}:
1523            @echo Creating \$@ ...
1524            @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warngin - this file is automatically generated - do NOT edit" "Enabled packages:" \$(ENABLED_PACKAGES) " " "Disabled packages:" \$(DISABLED_PACKAGES) > \$@
1525    AD_CONFIG.h:
1526            @echo Creating \$@ ...
1527            @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@
1528    
1529  # The normal chain of rules is (  .F - .f - .o  )  # The normal chain of rules is (  .F - .f - .o  )
1530  .F.f:  .F.f:
1531          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
# Line 1570  adtaf: ad_taf_output.f Line 1585  adtaf: ad_taf_output.f
1585  adtamc: ad_tamc_output.f  adtamc: ad_tamc_output.f
1586    
1587  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1588            @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template
1589          cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h          cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
1590            -rm -f ad_config.template
1591          @make \$(F77FILES)          @make \$(F77FILES)
1592          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
1593          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f
1594    
1595  ad_taf_output.f: ad_input_code.f  ad_taf_output.f: ad_input_code.f
1596          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1597          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f
1598    
1599  adtafonly:  adtafonly:
1600          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1601          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f
1602    
1603  ad_taf: ad_taf_output.o \$(OBJFILES)  ad_taf: ad_taf_output.o \$(OBJFILES)
1604          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
1605    
1606  ad_tamc_output.f: ad_input_code.f  ad_tamc_output.f: ad_input_code.f
1607          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f
1608          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_tamc_output.f          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.f
1609    
1610  ad_tamc: ad_tamc_output.o \$(OBJFILES)  ad_tamc: ad_tamc_output.o \$(OBJFILES)
1611          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
# Line 1600  ftltaf: ftl_taf_output.f Line 1617  ftltaf: ftl_taf_output.f
1617  ftltamc: ftl_tamc_output.f  ftltamc: ftl_tamc_output.f
1618    
1619  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1620            @\$(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
1621          cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h          cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h
1622            -rm -f ftl_config.template
1623          @make \$(F77FILES)          @make \$(F77FILES)
1624          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
1625          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f
1626    
1627  ftl_taf_output.f: ftl_input_code.f  ftl_taf_output.f: ftl_input_code.f
1628          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1629          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f
1630    
1631  ftltafonly:  ftltafonly:
1632          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1633          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f
1634    
1635  ftl_taf: ftl_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
1636          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
1637    
1638  ftl_tamc_output.f: ftl_input_code.f  ftl_tamc_output.f: ftl_input_code.f
1639          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f
1640          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.f
1641    
1642  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
1643          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.44

  ViewVC Help
Powered by ViewVC 1.1.22