/[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.20 by heimbach, Wed Oct 22 15:27:07 2003 UTC revision 1.27 by edhill, Tue Nov 4 18:40:58 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 104  find_possible_configs()  { Line 105  find_possible_configs()  {
105      fi      fi
106    
107      # look for possible fortran compilers      # look for possible fortran compilers
108      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"
109      p_FC=      p_FC=
110      for c in $tmp ; do      for c in $tmp ; do
111          rm -f ./hello.f ./hello          rm -f ./hello.f ./hello
# Line 121  EOF Line 122  EOF
122              p_FC="$p_FC $c"              p_FC="$p_FC $c"
123          fi          fi
124      done      done
125        rm -f ./hello.f ./hello
126      if test "x${p_FC}" = x ; then      if test "x${p_FC}" = x ; then
127          cat 1>&2 <<EOF          cat 1>&2 <<EOF
128    
# Line 908  for i in $PACKAGES ; do Line 910  for i in $PACKAGES ; do
910      fi      fi
911  done  done
912    
 #  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  
913    
914  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
915  PACKAGES_DOT_H=PACKAGES_CONFIG.h  PACKAGES_DOT_H=PACKAGES_CONFIG.h
# Line 969  for n in $names ; do Line 953  for n in $names ; do
953                  mom_vecinv)                  mom_vecinv)
954                      DEFINES="$DEFINES -DDISABLE_MOM_VECINV"                      DEFINES="$DEFINES -DDISABLE_MOM_VECINV"
955                      ;;                      ;;
                 debug)  
                     DEFINES="$DEFINES -DDISABLE_DEBUGMODE"  
                     ;;  
956              esac              esac
957  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
958    
# Line 1040  for d in $STANDARDDIRS ; do Line 1021  for d in $STANDARDDIRS ; do
1021      fi      fi
1022  done  done
1023    
1024  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"
1025  echo " of \"#define ALLOW_PKGNAME\"-type statements:"  echo "    of \"#define ALLOW_PKGNAME\"-type statements:"
1026  CPP_OPTIONS=  CPP_OPTIONS=
1027  spaths=". $INCLUDEDIRS"  spaths=". $INCLUDEDIRS"
1028  for i in $spaths ; do  for i in $spaths ; do
# Line 1172  echo "# by the command:" >> $MAKEFILE Line 1153  echo "# by the command:" >> $MAKEFILE
1153  echo "#    $0 $@" >> $MAKEFILE  echo "#    $0 $@" >> $MAKEFILE
1154  echo "# executed by:" >> $MAKEFILE  echo "# executed by:" >> $MAKEFILE
1155  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE
1156    
1157    EXE_AD=$EXECUTABLE"_ad"
1158    EXE_FTL=$EXECUTABLE"_ftl"
1159    EXE_SVD=$EXECUTABLE"_svd"
1160    
1161  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
1162  #  #
1163  # BUILDDIR     : Directory where object files are written  # BUILDDIR     : Directory where object files are written
# Line 1202  TOOLSDIR    = ${TOOLSDIR} Line 1188  TOOLSDIR    = ${TOOLSDIR}
1188    
1189  #eh3  new defines for the adjoint work  #eh3  new defines for the adjoint work
1190  AUTODIFF    = ${ROOTDIR}/pkg/autodiff  AUTODIFF    = ${ROOTDIR}/pkg/autodiff
1191    EXE_AD      = ${EXE_AD}
1192    EXE_FTL     = ${EXE_FTL}
1193    EXE_SVD     = ${EXE_SVD}
1194    
1195  EOF  EOF
1196    
# Line 1283  output.txt: \$(EXECUTABLE) Line 1272  output.txt: \$(EXECUTABLE)
1272          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
1273    
1274  clean:  clean:
1275            -cat AD_CONFIG.template > AD_CONFIG.h
1276          -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl}          -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl}
1277  Clean:  Clean:
1278          @make clean          @make clean
1279          @make cleanlinks          @make cleanlinks
1280          -rm -f Makefile.bak genmake_state genmake_optfile make.log          -rm -f Makefile.bak genmake_state genmake_*optfile make.log
1281  CLEAN:  CLEAN:
1282          @make Clean          @make Clean
1283          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
# Line 1350  for i in $AD_FILES ; do Line 1340  for i in $AD_FILES ; do
1340      echo -n " $i" >> $MAKEFILE      echo -n " $i" >> $MAKEFILE
1341  done  done
1342  echo >> $MAKEFILE  echo >> $MAKEFILE
1343    rm -f ad_files
1344    
1345  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
1346    
1347  ad_input_code.f: \$(F77FILES)  # ... AD ...
1348    adall: ad_taf
1349    adtaf: ad_taf_output.f
1350    adtamc: ad_tamc_output.f
1351    
1352    ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1353            cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
1354            @make \$(F77FILES)
1355          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
1356          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f
1357    
 # ... AD ...  
