/[MITgcm]/MITgcm_contrib/heimbach/OpenAD/code_shallow_openad/genmake2
ViewVC logotype

Diff of /MITgcm_contrib/heimbach/OpenAD/code_shallow_openad/genmake2

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.2 by utke, Wed Dec 14 19:54:42 2005 UTC revision 1.5 by utke, Wed Jan 18 17:28:52 2006 UTC
# Line 1  Line 1 
1    
2  #! /usr/bin/env bash  #! /usr/bin/env bash
3  #  #
4  # $Header$  # $Header$
# Line 923  EOF Line 924  EOF
924    
925  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
926  gm_local="genmake_local"  gm_local="genmake_local"
927    modsCount=0
928  for i in . $MODS ; do  for i in . $MODS ; do
929      if test -r $i/$gm_local ; then      if test -r $i/$gm_local ; then
930          . $i/$gm_local          . $i/$gm_local
931          break          break
932      fi      fi
933        let modsCount=modsCount+1
934  done  done
935    if test modsCount -gt 1 ; then
936      echo "ERROR: some uses of MODS break with more than one directory specified"
937      exit -1;
938    fi
939  printf "  getting local config information:  "  printf "  getting local config information:  "
940  if test -f $gm_local ; then  if test -f $gm_local ; then
941      echo "using $gm_local"      echo "using $gm_local"
# Line 1897  for d in $alldirs ; do Line 1904  for d in $alldirs ; do
1904                          basename=${sf%%.F}                          basename=${sf%%.F}
1905                          isAD=`egrep ^$basename.f'[      ]*' adSrcFiles.tmp`                          isAD=`egrep ^$basename.f'[      ]*' adSrcFiles.tmp`
1906                          if test -z "$isAD" ; then                          if test -z "$isAD" ; then
1907                            echo    " \\"  >> nonADF77srclist.tmp                            toBeIgnored=`egrep ^$basename'[      ]*' ${MODS}/dontCompile`
1908                            printf " $sf" >> nonADF77srclist.tmp                            if test -z "$toBeIgnored" ; then
1909                                echo    " \\"  >> nonADF77srclist.tmp
1910                                printf " $sf" >> nonADF77srclist.tmp
1911                              fi
1912                          fi                          fi
1913                          ;;                          ;;
1914                      F90)                      F90)
# Line 2311  ad_output.txt: \$(EXE_AD) Line 2321  ad_output.txt: \$(EXE_AD)
2321          @./\$(EXE_AD) > \$@          @./\$(EXE_AD) > \$@
2322    
2323  CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.ff90)  CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.ff90)
2324  ad_input_code.$FS: \$(CB2M_AD_FILES)  ad_input_code.$FS: ${MODS}/maxMinDefs.f \$(CB2M_AD_FILES)
2325  #       @$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          cat \$^ > \$@
 #       cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h  
 #       -rm -f ad_config.template  
         cat ../code_ad/maxMinDefs.f \$(CB2M_AD_FILES) > ad_input_code.$FS  
