/[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.218 by jmc, Sun Dec 26 01:04:45 2010 UTC revision 1.228 by jmc, Tue Jan 17 22:55:39 2012 UTC
# Line 96  Usage: "$0" [OPTIONS] Line 96  Usage: "$0" [OPTIONS]
96            will search for a working compiler by trying a list of            will search for a working compiler by trying a list of
97            "usual suspects" such as gcc, c89, cc, etc.            "usual suspects" such as gcc, c89, cc, etc.
98    
     -[no]ieee | --[no]ieee  
           Do or don't use IEEE numerics.  Note that this option  
           *only* works if it is supported by the OPTFILE that  
           is being used.  
   
99      -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4      -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4
100            Use "real*4" type for _RS variable (#undef REAL4_IS_SLOW)            Use "real*4" type for _RS variable (#undef REAL4_IS_SLOW)
101            *only* works if CPP_EEOPTIONS.h allows this.            *only* works if CPP_EEOPTIONS.h allows this.
# Line 126  Usage: "$0" [OPTIONS] Line 121  Usage: "$0" [OPTIONS]
121      -hpmt | --hpmt      -hpmt | --hpmt
122            Performance analysis with the HPM Toolkit            Performance analysis with the HPM Toolkit
123    
124      -gsl | --gsl      -ieee | --ieee
125            Use GSL to control floating point rounding and precision            use IEEE numerics.  Note that this option *only* works
126              if it is supported by the OPTFILE that is being used.
127      -devel | --devel      -devel | --devel
128            Add additional warning and debugging flags for development            Add additional warning and debugging flags for development
129              (if supported by the OPTFILE); also switch to IEEE numerics.
130        -gsl | --gsl
131              Use GSL to control floating point rounding and precision
132    
133      -mpi | --mpi      -mpi | --mpi
134            Include MPI header files and link to MPI libraries            Include MPI header files and link to MPI libraries
# Line 298  EOF Line 297  EOF
297  .F.$tfs:  .F.$tfs:
298          $LN \$< \$@          $LN \$< \$@
299  EOF  EOF
300      $MAKE "genmake_hello."$tfs > /dev/null 2>&1      $MAKE -f $MAKEFILE "genmake_hello."$tfs > /dev/null 2>&1
301      RETVAL=$?      RETVAL=$?
302      if test "x$RETVAL" != x0 -o ! -f "genmake_hello."$tfs ; then      if test "x$RETVAL" != x0 -o ! -f "genmake_hello."$tfs ; then
303          if test "x$FS" = x ; then          if test "x$FS" = x ; then
# Line 359  look_for_makedepend()  { Line 358  look_for_makedepend()  {
358                  MAKEDEPEND=                  MAKEDEPEND=
359              fi              fi
360          else          else
361                echo "${MAKEDEPEND}" | grep 'tools.xmakedepend' > /dev/null 2>&1
362                RETVAL=$?
363                if test "x$RETVAL" = x0 ; then
364                    MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
365                fi
366              echo " -->     MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE              echo " -->     MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE
367          fi          fi
368      fi      fi
# Line 1124  MACHINE=`uname -a` Line 1128  MACHINE=`uname -a`
1128  EXECUTABLE=  EXECUTABLE=
1129  EXEHOOK=  EXEHOOK=
1130  EXEDIR=  EXEDIR=
 PACKAGES_CONF=  
1131  IEEE=  IEEE=
1132  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
1133      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
# Line 1146  SVD_TAMC_FLAGS= Line 1149  SVD_TAMC_FLAGS=
1149  TAMC_EXTRA=  TAMC_EXTRA=
1150    
1151  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1152  gm_s1="OPTFILE PKG_DEPEND PKG_GROUPS MAKEFILE MAKEDEPEND PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PKG_DEPEND PKG_GROUPS DISABLE ENABLE MAKEFILE MAKEDEPEND PLATFORM"
1153  gm_s2="FC CC IEEE USE_R4 TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS"  gm_s2="FC CC MPI OMP USE_R4 TS PAPIS PCLS PAPI PCL HPMT IEEE DEVEL GSL FEXTRAFLAGS"
1154    gm_s3="ROOTDIR STANDARDDIRS MODS DUMPSTATE"
1155    
1156  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1157  gm_s3="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM FEXTRAFLAGS"  gm_s4="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM"
1158  gm_s4="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"
1159  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD THISHOST THISUSER THISDATE THISVER MACHINE"  gm_s6="TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK"
1160  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s7="PWD THISHOST THISUSER THISDATE THISVER MACHINE"
1161  gm_s7="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME"  gm_s8="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME"
1162    
1163  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1164  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"
1165  gm_s11="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"
1166  gm_s12="TAF_EXTRA TAMC_EXTRA"  gm_s12="TAF_EXTRA TAMC_EXTRA"
1167    
1168  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7"  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7 $gm_s8"
1169  gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"  gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"
1170    
1171  cat <<EOF  cat <<EOF
# Line 1311  for ac_option in "$@" ; do Line 1315  for ac_option in "$@" ; do
1315          -fs90=* | --fs90=*)          -fs90=* | --fs90=*)
1316              FS90=$ac_optarg ;;              FS90=$ac_optarg ;;
1317                    
1318            -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 )
1319                USE_R4=true ;;
1320    
1321          -ieee | --ieee)          -ieee | --ieee)
1322              IEEE=true ;;              IEEE=true ;;
1323          -noieee | --noieee)          -noieee | --noieee)
1324              IEEE= ;;              echo "Warning: ignore option '$ac_option' (default is already without '-ieee')" ;;
1325            -devel | --devel)
1326          -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 )              IEEE=true ; DEVEL=true ;;
1327              USE_R4=true ;;          -gsl | --gsl)
1328                GSL=true ;;
1329    
1330          -ts | --ts)          -ts | --ts)
1331              TS=true ;;              TS=true ;;
# Line 1334  for ac_option in "$@" ; do Line 1342  for ac_option in "$@" ; do
1342          -hpmt | --hpmt)          -hpmt | --hpmt)
1343              HPMT=true ;;              HPMT=true ;;
1344    
         -gsl | --gsl)  
             GSL=true ;;  
   
         -devel | --devel)  
             DEVEL=true ;;  
   
