/[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.261 by jahn, Thu Aug 22 16:04:18 2013 UTC revision 1.265 by jmc, Fri Apr 4 21:34:01 2014 UTC
# Line 19  Usage: "$0" [OPTIONS] Line 19  Usage: "$0" [OPTIONS]
19      -help | --help | -h | --h      -help | --help | -h | --h
20            Print this help message and exit.            Print this help message and exit.
21    
22        -oad | --oad
23              Generate a Makefile for an OpenAD built
24    
25      -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME      -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME
26        -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME        -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME
27            Use "NAME" as the adoptfile.  By default, the file at            Use "NAME" as the adoptfile.  By default, the file at
28              "tools/adjoint_options/adjoint_oad" (for OpenAD built) or
29            "tools/adjoint_options/adjoint_default" will be used.            "tools/adjoint_options/adjoint_default" will be used.
30    
31      -nooptfile | --nooptfile      -nooptfile | --nooptfile
# Line 1325  FS= Line 1329  FS=
1329  FS90=  FS90=
1330    
1331  AUTODIFF_PKG_USED=f  AUTODIFF_PKG_USED=f
1332    OPENAD=
1333  AD_OPTFILE=  AD_OPTFILE=
1334  TAF=  TAF=
1335  AD_TAF_FLAGS=  AD_TAF_FLAGS=
# Line 1355  gm_s7="TMP THISHOST THISUSER THISDATE TH Line 1360  gm_s7="TMP THISHOST THISUSER THISDATE TH
1360  gm_s8="HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME HAVE_LAPACK HAVE_FLUSH"  gm_s8="HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME HAVE_LAPACK HAVE_FLUSH"
1361    
1362  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1363  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE OPENAD TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"
1364  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"
1365  gm_s12="TAF_EXTRA TAMC_EXTRA DIVA MPIINCLUDEDIR MPI_HEADER_FILES"  gm_s12="TAF_EXTRA TAMC_EXTRA DIVA MPIINCLUDEDIR MPI_HEADER_FILES"
1366    
# Line 1407  for ac_option in "$@" ; do Line 1412  for ac_option in "$@" ; do
1412          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
1413              OPTFILE=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
1414    
1415            -oad | --oad)
1416                OPENAD="true" ;;
1417          -adoptfile | --adoptfile | -adof | --adof)          -adoptfile | --adoptfile | -adof | --adof)
1418              ac_prev=AD_OPTFILE ;;              ac_prev=AD_OPTFILE ;;
1419          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)
# Line 1576  for ac_option in "$@" ; do Line 1583  for ac_option in "$@" ; do
1583    
1584  done  done
1585    
1586  TMP=./genmk_$$  #TMP=./genmk_$$
1587  #- try to put temporary files in system-local /tmp dir  #- try to put temporary files in system-local /tmp dir
1588  #TMP=/tmp/genmk_$$  TMP=/tmp/genmk_$$
1589  #touch $TMP ; retVal=$?  touch $TMP ; retVal=$?
1590  #if [ $retVal -eq 0 ] ; then  if [ $retVal -eq 0 ] ; then
1591  #  if test ! -r $TMP ; then TMP=./genmk_$$ ; fi    if test ! -r $TMP ; then TMP=./genmk_$$ ; fi
1592  #else  else
1593  #  TMP=./genmk_$$    TMP=./genmk_$$
1594  #fi  fi
1595  #rm -f $TMP  rm -f $TMP
1596  ##echo "  temp files: $TMP.*"  #echo "  temp files: $TMP.*"
1597    
1598  printf "  getting local config information:  "  printf "  getting local config information:  "
1599  if test -f $gm_local ; then  if test -f $gm_local ; then
# Line 1680  fi Line 1687  fi
1687    
1688  echo "  getting AD_OPTFILE information:"  echo "  getting AD_OPTFILE information:"
1689  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1690      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" != x ; then
1691            AD_OPTFILE=$MITGCM_AD_OF
1692        elif test "x$OPENAD" = x ; then
1693          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default
1694      else      else
1695          AD_OPTFILE=$MITGCM_AD_OF          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_oad
1696      fi      fi
1697  fi  fi
1698  if test "x${AD_OPTFILE}" != xNONE ; then  if test "x${AD_OPTFILE}" != xNONE ; then
# Line 2356  EOF Line 2365  EOF
2365      fi      fi
2366  fi  fi
2367    
 #  Check for package RADTRANS: if LAPACK is not available,  
 #  then issue a warning that the direct radtrans solver is not available.  
 if test "x$HAVE_LAPACK" != xt ; then  
     echo " $PACKAGES " | grep ' radtrans ' > /dev/null 2>&1  
     RETVAL=$?  
     if test "x$RETVAL" = x0 ; then  
         cat <<EOF  
 *********************************************************************  
 WARNING: the "radtrans" package was enabled but tests failed to  
   compile LAPACK applications.  This means that the direct radtrans  
   solver is not available and compilation will fail if it is enabled.  
   If you want to use the direct solver, please check that:  
   
   1) LAPACK is correctly installed for this compiler and  
   2) the LIBS variable (within the "optfile") specifies the correct  
      LAPACK library to link against.  
 *********************************************************************  
 EOF  
     fi  
 fi  
   
