/[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.118 by edhill, Wed Feb 9 17:34:19 2005 UTC revision 1.125 by edhill, Sun Jul 10 00:15:49 2005 UTC
# Line 122  EOF Line 122  EOF
122        stop        stop
123        end        end
124  EOF  EOF
125      test -f Makefile  &&  mv -f Makefile Makefile.bak      test -f $MAKEFILE  &&  mv -f $MAKEFILE $MAKEFILE".tst"
126      cat <<EOF >> Makefile      cat <<EOF >> $MAKEFILE
127  .SUFFIXES:  .SUFFIXES:
128  .SUFFIXES: .$tfs .F  .SUFFIXES: .$tfs .F
129  .F.$tfs:  .F.$tfs:
# Line 148  EOF Line 148  EOF
148              return              return
149          fi          fi
150      fi      fi
151      rm -f genmake_hello.* Makefile      rm -f genmake_hello.* $MAKEFILE
152      test -f Makefile  &&  mv -f Makefile.bak Makefile      test -f $MAKEFILE".tst"  &&  mv -f $MAKEFILE".tst" $MAKEFILE
153    
154      #  If we make it here, use the extensions      #  If we make it here, use the extensions
155      FS=$tfs      FS=$tfs
# Line 181  look_for_makedepend()  { Line 181  look_for_makedepend()  {
181      if test "x${MAKEDEPEND}" = x ; then      if test "x${MAKEDEPEND}" = x ; then
182          which makedepend > /dev/null 2>&1          which makedepend > /dev/null 2>&1
183          RV0=$?          RV0=$?
184            test -f $MAKEFILE  &&  mv -f $MAKEFILE $MAKEFILE".tst"
185            #  echo 'MAKEFILE="'$MAKEFILE'"'
186            cat <<EOF >> $MAKEFILE
187    #   THIS IS A TEST MAKEFILE GENERATED BY "genmake2"
188    #
189    #   Some "makedepend" implementations will die if they cannot
190    #   find a Makefile -- so this file is here to gives them an
191    #   empty one to find and parse.
192    EOF
193          cat <<EOF >> genmake_tc.f          cat <<EOF >> genmake_tc.f
194        program test        program test
195        write(*,*) 'test'        write(*,*) 'test'
# Line 189  look_for_makedepend()  { Line 198  look_for_makedepend()  {
198  EOF  EOF
199          makedepend genmake_tc.f > /dev/null 2>&1          makedepend genmake_tc.f > /dev/null 2>&1
200          RV1=$?          RV1=$?
201            test -f $MAKEFILE  &&  rm -f $MAKEFILE
202            test -f $MAKEFILE".tst"  &&  mv -f $MAKEFILE".tst" $MAKEFILE
203          if test "x${RV0}${RV1}" = x00 ; then          if test "x${RV0}${RV1}" = x00 ; then
204              MAKEDEPEND=makedepend              MAKEDEPEND=makedepend
205          else          else
# Line 310  EOF Line 321  EOF
321    
322      #================================================================      #================================================================
323      #  look for possible FORTRAN compilers      #  look for possible FORTRAN compilers
324      tmp="$MITGCM_FC $FC efc 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 gfortran"
325      p_FC=      p_FC=
326      for c in $tmp ; do      for c in $tmp ; do
327          rm -f ./hello.f ./hello          rm -f ./hello.f ./hello
# Line 804  DEFINES= Line 815  DEFINES=
815  PACKAGES=  PACKAGES=
816  ENABLE=  ENABLE=
817  DISABLE=  DISABLE=
818  MAKEFILE=  # MAKEFILE=
819  #MAKEDEPEND=  # MAKEDEPEND=
820  PDEPEND=  PDEPEND=
821  DUMPSTATE=t  DUMPSTATE=t
822  PDEFAULT=  PDEFAULT=
# Line 824  NOOPTFLAGS= Line 835  NOOPTFLAGS=
835  MPI=  MPI=
836  MPIPATH=  MPIPATH=
837    
838  # DEFINES checked by test compilation  # DEFINES checked by test compilation or command-line
839  HAVE_SYSTEM=  HAVE_SYSTEM=
840  HAVE_FDATE=  HAVE_FDATE=
841  FC_NAMEMANGLE=  FC_NAMEMANGLE=
# Line 832  HAVE_CLOC= Line 843  HAVE_CLOC=
843  HAVE_STAT=  HAVE_STAT=
844  HAVE_NETCDF=  HAVE_NETCDF=
845  HAVE_ETIME=  HAVE_ETIME=
846    IGNORE_TIME=
847    
848  MODS=  MODS=
849  TOOLSDIR=  TOOLSDIR=
# Line 1080  for ac_option in "$@" ; do Line 1092  for ac_option in "$@" ; do
1092              ac_prev=TAMC_EXTRA ;;              ac_prev=TAMC_EXTRA ;;
1093          -tamc_extra=* | --tamc_extra=*)          -tamc_extra=* | --tamc_extra=*)
1094              TAMC_EXTRA=$ac_optarg ;;              TAMC_EXTRA=$ac_optarg ;;
1095            
1096            -ignoretime | -ignore_time | --ignoretime | --ignore_time)
1097                IGNORE_TIME="-DIGNORE_TIME" ;;
1098    
1099          -*)          -*)
1100              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
# Line 1095  for ac_option in "$@" ; do Line 1110  for ac_option in "$@" ; do
1110            
1111  done  done
1112    
1113    
1114  if test -f ./.genmakerc ; then  if test -f ./.genmakerc ; then
1115      echo      echo
1116      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
# Line 1136  fi Line 1152  fi
1152    
1153  #  Find the MITgcm ${THISVER}  #  Find the MITgcm ${THISVER}
1154  if test -f "${ROOTDIR}/doc/tag-index" ; then  if test -f "${ROOTDIR}/doc/tag-index" ; then
1155      THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1`      THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1`
1156    fi
1157    
1158    if test "x$MAKEFILE" = x ; then
1159        MAKEFILE="Makefile"
1160  fi  fi
1161    
1162  echo "  getting OPTFILE information:  "  echo "  getting OPTFILE information:  "
# Line 1168  if test "x$OPTFILE" != xNONE ; then Line 1188  if test "x$OPTFILE" != xNONE ; then
1188      fi      fi
1189  fi  fi
1190    
 #  Check for broken systems that cannot correctly distinguish *.F and *.f files  
 # check_for_broken_Ff  
   