1358  ad_taf_output.f: ad_input_code.f  ad_taf_output.f: ad_input_code.f
1359          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1360          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
1361    
1362  ad_taf: ad_taf_output.o \$(OBJFILES)  ad_taf: ad_taf_output.o \$(OBJFILES)
1363          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
1364    
1365  ad_tamc_output.f: ad_input_code.f  ad_tamc_output.f: ad_input_code.f
1366          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f
1367          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
1368    
1369  ad_tamc: ad_tamc_output.o \$(OBJFILES)  ad_tamc: ad_tamc_output.o \$(OBJFILES)
1370          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
1371    
1372    
1373  # ... FTL ...  # ... FTL ...
1374  ftl_taf_output.f: ad_input_code.f  ftlall: ftl_taf
1375          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f  ftltaf: ftl_taf_output.f
1376          cat ad_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f  ftltamc: ftl_tamc_output.f
1377    
1378    ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1379            cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h
1380            @make \$(F77FILES)
1381            @make \$(AD_FLOW_FILES)
1382            cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f
1383    
1384    ftl_taf_output.f: ftl_input_code.f
1385            \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1386            cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f
1387    
1388  ftl_taf: ftl_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
1389          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
1390    
1391  ftl_tamc_output.f: ad_input_code.f  ftl_tamc_output.f: ftl_input_code.f
1392          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f
1393          cat ad_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f
1394    
1395  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
1396          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
1397    
1398    
1399  # ... SVD ...  # ... SVD ...
1400  svd_taf_output.f: ad_input_code.f  svd: svd_taf
1401          \$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f  svd_taf_f: svd_taf_output.f
1402          cat ad_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f  
1403    svd_input_code.f: \$(SRCFILES)
1404            cmp svd_config.template AD_CONFIG.h || cat svd_config.template > AD_CONFIG.h
1405            @make \$(F77FILES)
1406            @make \$(AD_FLOW_FILES)
1407            cat \$(AD_FLOW_FILES) \$(AD_FILES) > svd_input_code.f
1408    
1409    svd_taf_output.f: svd_input_code.f
1410            \$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) svd_input_code.f
1411            cat svd_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f
1412    
1413  svd_taf: svd_taf_output.o \$(OBJFILES)  svd_taf: svd_taf_output.o \$(OBJFILES)
1414          \$(LINK) -o ${EXECUTABLE} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_SVD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS)
1415    
1416    
1417  #=========================================  #=========================================
# Line 1436  printf "\n\n# DO NOT DELETE\n" >> $MAKEF Line 1452  printf "\n\n# DO NOT DELETE\n" >> $MAKEF
1452    
1453  printf "\n===  Done  ===\n"  printf "\n===  Done  ===\n"
1454    
1455    #  Write the "template" files for the adjoint builds
1456    cat >AD_CONFIG.template <<EOF
1457    C  WARNING: This file is automatically generated by genmake2 and
1458    C    used by the Makefile rules.  Please DO NOT EDIT this file
1459    C    unless you are CERTAIN that you know what you are doing.
1460    
1461    #undef ALLOW_ADJOINT_RUN
1462    #undef ALLOW_TANGENTLINEAR_RUN
1463    #undef ALLOW_ECCO_OPTIMIZATION
1464    EOF
1465    cat >ad_config.template <<EOF
1466    C  WARNING: This file is automatically generated by genmake2 and
1467    C    used by the Makefile rules.  Please DO NOT EDIT this file
1468    C    unless you are CERTAIN that you know what you are doing.
1469    
1470    #define ALLOW_ADJOINT_RUN
1471    #undef ALLOW_TANGENTLINEAR_RUN
1472    #undef ALLOW_ECCO_OPTIMIZATION
1473    EOF
1474    cat >ftl_config.template <<EOF
1475    C  WARNING: This file is automatically generated by genmake2 and
1476    C    used by the Makefile rules.  Please DO NOT EDIT this file
1477    C    unless you are CERTAIN that you know what you are doing.
1478    
1479    #undef ALLOW_ADJOINT_RUN
1480    #define ALLOW_TANGENTLINEAR_RUN
1481    #undef ALLOW_ECCO_OPTIMIZATION
1482    EOF
1483    cat >svd_config.template <<EOF
1484    C  WARNING: This file is automatically generated by genmake2 and
1485    C    used by the Makefile rules.  Please DO NOT EDIT this file
1486    C    unless you are CERTAIN that you know what you are doing.
1487    
1488    #undef ALLOW_ADJOINT_RUN
1489    #undef ALLOW_TANGENTLINEAR_RUN
1490    #undef ALLOW_ECCO_OPTIMIZATION
1491    EOF
1492    cp AD_CONFIG.template AD_CONFIG.h
1493    
1494    
1495  #  Write the "state" for future records  #  Write the "state" for future records
1496  if test "x$DUMPSTATE" != xf ; then  if test "x$DUMPSTATE" != xf ; then

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.27

  ViewVC Help
Powered by ViewVC 1.1.22