2368  #  Make sure the openad package is enabled if using OpenAD  #  Make sure the openad package is enabled if using OpenAD
2369  if test "x$OPENAD" != x ; then  if test "x$OPENAD" != x ; then
2370      echo " $PACKAGES " | grep ' openad ' > /dev/null 2>&1      echo " $PACKAGES " | grep ' openad ' > /dev/null 2>&1
# Line 2985  links: \$(F77_SRC_FILES) \$(C_SRC_FILES) Line 2973  links: \$(F77_SRC_FILES) \$(C_SRC_FILES)
2973    
2974  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)
2975    
2976  output.txt: \$(EXECUTABLE)  # output.txt: \$(EXECUTABLE)
2977          @printf 'running ... '  #       @printf 'running ... '
2978          @\$(EXECUTABLE) > \$@  #       @\$(EXECUTABLE) > \$@
2979    
2980  # remove most of the files that "make" generates  # remove most of the files that "make" generates
2981  clean:  clean:
# Line 3267  if test "x$OPENAD" != x ; then Line 3255  if test "x$OPENAD" != x ; then
3255  # ============ begin OpenAD specific section ==============  # ============ begin OpenAD specific section ==============
3256    
3257  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
3258    # ... OpenAD ...
3259    
3260  # all the source files linked from the various locations:  # all the source files linked from the various locations:
3261  ALL_LINKED_FILES= \  ALL_LINKED_FILES= \
# Line 3320  rm -f $TMP.adSrcFiles Line 3309  rm -f $TMP.adSrcFiles
3309    
3310  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
3311    
3312  adAll: \$(EXE_AD)  adAll: ad_exe_target
3313  .PHONY: adAll  .PHONY: adAll
3314    
3315    ad_exe_target:
3316            @echo Update AD_CONFIG.h and make \$(EXE_AD)
3317            @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Adjoint version" -bAD_CONFIG_H -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > ad_config.template
3318            @cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
3319            @-rm -f ad_config.template
3320            \$(MAKE) -f \$(MAKEFILE) \$(EXE_AD)
3321    
3322  CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod.f$FS90, \$(CB2M_F90_SRC_NAMES))  CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod.f$FS90, \$(CB2M_F90_SRC_NAMES))
3323    
3324  .PRECIOUS: \$(CB2M_F90_PP_SRC_FILES) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90)  .PRECIOUS: \$(CB2M_F90_PP_SRC_FILES) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90)
# Line 3380  AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(N Line 3376  AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(N
3376  small_f: \$(CB2M_F90_PP_SRC_FILES)  small_f: \$(CB2M_F90_PP_SRC_FILES)
3377  .PHONY: small_f  .PHONY: small_f
3378    
3379  ad_output.txt: \$(EXE_AD)  # ad_output.txt: \$(EXE_AD)
3380          @printf 'linking data files ... '  #       @printf 'linking data files ... '
3381          \$(LN) -f ../input_ad/data* ../input_ad/eedata .  #       \$(LN) -f ../input_ad/data* ../input_ad/eedata .
3382          \$(LN) -f ../../global_ocean.90x40x15/input/*.bin .  #       \$(LN) -f ../../global_ocean.90x40x15/input/*.bin .
3383          @printf 'running ... '  #       @printf 'running ... '
3384          @./\$(EXE_AD) > \$@  #       @./\$(EXE_AD) > \$@
3385    
3386  ad_input_code.f$FS90:  \$(CB2M_AD_FILES)  ad_input_code.f$FS90:  \$(CB2M_AD_FILES)
3387          cat \$^ > \$@          cat \$^ > \$@

Legend:
Removed from v.1.261  
changed lines
  Added in v.1.265

  ViewVC Help
Powered by ViewVC 1.1.22