/[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.241 by utke, Wed Sep 19 20:46:03 2012 UTC revision 1.244 by jmc, Wed Oct 10 22:24:59 2012 UTC
# Line 1092  EOF Line 1092  EOF
1092      echo " --> set HAVE_LAPACK='$HAVE_LAPACK'" >> $LOGFILE      echo " --> set HAVE_LAPACK='$HAVE_LAPACK'" >> $LOGFILE
1093  }  }
1094    
1095    check_HAVE_FLUSH()  {
1096        if test ! "x$SKIP_CHECK_FLUSH" = x ; then
1097            return
1098        fi
1099        echo >> $LOGFILE
1100        echo "running: check_HAVE_FLUSH()" >> $LOGFILE
1101        cat <<EOF > genmake_tflsh.$FS
1102          program fgenflsh
1103          integer iounit
1104          character*9 fname
1105          iounit = 26
1106          fname = 'tmp.tflsh'
1107          open(iounit,FILE=fname,STATUS='unknown')
1108          write(iounit,*) 'genmake_tflsh: hello'
1109          call flush(iounit)
1110          close(iounit)
1111          end
1112    EOF
1113        echo "===  genmake_tflsh.$FS  >>>" > genmake_tflsh.log
1114        cat genmake_tflsh.$FS >> genmake_tflsh.log
1115        echo "<<<  genmake_tflsh.$FS  ===" >> genmake_tflsh.log
1116    
1117        echo "$FC $FFLAGS $FOPTIM -c genmake_tflsh.$FS  \ " >> genmake_tflsh.log
1118        echo "  &&  $LINK $FFLAGS $FOPTIM -o genmake_tflsh.o $LIBS" >> genmake_tflsh.log
1119        $FC $FFLAGS $FOPTIM -c genmake_tflsh.$FS >> genmake_tflsh.log 2>&1  \
1120            &&  $LINK $FFLAGS $FOPTIM -o genmake_tflsh genmake_tflsh.o $LIBS >> genmake_tflsh.log 2>&1
1121        RET_COMPILE=$?
1122    
1123        if test "x$RET_COMPILE" = x0 ; then
1124            HAVE_FLUSH=t
1125            #cat genmake_tflsh.log >> $LOGFILE
1126            echo "  check_HAVE_FLUSH: successful" >> $LOGFILE
1127        else
1128            HAVE_FLUSH=f
1129            cat genmake_tflsh.log >> $LOGFILE
1130        fi
1131        rm -f genmake_tflsh*
1132        echo " --> set HAVE_FLUSH='$HAVE_FLUSH'" >> $LOGFILE
1133    }
1134    
1135  ###############################################################################  ###############################################################################
1136  #   Sequential part of script starts here  #   Sequential part of script starts here
# Line 1160  HAVE_NETCDF= Line 1199  HAVE_NETCDF=
1199  HAVE_ETIME=  HAVE_ETIME=
1200  IGNORE_TIME=  IGNORE_TIME=
1201  HAVE_LAPACK=  HAVE_LAPACK=
1202    HAVE_FLUSH=
1203    
1204  MODS=  MODS=
1205  TOOLSDIR=  TOOLSDIR=
# Line 1213  gm_s3="FEXTRAFLAGS IEEE DEVEL GSL TS PAP Line 1253  gm_s3="FEXTRAFLAGS IEEE DEVEL GSL TS PAP
1253  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1254  gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM"  gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM"
1255  gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"
1256  gm_s6="TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK"  gm_s6="PWD TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK"
1257  gm_s7="PWD THISHOST THISUSER THISDATE THISVER MACHINE"  gm_s7="THISHOST THISUSER THISDATE THISVER MACHINE FC_NAMEMANGLE"
1258  gm_s8="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME HAVE_LAPACK"  gm_s8="HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME HAVE_LAPACK HAVE_FLUSH"
1259    
1260  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1261  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"
# Line 1883  if test "x$HAVE_LAPACK" != x ; then Line 1923  if test "x$HAVE_LAPACK" != x ; then
1923  else  else
1924      echo "no"      echo "no"
1925  fi  fi
 DEFINES="$DEFINES $IGNORE_TIME"  