1345          -mpi | --mpi)          -mpi | --mpi)
1346              MPI=true ;;              MPI=true ;;
1347          -mpi=* | --mpi=*)          -mpi=* | --mpi=*)
# Line 1355  for ac_option in "$@" ; do Line 1357  for ac_option in "$@" ; do
1357          -ds | --ds)          -ds | --ds)
1358              DUMPSTATE=t ;;              DUMPSTATE=t ;;
1359                    
1360            -extra_flag | --extra_flag)
1361                ac_prev=FEXTRAFLAGS ;;
1362            -extra_flag=* | --extra_flag=*)
1363                FEXTRAFLAGS=$ac_optarg ;;
1364            
1365          -taf_extra | --taf_extra)          -taf_extra | --taf_extra)
1366              ac_prev=TAF_EXTRA ;;              ac_prev=TAF_EXTRA ;;
1367          -taf_extra=* | --taf_extra=*)          -taf_extra=* | --taf_extra=*)
# Line 1390  if test -f ./.genmakerc ; then Line 1397  if test -f ./.genmakerc ; then
1397      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
1398      echo "  file.  This file format is no longer supported.  For directions on"      echo "  file.  This file format is no longer supported.  For directions on"
1399      echo "  how to setup and use the new \"genmake2\" script, please see:"      echo "  how to setup and use the new \"genmake2\" script, please see:"
1400      echo "    http://mitgcm.org/devel_HOWTO/"      echo "    http://mitgcm.org/public/devel_HOWTO/"
1401      echo "  and send an email to MITgcm-support@mitgcm.org if you need help."      echo "  and send an email to MITgcm-support@mitgcm.org if you need help."
1402      echo "WARNING: ignore \"./.genmakerc\" and continue."      echo "WARNING: ignore \"./.genmakerc\" and continue."
1403      echo      echo
# Line 1438  if test "x$MAKEFILE" = x ; then Line 1445  if test "x$MAKEFILE" = x ; then
1445      MAKEFILE="Makefile"      MAKEFILE="Makefile"
1446  fi  fi
1447    
1448  echo "  getting OPTFILE information:  "  echo "  getting OPTFILE information:"
1449  if test "x${OPTFILE}" = x ; then  if test "x${OPTFILE}" = x ; then
1450      if test "x$MITGCM_OF" = x ; then      if test "x$MITGCM_OF" = x ; then
1451          echo "Warning: no OPTFILE specified so we'll look for possible settings"          echo "Warning: no OPTFILE specified so we'll look for possible settings"
# Line 1467  if test "x$OPTFILE" != xNONE ; then Line 1474  if test "x$OPTFILE" != xNONE ; then
1474      fi      fi
1475  fi  fi
1476    
1477  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:"
1478  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1479      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" = x ; then
1480          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default
# Line 1515  EOF Line 1522  EOF
1522  fi  fi
1523  if test "x$GET_FC_VERSION" != x ; then  if test "x$GET_FC_VERSION" != x ; then
1524    echo "Get compiler version using: $FC $GET_FC_VERSION" >> $LOGFILE    echo "Get compiler version using: $FC $GET_FC_VERSION" >> $LOGFILE
1525    $FC $GET_FC_VERSION >> $LOGFILE 2>&1    ff=`echo $FC | sed 's/ .*//'` ; xx=`echo $ff | sed 's/^./& /' | sed 's/ .*//'`
1526      if test $xx != '/' ; then which $ff >> $LOGFILE ; fi
1527      $FC $GET_FC_VERSION > genmake_fc_vers1 2> genmake_fc_vers2
1528      if test -s genmake_fc_vers1 ; then
1529        cat genmake_fc_vers1 >> $LOGFILE
1530      else
1531        cat genmake_fc_vers2 >> $LOGFILE
1532      fi
1533    echo "<-- compiler version ----" >> $LOGFILE    echo "<-- compiler version ----" >> $LOGFILE
1534      rm -f genmake_fc_vers1 genmake_fc_vers2
1535  fi  fi
1536    
1537  if test "x$CC" = x ; then  if test "x$CC" = x ; then
# Line 2643  NOOPTFILES = ${NOOPTFILES} Line 2658  NOOPTFILES = ${NOOPTFILES}
2658  NOOPTFLAGS = ${NOOPTFLAGS}  NOOPTFLAGS = ${NOOPTFLAGS}
2659  # Flags and libraries needed for linking  # Flags and libraries needed for linking
2660  LIBS = ${LIBS}  LIBS = ${LIBS}
2661  # Name of the Mekfile  # Name of the makefile
2662  MAKEFILE=${MAKEFILE}  MAKEFILE=${MAKEFILE}
2663    
2664  EOF  EOF
# Line 2679  all: \$(EXECUTABLE) Line 2694  all: \$(EXECUTABLE)
2694  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(OBJFILES) \$(EMBEDDED_FILES)  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(OBJFILES) \$(EMBEDDED_FILES)
2695          @echo Creating \$@ ...          @echo Creating \$@ ...
2696          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
2697    
2698  depend:  depend:
2699          @make links          @make -f \$(MAKEFILE) links
2700          \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES)          \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES)
2701          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
2702          -rm -f makedepend.out          -rm -f makedepend.out
# Line 2691  libmitgcmuv.a: \$(OBJFILES) Line 2707  libmitgcmuv.a: \$(OBJFILES)
2707          ar rcv libmitgcmuv.a \$(OBJFILES)          ar rcv libmitgcmuv.a \$(OBJFILES)
2708          ar d   libmitgcmuv.a main.o          ar d   libmitgcmuv.a main.o
2709    
2710    obj: \$(OBJFILES)
2711    
2712  links: \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(SPECIAL_FILES)  links: \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(SPECIAL_FILES)
2713    
2714  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)
# Line 2708  clean: Line 2726  clean:
2726    
2727  # remove most of the files that "make" and "make depend" generate  # remove most of the files that "make" and "make depend" generate
2728  Clean:  Clean:
2729          @make clean          @make -f \$(MAKEFILE) clean
2730          @make cleanlinks          @make -f \$(MAKEFILE) cleanlinks
2731          -rm -f \$(SPECIAL_FILES) f90mkdepend.log $MAKEFILE.old          -rm -f \$(SPECIAL_FILES) f90mkdepend.log $MAKEFILE.old
2732          -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log          -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log
2733          -rm -f genmake_warnings genmake_errors make.log          -rm -f genmake_warnings genmake_errors make.log
# Line 2717  Clean: Line 2735  Clean:
2735  # remove also the executable, files that "genmake2" generates (except Makefile)  # remove also the executable, files that "genmake2" generates (except Makefile)
2736  #         and output from a run (plus log files from testreport)  #         and output from a run (plus log files from testreport)
2737  CLEAN:  CLEAN:
2738          @make Clean          @make -f \$(MAKEFILE) Clean
2739          -rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak          -rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak
2740          -rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log          -rm -f $LOGFILE genmake_state genmake_*optfile
2741            -rm -f SIZE.h.mpi genmake.tr_log make.tr_log
2742          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
2743          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
2744          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
# Line 2855  ad_input_code.$FS: \$(AD_FILES) \$(H_SRC Line 2874  ad_input_code.$FS: \$(AD_FILES) \$(H_SRC
2874          @$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
2875          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
2876          -rm -f ad_config.template          -rm -f ad_config.template
2877          @make \$(F77_PP_SRC_FILES)          @make -f \$(MAKEFILE) \$(F77_PP_SRC_FILES)
2878          @make \$(FLOFILES)          @make -f \$(MAKEFILE) \$(FLOFILES)
2879          cat \$(FLOFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS          cat \$(FLOFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS
2880    
2881  ad_taf_output.$FS: ad_input_code.$FS  ad_taf_output.$FS: ad_input_code.$FS
# Line 2885  adonlyfwd: Line 2904  adonlyfwd:
2904  adtrick:  adtrick:
2905          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff
2906    
2907    adobj: ad_taf_output.o \$(OBJFILES)
2908    
2909  # ... FTL ...  # ... FTL ...
2910  ftlall: ftl_taf  ftlall: ftl_taf
2911  ftltaf: ftl_taf_output.$FS  ftltaf: ftl_taf_output.$FS
# Line 2894  ftl_input_code.$FS: \$(AD_FILES) \$(H_SR Line 2915  ftl_input_code.$FS: \$(AD_FILES) \$(H_SR
2915          @$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
2916          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
2917          -rm -f ftl_config.template          -rm -f ftl_config.template
2918          @make \$(F77_PP_SRC_FILES)          @make -f \$(MAKEFILE) \$(F77_PP_SRC_FILES)
2919          @make \$(AD_FLOW_FILES)          @make -f \$(MAKEFILE) \$(AD_FLOW_FILES)
2920          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS
2921    
2922  ftl_taf_output.$FS: ftl_input_code.$FS  ftl_taf_output.$FS: ftl_input_code.$FS
# Line 3154  postProcess.tag: ad_input_code_sf.w2f.pr Line 3175  postProcess.tag: ad_input_code_sf.w2f.pr
3175          # this step also creates the file postProcess.make but we cannot          # this step also creates the file postProcess.make but we cannot
3176          # name it as the target or else make will try to remake it for          # name it as the target or else make will try to remake it for
3177          # the include directive above for any rule, e.g. make clean          # the include directive above for any rule, e.g. make clean
3178          ./postProcess.py --progress --timing --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$<          ./postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$<
3179    
3180  # setup some links  # setup some links
3181  %.xsd:  %.xsd:
# Line 3247  if test "x$DUMPSTATE" = xt ; then Line 3268  if test "x$DUMPSTATE" = xt ; then
3268      for i in $gm_state ; do      for i in $gm_state ; do
3269          t1="t2=\$$i"          t1="t2=\$$i"
3270          eval $t1          eval $t1
3271          echo "$i='$t2'" >> genmake_state          echo "$i='$t2'" | sed -e 's/  */ /g' >> genmake_state
3272      done      done
3273  fi  fi

Legend:
Removed from v.1.218  
changed lines
  Added in v.1.228

  ViewVC Help
Powered by ViewVC 1.1.22