/[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.10 by utke, Wed Jul 12 14:55:15 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 1928  for d in $alldirs ; do Line 1938  for d in $alldirs ; do
1938  done  done
1939  rm -rf .links.tmp  rm -rf .links.tmp
1940  echo "" >> F77srclist.tmp  echo "" >> F77srclist.tmp
1941    for i in `cat ${MODS}/keepOriginal`
1942    do
1943      echo   " \\" >> nonADF77srclist.tmp
1944      printf " $i" >> nonADF77srclist.tmp
1945    done  
1946  echo "" >> nonADF77srclist.tmp  echo "" >> nonADF77srclist.tmp
1947  echo "" >> csrclist.tmp  echo "" >> csrclist.tmp
1948  echo "" >> F90srclist.tmp  echo "" >> F90srclist.tmp
# Line 2280  OpenAD_tape.f90 Line 2295  OpenAD_tape.f90
2295  OPENAD_SUPPORT_C_SRC_FILES = \  OPENAD_SUPPORT_C_SRC_FILES = \
2296  iaddr.c  iaddr.c
2297    
2298    f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES)
2299            cat \$^ > \$@
2300    
2301    f95_test.f90: all_mods.xb.x2w.w2f.pp.f \$(NON_AD_F77_SRC_FILES:.F=_cb2m.ff90) ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f
2302            cat \$^ > \$@
2303    
2304    f95_test.out: f95_test_mods.f90 f95_test.f90
2305            f95 -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1
2306            f95 -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1
2307    
2308  AD_OBJ_FILES=\$(OPENAD_SUPPORT_F90_SRC_FILES:.f90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) all_mods.xb.x2w.w2f.pp.o ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.o \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o)  AD_OBJ_FILES=\$(OPENAD_SUPPORT_F90_SRC_FILES:.f90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) all_mods.xb.x2w.w2f.pp.o ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.o \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o)
2309    
2310  \$(EXE_AD): \$(AD_OBJ_FILES)  \$(EXE_AD): \$(AD_OBJ_FILES)
# Line 2311  ad_output.txt: \$(EXE_AD) Line 2336  ad_output.txt: \$(EXE_AD)
2336          @./\$(EXE_AD) > \$@          @./\$(EXE_AD) > \$@
2337    
2338  CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.ff90)  CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.ff90)
2339  ad_input_code.$FS: \$(CB2M_AD_FILES)  ad_input_code.$FS: ${MODS}/maxMinDefs.f \$(CB2M_AD_FILES)
2340  #       @$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  
2341    
2342  \$(CB2MFILES):  \$(CB2MFILES):
2343          \$(LN) \$(addprefix ../code_ad/, \$(CB2MFILES)) .          \$(LN) \$(addprefix ${MODS}/, \$(CB2MFILES)) .
2344    
2345  # strip all comments and blanks to reduce  # strip all comments and blanks to reduce
2346  # the file size in order to reduce perl's memory requirements  # the file size in order to reduce perl's memory requirements
2347  ad_input_code_sf.f : ad_input_code.f  ad_input_code_sf.f : ad_input_code.f
2348          cat \$^ | sed -f ../code_ad/strip.sed | sed -f ../code_ad/stop2print.sed > \$@          cat \$^ | sed -f ${MODS}/strip.sed | sed -f ${MODS}/stop2print.sed > \$@
2349    
2350  # mfef90 preprocessing  # mfef90 preprocessing
2351  # expand statement functions  # expand statement functions
# Line 2354  ad_input_code_sf.w2f.canon.xaif : ad_inp Line 2376  ad_input_code_sf.w2f.canon.xaif : ad_inp
2376    
2377  # XAIF -> XAIF'  # XAIF -> XAIF'
2378  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
2379          ./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 -p "recip_hFacC recip_rA"
2380    
2381  # XAIF' -> WHIRL'  # XAIF' -> WHIRL'
2382  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
2383          ./xaif2whirl --structured ad_input_code_sf.w2f.canon.B \$<          ./xaif2whirl --debug 1 --structured ad_input_code_sf.w2f.canon.B \$<
2384    
2385  # WHIRL' -> F'  # WHIRL' -> F'
2386  ad_input_code_sf.w2f.canon.xb.x2w.w2f.f: ad_input_code_sf.w2f.canon.xb.x2w.B whirl2f whirl2f_be  ad_input_code_sf.w2f.canon.xb.x2w.w2f.f: ad_input_code_sf.w2f.canon.xb.x2w.B whirl2f whirl2f_be
# Line 2366  ad_input_code_sf.w2f.canon.xb.x2w.w2f.f: Line 2388  ad_input_code_sf.w2f.canon.xb.x2w.w2f.f:
2388    
2389  # undo slice hiding  # undo slice hiding
2390  # insert template directives  # insert template directives
2391  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
2392          python reslicer.py \$< > \$<.1          python reslicer.py \$< > \$<.1
2393          ../code_ad/insertTemplateDir.bash \$<.1  \$@          ${MODS}/insertTemplateDir.bash \$<.1  \$@
2394          rm \$<.1          rm \$<.1
2395    
2396  # postprocess F'  # postprocess F'
2397  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
2398          perl multi-pp.pl -inline=../code_ad/ad_inline.f \$<          perl multi-pp.pl -inline=${MODS}/ad_inline.f \$<
2399          cat \$@ | sed 's/RETURN//' > \$@.1          cat \$@ | sed 's/RETURN//' > \$@.1
2400          mv \$@.1 \$@          mv \$@.1 \$@
2401    
# Line 2384  all_mods.xb.x2w.w2f.pp.f: ad_input_code_ Line 2406  all_mods.xb.x2w.w2f.pp.f: ad_input_code_
2406  # remove the transformed globals module from the  # remove the transformed globals module from the
2407  # transformed ad_input_code file  # transformed ad_input_code file
2408  # and remove for now the duplicate variables  # and remove for now the duplicate variables
2409  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
2410          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
2411            cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^      INTEGER(w2f__i4) DOLOOP_UB/d' | sed -f ${MODS}/fixData.sed > \$@
2412    
2413  # setup some links  # setup some links
2414  %.xsd:  %.xsd:
# Line 2396  mfef90: Line 2419  mfef90:
2419    
2420  # link the support files:  # link the support files:
2421  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) :  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) :
2422          \$(LN) ../code_ad/\$@ .          \$(LN) ${MODS}/\$@ .
2423    
2424  whirl2xaif xaif2whirl:  whirl2xaif xaif2whirl:
2425          \$(LN) \${OPENADROOT}/OpenADFortTk/OpenADFortTk-i686-Linux/bin/\$@ .          \$(LN) \${OPENADROOT}/OpenADFortTk/OpenADFortTk-x86-Linux/bin/\$@ .
2426    
2427  %.pl:  %.pl:
2428          \$(LN) \${OPENADROOT}/OpenADFortTk/OpenADFortTk-i686-Linux/bin/\$@ .          \$(LN) \${OPENADROOT}/OpenADFortTk/OpenADFortTk-x86-Linux/bin/\$@ .
2429    
2430  %.py:  %.py:
2431          \$(LN) \${OPENADROOT}/OpenADFortTk/tools/canonicalize/\$@ .          \$(LN) \${OPENADROOT}/OpenADFortTk/tools/canonicalize/\$@ .

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

  ViewVC Help
Powered by ViewVC 1.1.22