1191  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:  "
1192  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1193      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" = x ; then
# Line 1198  if test "x${AD_OPTFILE}" != xNONE ; then Line 1215  if test "x${AD_OPTFILE}" != xNONE ; then
1215      fi      fi
1216  fi  fi
1217    
1218    #====================================================================
1219    #  Set default values if not set by the optfile
1220    #
1221  #  Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined.  If not,  #  Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined.  If not,
1222  #  either set defaults or complain and abort!  #  either set defaults or complain and abort!
1223  if test ! "x$BASH" = x ; then  if test ! "x$BASH" = x ; then
# Line 1371  if test "x$HAVE_NETCDF" != x ; then Line 1391  if test "x$HAVE_NETCDF" != x ; then
1391  else  else
1392      echo "no"      echo "no"
1393  fi  fi
1394    DEFINES="$DEFINES $IGNORE_TIME"
1395    
1396  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
1397  printf "  Adding MODS directories:  "  printf "  Adding MODS directories:  "
# Line 1388  for d in $MODS ; do Line 1408  for d in $MODS ; do
1408  done  done
1409  echo  echo
1410    
 if test "x$MAKEFILE" = x ; then  
     MAKEFILE="Makefile"  
 fi  
1411  if test "x${PLATFORM}" = x ; then  if test "x${PLATFORM}" = x ; then
1412      PLATFORM=$p_PLATFORM      PLATFORM=$p_PLATFORM
1413  fi  fi
# Line 1813  for i in $SOURCEDIRS ; do Line 1830  for i in $SOURCEDIRS ; do
1830          cat $i/$j >> ad_files          cat $i/$j >> ad_files
1831      done      done
1832  done  done
1833    if test ! "x"$FS = "x.f" ; then
1834        cat ad_files | sed -e "s/\.f/.$FS/g" > ad_files_f
1835        mv -f ad_files_f ad_files
1836    fi
1837    
1838  echo  echo
1839  echo "===  Creating the Makefile  ==="  echo "===  Creating the Makefile  ==="
# Line 2138  cat >>$MAKEFILE <<EOF Line 2158  cat >>$MAKEFILE <<EOF
2158    
2159  # ... AD ...  # ... AD ...
2160  adall: ad_taf  adall: ad_taf
2161  adtaf: ad_taf_output.f  adtaf: ad_taf_output.$FS
2162  adtamc: ad_tamc_output.f  adtamc: ad_tamc_output.$FS
2163    
2164  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ad_input_code.$FS: \$(AD_FILES) \$(HEADERFILES)
2165          @$BASH\$(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          @$BASH\$(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
2166          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
2167          -rm -f ad_config.template          -rm -f ad_config.template
2168          @make \$(F77FILES)          @make \$(F77FILES)
2169          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
2170          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.$FS
2171    
2172  ad_taf_output.f: ad_input_code.f  ad_taf_output.$FS: ad_input_code.$FS
2173          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
2174          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS
2175    
2176  adtafonly:  adtafonly:
2177          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
2178          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS
2179    
2180  ad_taf: ad_taf_output.o \$(OBJFILES)  ad_taf: ad_taf_output.o \$(OBJFILES)
2181          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
2182    
2183  ad_tamc_output.f: ad_input_code.f  ad_tamc_output.$FS: ad_input_code.$FS
2184          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS
2185          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.f          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.$FS
2186    
2187  ad_tamc: ad_tamc_output.o \$(OBJFILES)  ad_tamc: ad_tamc_output.o \$(OBJFILES)
2188          \$(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 2175  adtrick: Line 2195  adtrick:
2195    
2196  # ... FTL ...  # ... FTL ...
2197  ftlall: ftl_taf  ftlall: ftl_taf
2198  ftltaf: ftl_taf_output.f  ftltaf: ftl_taf_output.$FS
2199  ftltamc: ftl_tamc_output.f  ftltamc: ftl_tamc_output.$FS
2200    
2201  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES)
2202          @$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          @$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
2203          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
2204          -rm -f ftl_config.template          -rm -f ftl_config.template
2205          @make \$(F77FILES)          @make \$(F77FILES)
2206          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
2207          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS
2208    
2209  ftl_taf_output.f: ftl_input_code.f  ftl_taf_output.$FS: ftl_input_code.$FS
2210          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
2211          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS
2212    
2213  ftltafonly:  ftltafonly:
2214          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
2215          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS
2216    
2217  ftl_taf: ftl_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
2218          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
2219    
2220  ftl_tamc_output.f: ftl_input_code.f  ftl_tamc_output.$FS: ftl_input_code.$FS
2221          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS
2222          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.f          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.$FS
2223    
2224  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
2225          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
2226    
2227    
2228  # ... SVD ...  # ... SVD ...
2229  svdtaf: ad_taf_output.f ftl_taf_output.f  svdtaf: ad_taf_output.$FS ftl_taf_output.$FS
2230          @echo "--->>> Only ran TAF to generate SVD code!    <<<---"          @echo "--->>> Only ran TAF to generate SVD code!    <<<---"
2231          @echo "--->>> Do make svdall afterwards to compile. <<<---"          @echo "--->>> Do make svdall afterwards to compile. <<<---"
2232  svdall: svd_touch svd_taf  svdall: svd_touch svd_taf
# Line 2222  svd_touch: Line 2242  svd_touch:
2242          @echo "--->>> Only COMPILE svd code! <<<---"          @echo "--->>> Only COMPILE svd code! <<<---"
2243          @echo "--->>> Assumes you previously <<<---"          @echo "--->>> Assumes you previously <<<---"
2244          @echo "--->>> did make svdtaf        <<<---"          @echo "--->>> did make svdtaf        <<<---"
2245          touch ad_taf_output.f ftl_taf_output.f          touch ad_taf_output.$FS ftl_taf_output.$FS
2246          \$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.f          \$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS
2247          \$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.f          \$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS
2248          @$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          @$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
2249          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
2250          -rm -f ftl_config.template          -rm -f ftl_config.template

Legend:
Removed from v.1.118  
changed lines
  Added in v.1.125

  ViewVC Help
Powered by ViewVC 1.1.22