2326    
2327  \$(CB2MFILES):  \$(CB2MFILES):
2328          \$(LN) \$(addprefix ../code_ad/, \$(CB2MFILES)) .          \$(LN) \$(addprefix ${MODS}/, \$(CB2MFILES)) .
2329    
2330  # strip all comments and blanks to reduce  # strip all comments and blanks to reduce
2331  # the file size in order to reduce perl's memory requirements  # the file size in order to reduce perl's memory requirements
2332  ad_input_code_sf.f : ad_input_code.f  ad_input_code_sf.f : ad_input_code.f
2333          cat \$^ | sed -f ../code_ad/strip.sed | sed -f ../code_ad/stop2print.sed > \$@          cat \$^ | sed -f ${MODS}/strip.sed | sed -f ${MODS}/stop2print.sed > \$@
2334    
2335  # mfef90 preprocessing  # mfef90 preprocessing
2336  # expand statement functions  # expand statement functions
# Line 2354  ad_input_code_sf.w2f.canon.xaif : ad_inp Line 2361  ad_input_code_sf.w2f.canon.xaif : ad_inp
2361    
2362  # XAIF -> XAIF'  # XAIF -> XAIF'
2363  ad_input_code_sf.w2f.canon.xb.xaif : ad_input_code_sf.w2f.canon.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd openad_adm  ad_input_code_sf.w2f.canon.xb.xaif : ad_input_code_sf.w2f.canon.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd openad_adm
2364          ./openad_adm -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I          ./openad_adm -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r
2365    
2366  # XAIF' -> WHIRL'  # XAIF' -> WHIRL'
2367  ad_input_code_sf.w2f.canon.xb.x2w.B : ad_input_code_sf.w2f.canon.xb.xaif xaif2whirl  ad_input_code_sf.w2f.canon.xb.x2w.B : ad_input_code_sf.w2f.canon.xb.xaif xaif2whirl
# Line 2366  ad_input_code_sf.w2f.canon.xb.x2w.w2f.f: Line 2373  ad_input_code_sf.w2f.canon.xb.x2w.w2f.f:
2373    
2374  # undo slice hiding  # undo slice hiding
2375  # insert template directives  # insert template directives
2376  ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.f reslicer.py ../code_ad/insertTemplateDir.bash  ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.f reslicer.py ${MODS}/insertTemplateDir.bash
2377          python reslicer.py \$< > \$<.1          python reslicer.py \$< > \$<.1
2378          ../code_ad/insertTemplateDir.bash \$<.1  \$@          ${MODS}/insertTemplateDir.bash \$<.1  \$@
2379          rm \$<.1          rm \$<.1
2380    
2381  # postprocess F'  # postprocess F'
2382  ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f multi-pp.pl ../code_ad/ad_inline.f ../code_ad/ad_template.checkpoint.f ../code_ad/ad_template.plain.f ../code_ad/ad_template.split.f  ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f multi-pp.pl ${MODS}/ad_inline.f ${MODS}/ad_template.checkpoint.f ${MODS}/ad_template.plain.f ${MODS}/ad_template.split.f ${MODS}/ad_template.sa_cg2d.f
2383          perl multi-pp.pl -inline=../code_ad/ad_inline.f \$<          perl multi-pp.pl -inline=${MODS}/ad_inline.f \$<
2384          cat \$@ | sed 's/RETURN//' > \$@.1          cat \$@ | sed 's/RETURN//' > \$@.1
2385          mv \$@.1 \$@          mv \$@.1 \$@
2386    
# Line 2384  all_mods.xb.x2w.w2f.pp.f: ad_input_code_ Line 2391  all_mods.xb.x2w.w2f.pp.f: ad_input_code_
2391  # remove the transformed globals module from the  # remove the transformed globals module from the
2392  # transformed ad_input_code file  # transformed ad_input_code file
2393  # and remove for now the duplicate variables  # and remove for now the duplicate variables
2394  ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f  # and fix 2 data statements
2395          cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^      INTEGER(w2f__i4) DOLOOP_UB/d' > \$@  ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f ${MODS}/fixData.sed
2396            cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^      INTEGER(w2f__i4) DOLOOP_UB/d' | sed -f ${MODS}/fixData.sed > \$@
2397    
2398  # setup some links  # setup some links
2399  %.xsd:  %.xsd:
# Line 2396  mfef90: Line 2404  mfef90:
2404    
2405  # link the support files:  # link the support files:
2406  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) :  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) :
2407          \$(LN) ../code_ad/\$@ .          \$(LN) ${MODS}/\$@ .
2408    
2409  whirl2xaif xaif2whirl:  whirl2xaif xaif2whirl:
2410          \$(LN) \${OPENADROOT}/OpenADFortTk/OpenADFortTk-i686-Linux/bin/\$@ .          \$(LN) \${OPENADROOT}/OpenADFortTk/OpenADFortTk-i686-Linux/bin/\$@ .

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.22