1926    
1927    printf "  Can we call FLUSH intrinsic subroutine...  "
1928    check_HAVE_FLUSH
1929    if test "x$HAVE_FLUSH" = xt ; then
1930        DEFINES="$DEFINES -DHAVE_FLUSH"
1931        echo "yes"
1932    else
1933        echo "no"
1934    fi
1935    
1936    DEFINES="$DEFINES $IGNORE_TIME"
1937  if test "x$EMBED_SRC" = xt ; then  if test "x$EMBED_SRC" = xt ; then
1938      build_embed_encode      build_embed_encode
1939  fi  fi
# Line 2482  if test "x$OPENAD" != x ; then Line 2531  if test "x$OPENAD" != x ; then
2531      OAD_DONT_TRANSFORM="/dev/null"      OAD_DONT_TRANSFORM="/dev/null"
2532      OAD_KEEP_ORIGINAL="/dev/null"      OAD_KEEP_ORIGINAL="/dev/null"
2533      OAD_CB2M_FILES="/dev/null"      OAD_CB2M_FILES="/dev/null"
2534        OADTOOLS="$TOOLSDIR/OAD_support"
2535        test -f "oadtempflile"  &&  \rm -f "oadtempflile"
2536    cat >> "oadtempflile" <<EOF
2537    $OADTOOLS
2538    EOF
2539      echo "  looking for dontCompile file:  "      echo "  looking for dontCompile file:  "
2540      for i in "." $MODS ; do      for i in "." $MODS ; do
2541          if test -r $i"/dontCompile" ; then          if test -r $i"/dontCompile" ; then
# Line 2689  INCLUDEDIRS = ${INCLUDEDIRS} Line 2743  INCLUDEDIRS = ${INCLUDEDIRS}
2743  EXEDIR      = ${EXEDIR}  EXEDIR      = ${EXEDIR}
2744  EXECUTABLE  = \$(EXEDIR)/${EXECUTABLE}  EXECUTABLE  = \$(EXEDIR)/${EXECUTABLE}
2745  TOOLSDIR    = ${TOOLSDIR}  TOOLSDIR    = ${TOOLSDIR}
2746    OADTOOLS    = ${OADTOOLS}
2747    
2748  #eh3  new defines for the adjoint work  #eh3  new defines for the adjoint work
2749  AUTODIFF    = ${ROOTDIR}/pkg/autodiff  AUTODIFF    = ${ROOTDIR}/pkg/autodiff
# Line 2894  cat >>$MAKEFILE <<EOF Line 2949  cat >>$MAKEFILE <<EOF
2949  ## This nullifies any default implicit rules concerning these two file types:  ## This nullifies any default implicit rules concerning these two file types:
2950  ## %.o : %.F  ## %.o : %.F
2951    
2952  # C preprocessing and replacing the _d in constants:  # C preprocessing and replacing the _d in constants:
2953  CPPCMD = cat \$< | ${CPP} \$(DEFINES) \$(INCLUDES) | ${S64}  CPPCMD = cat \$< | ${CPP} \$(DEFINES) \$(INCLUDES) | ${S64}
2954    
2955  .F.$FS:  .F.$FS:
# Line 3185  AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(N Line 3240  AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(N
3240          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS)
3241    
3242  # create sources files modules from header files containing common blocks  # create sources files modules from header files containing common blocks
3243  %_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk  %_mod.FF90 : %.h \${OADTOOLS}/cb2mGetModules.csh \${OADTOOLS}/cb2mGetModules.awk
3244          ../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk          \${OADTOOLS}/cb2mGetModules.csh $< \${OADTOOLS}/cb2mGetModules.awk
3245    
3246  # create new header files with USE statements for the new modules made above  # create new header files with USE statements for the new modules made above
3247  %_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk  %_mod.h : %.h \${OADTOOLS}/cb2mGetHeaders.csh \${OADTOOLS}/cb2mGetHeaders.awk
3248          ../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES)          \${OADTOOLS}/cb2mGetHeaders.csh $< \${OADTOOLS}/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES)
3249    
3250  # change the include directives of everybody to refer to  the new header files with the USE statements  # change the include directives of everybody to refer to  the new header files with the USE statements
3251  %_cb2m.FF90 : %.F ../OAD_support/cb2mUseModules.bash  %_cb2m.FF90 : %.F \${OADTOOLS}/cb2mUseModules.bash
3252          ../OAD_support/cb2mUseModules.bash $< ${MPI}          \${OADTOOLS}/cb2mUseModules.bash $< ${MPI}
3253    
3254  # makefile debug rule  # makefile debug rule
3255  small_f: \$(CB2M_F90_PP_SRC_FILES)  small_f: \$(CB2M_F90_PP_SRC_FILES)
# Line 3216  ad_input_code_sf.pre.f90 : \$(CB2M_AD_FI Line 3271  ad_input_code_sf.pre.f90 : \$(CB2M_AD_FI
3271    
3272  # replace stop statements (to avoid the implied unstructured control flow)  with print statements  # replace stop statements (to avoid the implied unstructured control flow)  with print statements
3273  ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90  ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90
3274          cat \$< | sed -f ../OAD_support/stop2print.sed > ad_input_code_sf.pre.s2p.f90          cat \$< | sed -f \${OADTOOLS}/stop2print.sed > ad_input_code_sf.pre.s2p.f90
3275    
3276  # F -> WHIRL  # F -> WHIRL
3277  ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90  ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90
# Line 3239  ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS Line 3294  ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS
3294          \${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$<          \${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$<
3295    
3296  # insert template directives  # insert template directives
3297  ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash  ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 \${OADTOOLS}/insertTemplateDir.bash
3298          ../OAD_support/insertTemplateDir.bash \$< \$@          \${OADTOOLS}/insertTemplateDir.bash \$< \$@
3299    
3300  PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F  PPEXTRAS=\$(wildcard \${OADTOOLS}/ad_template.*.F) \${OADTOOLS}/ad_inline.F
3301  # postprocess F'  # postprocess F'
3302  postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90  postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90
3303          \${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i ../OAD_support/ad_inline.f \$<          \${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i \${OADTOOLS}/ad_inline.f \$<
3304          # the target is a placeholder to trigger a single execution of the rule          # the target is a placeholder to trigger a single execution of the rule
3305          touch \$@          touch \$@
3306  # put this so make knows about the postprocessing output  # put this so make knows about the postprocessing output
# Line 3257  OAD_intrinsics_oad.f \$(CB2M_AD_FILES:.f Line 3312  OAD_intrinsics_oad.f \$(CB2M_AD_FILES:.f
3312    
3313  # link the support files:  # link the support files:
3314  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES):  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES):
3315          \$(LN) ../OAD_support/\$@ .          \$(LN) \${OADTOOLS}/\$@ .
3316    
3317  AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag \$(PPEXTRAS:.F=.f)  AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag \$(PPEXTRAS:.F=.f)
3318    

Legend:
Removed from v.1.241  
changed lines
  Added in v.1.244

  ViewVC Help
Powered by ViewVC 1.1.22