/[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.174 by cnh, Thu Nov 6 03:55:50 2008 UTC revision 1.175 by cnh, Thu Nov 6 11:56:20 2008 UTC
# Line 2216  fi Line 2216  fi
2216    
2217  #  Here, we build the list of files to be "run through" the adjoint  #  Here, we build the list of files to be "run through" the adjoint
2218  #  compiler.  #  compiler.
2219  if test -f ./adSrcFiles.tmp ; then  if test -f ./ad_files ; then
2220      rm -f ./adSrcFiles.tmp      rm -f ./ad_files
2221  fi  fi
2222  echo "  Creating the list of files for the adjoint compiler."  echo "  Creating the list of files for the adjoint compiler."
2223  for i in $SOURCEDIRS ; do  for i in $SOURCEDIRS ; do
2224      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`
2225      for j in $list_files ; do      for j in $list_files ; do
2226          cat $i/$j >> adSrcFiles.tmp          cat $i/$j >> ad_files
2227      done      done
2228  done  done
2229  if test ! "x"$FS = "x.f" ; then  if test ! "x"$FS = "x.f" ; then
2230      cat adSrcFiles.tmp | sed -e "s/\.f/.$FS/g" > adSrcFiles.tmp_f      cat ad_files | sed -e "s/\.f/.$FS/g" > ad_files_f
2231      mv -f adSrcFiles.tmp_f adSrcFiles.tmp      mv -f ad_files_f ad_files
2232  fi  fi
2233    
2234  echo  echo
# Line 2286  if test ! -r ".links.tmp/foo" ; then Line 2286  if test ! -r ".links.tmp/foo" ; then
2286      exit 1      exit 1
2287  fi  fi
2288  rm -f .links.tmp/foo  rm -f .links.tmp/foo
   
 if test "x$OPENAD" != x ; then  
     OAD_DONT_COMPILE="/dev/null"  
     OAD_DONT_TRANSFORM="/dev/null"  
     OAD_KEEP_ORIGINAL="/dev/null"  
     OAD_CB2M_FILES="/dev/null"  
     echo "  looking for dontCompile file:  "  
     for i in "." $MODS ; do  
         if test -r $i"/dontCompile" ; then  
             OAD_DONT_COMPILE=$i"/dontCompile"  
             echo "     found $OAD_DONT_COMPILE"  
             break  
         fi  
     done  
     echo "  looking for dontTransform file:  "  
     for i in "." $MODS ; do  
         if test -r $i"/dontTransform" ; then  
             OAD_DONT_TRANSFORM=$i"/dontTransform"  
             echo "     found $OAD_DONT_TRANSFORM"  
             break  
         fi  
     done  
     echo "  looking for keepOriginal file:  "  
     for i in "." $MODS ; do  
         if test -r $i"/keepOriginal" ; then  
             OAD_KEEP_ORIGINAL=$i"/keepOriginal"  
             echo "     found $OAD_KEEP_ORIGINAL"  
             break  
         fi  
     done  
     echo "  looking for cb2mFiles:  "  
     for i in "." $MODS ; do  
         if test -r $i"/cb2mFiles" ; then  
             OAD_CB2M_FILES=$i"/cb2mFiles"  
             echo "     found $OAD_CB2M_FILES"  
             break  
         fi  
     done  
     echo "   OpenAD exceptions:  "  
 fi  
   
2289  echo "# This section creates symbolic links" > srclinks.tmp  echo "# This section creates symbolic links" > srclinks.tmp
2290  echo "" >> srclinks.tmp  echo "" >> srclinks.tmp
2291  printf 'F77_SRC_FILES = ' > F77srclist.tmp  printf 'SRCFILES = '    > srclist.inc
2292  printf 'NON_AD_F77_SRC_FILES = ' > nonADF77srclist.tmp  printf 'CSRCFILES = '   > csrclist.inc
2293  printf 'C_SRC_FILES = '   > csrclist.tmp  printf 'F90SRCFILES = ' > f90srclist.inc
2294  printf 'F90_SRC_FILES = ' > F90srclist.tmp  printf 'HEADERFILES = ' > hlist.inc
2295  printf 'H_SRC_FILES = '   > hsrclist.tmp  printf 'AD_FLOW_FILES = ' > ad_flow_files.inc
 printf 'AD_FLOW_FILES = ' > ad_flow_files.tmp  
2296  alldirs="$SOURCEDIRS $INCLUDEDIRS ."  alldirs="$SOURCEDIRS $INCLUDEDIRS ."
2297  for d in $alldirs ; do  for d in $alldirs ; do
2298      deplist=      deplist=
2299      sfiles=`( cd $d; echo *.[h,c,F] *.flow )`      sfiles=`( cd $d; echo *.[h,c,F] *.flow )`
2300      sfiles=`( echo $sfiles; cd $d; echo *.F90 )`      sfiles=`( echo $sfiles; cd $d; echo *.F90 )`
     if test "x$OPENAD" != x ; then  
         sfiles=`( echo $sfiles | grep -v _cb2m\. )`  
     fi  
2301      for sf in $sfiles ; do      for sf in $sfiles ; do
2302          if test ! -r ".links.tmp/$sf" ; then          if test ! -r ".links.tmp/$sf" ; then
2303              if test -f "$d/$sf" ; then              if test -f "$d/$sf" ; then
# Line 2377  for d in $alldirs ; do Line 2332  for d in $alldirs ; do
2332                  if test "x$ignore_f" = xf ; then                  if test "x$ignore_f" = xf ; then
2333                      extn=`echo $sf | $AWK -F. '{print $NF}'`                      extn=`echo $sf | $AWK -F. '{print $NF}'`
2334                      case $extn in                      case $extn in
2335                        F)                          F)
2336                          echo    " \\"  >> F77srclist.tmp                              echo    " \\"  >> srclist.inc
2337                          printf " $sf" >> F77srclist.tmp                              printf " $sf" >> srclist.inc
2338                          if test "x$OPENAD" != x ; then                              ;;
2339                              basename=${sf%%.F}                          F90)
2340                              isAD=`egrep ^$basename.f'[  ]*' adSrcFiles.tmp`                              echo    " \\"  >> f90srclist.inc
2341                              if test -z "$isAD" ; then                              printf " $sf" >> f90srclist.inc
2342                                  toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE}`                              ;;
2343                                  if test -z "$toBeIgnored" ; then                          c)
2344                                      echo    " \\"  >> nonADF77srclist.tmp                              echo    " \\"  >> csrclist.inc
2345                                      printf " $sf" >> nonADF77srclist.tmp                              printf " $sf" >> csrclist.inc
2346                                  else                              ;;
2347                                      echo "    not to be compiled   :  $sf"                          h)
2348                                  fi                              echo    " \\"  >> hlist.inc
2349                              else # file is initially listed as an AD file we want to exclude it                              printf " $sf" >> hlist.inc
2350                                   # or we want to retain the untransformed version                              ;;
2351                                  notToBeTransformed=`egrep ^$basename'[      ]*' ${OAD_DONT_TRANSFORM}`                          flow)
2352                                  untransformedVersionToBeKept=`egrep ^$basename'[      ]*' ${OAD_KEEP_ORIGINAL}`                              echo    " \\"  >> ad_flow_files.inc
2353                                  if test -n "$notToBeTransformed"; then                              printf " $sf" >> ad_flow_files.inc
2354                                      echo "    not to be transformed:  $sf"                              ;;
2355                                  fi                      esac
2356                                  if test -n "$untransformedVersionToBeKept" ; then                  fi
                                     echo "    original to be kept  :  $sf"  
                                 fi      
                                 if test -n "$notToBeTransformed" -o -n "$untransformedVersionToBeKept" ; then  
                                     echo    " \\"  >> nonADF77srclist.tmp  
                                     printf " $sf" >> nonADF77srclist.tmp  
                                 fi  
                             fi  
                         fi  
                         ;;  
                     F90)  
                         echo    " \\"  >> F90srclist.tmp  
                         printf " $sf" >> F90srclist.tmp  
                         ;;  
                     c)  
                         echo    " \\"  >> csrclist.tmp  
                         printf " $sf" >> csrclist.tmp  
                         ;;  
                     h)  
                         echo    " \\"  >> hsrclist.tmp  
                         printf " $sf" >> hsrclist.tmp  
                         ;;  
                     flow)  
                         echo    " \\"  >> ad_flow_files.tmp  
                         printf " $sf" >> ad_flow_files.tmp  
                         ;;  
                    esac  
                 fi  
2357              fi              fi
2358          fi          fi
2359      done      done
2360      if test "x$deplist" != x ; then      if test "x$deplist" != x ; then
2361        if test "$d" != "." ; then          echo "" >> srclinks.tmp
         echo "" >> srclinks.tmp  
2362          echo "#  These files are linked from $d" >> srclinks.tmp          echo "#  These files are linked from $d" >> srclinks.tmp
2363          echo "$deplist :" >> srclinks.tmp          echo "$deplist :" >> srclinks.tmp
2364  # We need to make sure that the link isn't already there.  # We need to make sure that the link isn't already there.
2365  # This may happen when make thinks that a header file has to be "remade"  # This may happen when make thinks that a header file has to be "remade"
2366  # because a module it depends on has changed.  In this case we do nothing.  # because a module it depends on has changed.  In this case we do nothing.
2367          printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> srclinks.tmp          printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> srclinks.tmp
       fi  
2368      fi      fi
2369  done  done
2370  rm -rf .links.tmp  rm -rf .links.tmp
2371  echo "" >> F77srclist.tmp  echo "" >> srclist.inc
2372  echo "" >> nonADF77srclist.tmp  echo "" >> csrclist.inc
2373  echo "" >> csrclist.tmp  echo "" >> f90srclist.inc
2374  echo "" >> F90srclist.tmp  echo "" >> hlist.inc
2375  echo "" >> hsrclist.tmp  echo "" >> ad_flow_files.inc
 echo "" >> ad_flow_files.tmp  
2376    
2377  if test -f $MAKEFILE ; then  if test -f $MAKEFILE ; then
2378      mv -f $MAKEFILE "$MAKEFILE.bak"      mv -f $MAKEFILE "$MAKEFILE.bak"
# Line 2547  FOPTIM = ${FOPTIM} Line 2472  FOPTIM = ${FOPTIM}
2472  # Optim./debug for FC  # Optim./debug for FC
2473  F90FLAGS = ${F90FLAGS}  F90FLAGS = ${F90FLAGS}
2474  F90OPTIM = ${F90OPTIM}  F90OPTIM = ${F90OPTIM}
 F90FIXEDFORMAT = ${F90FIXEDFORMAT}  
2475  # Flags for CC  # Flags for CC
2476  CFLAGS = ${CFLAGS}  CFLAGS = ${CFLAGS}
2477  # Files that should not be optimized  # Files that should not be optimized
# Line 2560  MAKEFILE=${MAKEFILE} Line 2484  MAKEFILE=${MAKEFILE}
2484    
2485  EOF  EOF
2486    
2487  cat F77srclist.tmp      >> $MAKEFILE  cat srclist.inc       >> $MAKEFILE
2488  cat nonADF77srclist.tmp >> $MAKEFILE  cat csrclist.inc      >> $MAKEFILE
2489  cat csrclist.tmp        >> $MAKEFILE  cat f90srclist.inc    >> $MAKEFILE
2490  cat F90srclist.tmp      >> $MAKEFILE  cat hlist.inc         >> $MAKEFILE
2491  cat hsrclist.tmp        >> $MAKEFILE  cat ad_flow_files.inc >> $MAKEFILE
 cat ad_flow_files.tmp   >> $MAKEFILE  
   
 rm -f F77srclist.tmp nonADF77srclist.tmp csrclist.tmp F90srclist.tmp hsrclist.tmp ad_flow_files.tmp  
   
2492  echo >> $MAKEFILE  echo >> $MAKEFILE
2493    echo 'F77FILES =  $(SRCFILES:.F=.'$FS')'      >> $MAKEFILE
2494  # add definitions for preprocessed sources  echo 'F90FILES =  $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE
2495  # and note that not all systems allow case sensitive extensions  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE
 # hence the $FS and $FS90 here.  
 # for fixed format f90 files we use ff90 or FF90 resp  
 # but these are not expected to be the original source files  
   
 echo 'F77_PP_SRC_FILES = $(F77_SRC_FILES:.F=.'$FS')'      >> $MAKEFILE  
 echo 'F90_PP_SRC_FILES = $(F90_SRC_FILES:.F90=.'$FS90')' >> $MAKEFILE  
 echo 'OBJFILES= $(F77_SRC_FILES:.F=.o) $(C_SRC_FILES:.c=.o) $(F90_SRC_FILES:.F90=.o)' >> $MAKEFILE  
2496  echo 'FLOFILES =  $(AD_FLOW_FILES:.flow=.flowdir)' >> $MAKEFILE  echo 'FLOFILES =  $(AD_FLOW_FILES:.flow=.flowdir)' >> $MAKEFILE
2497  echo >> $MAKEFILE  echo >> $MAKEFILE
2498  echo '.SUFFIXES:' >> $MAKEFILE  echo '.SUFFIXES:' >> $MAKEFILE
2499  echo '.SUFFIXES: .o .'$FS' .p .F .c .f'$FS90' .'$FS90' .FF90 .F90 .flowdir .flow' >> $MAKEFILE  echo '.SUFFIXES: .o .'$FS' .p .F .c .'$FS90' .F90 .flowdir .flow' >> $MAKEFILE
2500    rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc
2501    rm -f ad_flow_files.inc
2502    
2503  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
2504    
2505  all: \$(EXECUTABLE)  all: \$(EXECUTABLE)
2506  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(OBJFILES) \$(EMBEDDED_FILES)  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) \$(EMBEDDED_FILES)
2507          @echo Creating \$@ ...          @echo Creating \$@ ...
2508          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
2509  depend:  depend:
2510          @make links          @make links
2511          \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES)          \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
2512          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
2513          -rm -f makedepend.out          -rm -f makedepend.out
2514    
# Line 2603  libmitgcmuv.a: \$(OBJFILES) Line 2518  libmitgcmuv.a: \$(OBJFILES)
2518          ar rcv libmitgcmuv.a \$(OBJFILES)          ar rcv libmitgcmuv.a \$(OBJFILES)
2519          ar d   libmitgcmuv.a main.o          ar d   libmitgcmuv.a main.o
2520    
2521  links: \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(SPECIAL_FILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)
2522    
2523  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)  small_f: \$(F77FILES) \$(F90FILES)
2524    
2525  output.txt: \$(EXECUTABLE)  output.txt: \$(EXECUTABLE)
2526          @printf 'running ... '          @printf 'running ... '
# Line 2615  clean: Line 2530  clean:
2530          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template
2531          -rm -rf *.o          -rm -rf *.o
2532          -rm -rf *.$FS *.flowdir          -rm -rf *.$FS *.flowdir
         -rm -rf *.f$FS90 *_mod.h *_mod.F90 *.FF90 *.mod-whirl ad_input*  
         -rm -rf temp.sed reslice.dat  
2533  Clean:  Clean:
2534          @make clean          @make clean
2535          @make cleanlinks          @make cleanlinks
# Line 2638  makefile: Line 2551  makefile:
2551  cleanlinks:  cleanlinks:
2552          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
2553    
2554  # Special targets (SPECIAL_FILES) which are created by make  # Special targets (SPECIAL_FILES) which are create by make
2555  ${PACKAGES_DOT_H}:  ${PACKAGES_DOT_H}:
2556          @echo Creating \$@ ...          @echo Creating \$@ ...
2557          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@
# Line 2663  if test "x$EMBED_SRC" = xt ; then Line 2576  if test "x$EMBED_SRC" = xt ; then
2576    
2577  decode_files.o : EMBEDDED_FILES.h  decode_files.o : EMBEDDED_FILES.h
2578    
2579  ##  \$(F77_PP_SRC_FILES)  ##  \$(F77FILES)
2580  all_fF.tar.gz : \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile  all_fF.tar.gz : \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile
2581          @echo Creating \$@ ...          @echo Creating \$@ ...
2582          -tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile          -tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile
2583          -rm -f all_fF.tar.gz          -rm -f all_fF.tar.gz
2584          -gzip all_fF.tar          -gzip all_fF.tar
2585    
# Line 2682  cat >>$MAKEFILE <<EOF Line 2595  cat >>$MAKEFILE <<EOF
2595  # The normal chain of rules is (  .F - .$FS - .o  )  # The normal chain of rules is (  .F - .$FS - .o  )
2596    
2597  ## This nullifies any default implicit rules concerning these two file types:  ## This nullifies any default implicit rules concerning these two file types:
2598  %.o : %.F  ## %.o : %.F
2599    
2600  .F.$FS:  .F.$FS:
2601          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
2602  .$FS.o:  .$FS.o:
2603          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
2604  .F90.$FS90:  .F.o:
2605          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
2606  .FF90.f$FS90:  .F90.o:  
         \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@  
 .$FS90.o:  
2607          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<
 .f$FS90.o:  
         cp \$< \$(basename  \$<).f90  
         \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$(F90FIXEDFORMAT) \$(basename  \$<).f90  
2608  .c.o:  .c.o:
2609          \$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$<          \$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$<
2610  .flow.flowdir:  .flow.flowdir:
# Line 2708  cat >>$MAKEFILE <<EOF Line 2616  cat >>$MAKEFILE <<EOF
2616  .p.$FS:  .p.$FS:
2617          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
2618    
 EOF  
   
2619  #=========================================  #=========================================
2620  #===  Automatic Differentiation Rules  ===  #===  Automatic Differentiation Rules  ===
 #===  for TAMC/TAF  ======================  
   
 if test "x$OPENAD" == x ; then  
   
 cat >>$MAKEFILE <<EOF  
2621    
2622  TAMC           = ${TAMC}  TAMC           = ${TAMC}
2623  TAF            = ${TAF}  TAF            = ${TAF}
# Line 2755  adall: \$(EXE_AD) Line 2656  adall: \$(EXE_AD)
2656  adtaf: ad_taf_output.$FS  adtaf: ad_taf_output.$FS
2657  adtamc: ad_tamc_output.$FS  adtamc: ad_tamc_output.$FS
2658    
2659  ad_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES)  ad_input_code.$FS: \$(AD_FILES) \$(HEADERFILES)
2660          @$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
2661          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
2662          -rm -f ad_config.template          -rm -f ad_config.template
2663          @make \$(F77_PP_SRC_FILES)          @make \$(F77FILES)
2664          @make \$(FLOFILES)          @make \$(FLOFILES)
2665          cat \$(FLOFILES) \$(AD_FILES) > ad_input_code.$FS          cat \$(FLOFILES) \$(AD_FILES) > ad_input_code.$FS
2666    
# Line 2794  ftlall: ftl_taf Line 2695  ftlall: ftl_taf
2695  ftltaf: ftl_taf_output.$FS  ftltaf: ftl_taf_output.$FS
2696  ftltamc: ftl_tamc_output.$FS  ftltamc: ftl_tamc_output.$FS
2697    
2698  ftl_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES)  ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES)
2699          @$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
2700          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
2701          -rm -f ftl_config.template          -rm -f ftl_config.template
2702          @make \$(F77_PP_SRC_FILES)          @make \$(F77FILES)
2703          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
2704          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS
2705    
# Line 2847  svd_touch: Line 2748  svd_touch:
2748          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
2749          -rm -f ftl_config.template          -rm -f ftl_config.template
2750    
2751  EOF  #=========================================
   
 fi  
   
 #===  for OpenAD  ========================  
   
 if test "x$OPENAD" != x ; then  
   
 # ============ begin OpenAD specific section ==============  
   
 cat >>$MAKEFILE <<EOF  
   
 # all the source files linked from the various locations:  
 ALL_LINKED_FILES= \  
 \$(F77_SRC_FILES) \  
 \$(C_SRC_FILES) \  
 \$(H_SRC_FILES) \  
 \$(F90_SRC_FILES) \  
 \$(SPECIAL_FILES)  
   
 ifndef OPENADROOT  
   \$(error "Error:  environment variable OPENADROOT not defined!")  
 endif  
   
 ifndef XAIFSCHEMAROOT  
   \$(error "Error:  environment variable XAIFSCHEMAROOT not defined!")  
 endif  
   
 ifndef XAIFBOOSTERROOT  
   \$(error "Error:  environment variable XAIFBOOSTERROOT not defined!")  
 endif  
   
 EOF  
   
 echo "  Add the source list for common block to module conversion "  
 echo >> $MAKEFILE  
 printf "CB2M_F90_SRC_NAMES = " >> $MAKEFILE  
 for i in `cat ${OAD_CB2M_FILES}` ; do  
   echo    " \\" >> $MAKEFILE  
   printf " $i" >> $MAKEFILE  
 done  
 echo >> $MAKEFILE  
   
 echo "  Add the source list for AD code generation"  
 echo >> $MAKEFILE  
 printf "AD_FILES = " >> $MAKEFILE  
 for i in `cat ${OAD_CB2M_FILES}` ; do  
   echo    " \\" >> $MAKEFILE  
   printf " ${i}_mod.f$FS90" >> $MAKEFILE  
 done  
 AD_FILES=`cat adSrcFiles.tmp`  
 for i in $AD_FILES ; do  
   basename=${i%%.f}  
   toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE} ${OAD_DONT_TRANSFORM}`  
   if test -z "$toBeIgnored" ; then  
     echo    " \\" >> $MAKEFILE  
     printf " $i" >> $MAKEFILE  
   fi  
 done  
 echo >> $MAKEFILE  
 rm -f adSrcFiles.tmp  
   
 cat >>$MAKEFILE <<EOF  
   
 adAll: \$(EXE_AD)  
 .PHONY: adAll  
   
 CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod.f$FS90, \$(CB2M_F90_SRC_NAMES))  
   
 .PRECIOUS: \$(CB2M_F90_PP_SRC_FILES) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90)  
   
 .PHONY: adDepend  
 adDepend: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(addsuffix _mod.FF90, \$(CB2M_F90_SRC_NAMES)) \$(F77_SRC_FILES:.F=_cb2m.FF90)  
         \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES)  
         \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)  
         -rm -f makedepend.out  
   
 OPENAD_SUPPORT_F90_SRC_FILES = \  
 w2f__types.F90 \  
 OAD_active.F90 \  
 OAD_cp.F90 \  
 OAD_rev.F90 \  
 OAD_tape.F90          
   
 OPENAD_SUPPORT_C_SRC_FILES = \  
 iaddr.c \  
 timeRatio.c  
   
 f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES:F90=$FS90)  
         cat \$^ > \$@  
   
 f95_test.f90: all_mods.xb.x2w.w2f.pp.f$FS90 \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90) ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90  
         cat \$^ > \$@  
   
 f95_test.out: f95_test_mods.f90 f95_test.f90  
         f95 -fixed -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1  
         f95 -fixed -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1  
   
 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)  
   
 \$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(AD_OBJ_FILES)  
         @echo Creating \$@ ...  
         \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES) \$(LIBS)  
   
 # makefile debug rule  
 openad: ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90  
 .PHONY: openad  
   
 # create the module files  
 %_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk  
         ../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk  
   
 # create the header files  
 %_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk  
         ../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES)  
   
 # change everybody else to use the new module files:  
 %_cb2m.FF90 : %.F ../OAD_support/cb2mUseModules.bash  
         ../OAD_support/cb2mUseModules.bash $< ${MPI}  
   
 # makefile debug rule  
 small_f: \$(CB2M_F90_PP_SRC_FILES)  
 .PHONY: small_f  
   
 ad_output.txt: \$(EXE_AD)  
         @printf 'linking data files ... '  
         \$(LN) -f ../input_ad/data* ../input_ad/eedata .  
         \$(LN) -f ../../global_ocean.90x40x15/input/*.bin .  
         @printf 'running ... '  
         @./\$(EXE_AD) > \$@  
   
 CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90)  
 ad_input_code.f$FS90: ../OAD_support/maxMinDefs.f \$(CB2M_AD_FILES)  
         cat \$^ > \$@  
   
 # strip all comments and blanks to reduce  
 # the file size in order to reduce perl's memory requirements  
 ad_input_code_sf.f$FS90 : ad_input_code.f$FS90  
         cat \$^ | sed -f ../OAD_support/strip.sed | sed -f ../OAD_support/stop2print.sed > \$@  
   
 # mfef90 preprocessing  
 # expand statement functions  
 # expose mfef90 specific substring handling  
 # add the w2f__types module  
 ad_input_code_sf.w2f.f$FS90: ad_input_code_sf.f$FS90 mfef90 whirl2f whirl2f_be w2f__types.f90  
         ./mfef90 -r8 -z -F -N132 \$<  
         mv \$<.B \$(basename \$<).B  
         ./whirl2f -openad \$(basename \$<).B  
         cat w2f__types.f90 \$(basename \$<).w2f.f > \$@  
   
 # canonicalizer  
 ad_input_code_sf.w2f.canon.f$FS90: ad_input_code_sf.w2f.f$FS90 canon.v1.py  
         python canon.v1.py --r8 \$< > \$@  
   
 # F -> WHIRL  
 # note that the canonicalized version cuts off at col 72  
 # doing this also for string constants which is ok as long  
 # as we are in fixed mode and cut of exactly there.  
 # Otherwise mfef90 patches in spaces to fill up to 72 (or 132)  
 # characters respectively.  
 ad_input_code_sf.w2f.canon.B: ad_input_code_sf.w2f.canon.f$FS90 mfef90  
         ./mfef90 -r8 -z -F \$<  
         mv \$<.B \$@  
   
 # WHIRL -> XAIF  
 ad_input_code_sf.w2f.canon.xaif : ad_input_code_sf.w2f.canon.B whirl2xaif  
         ./whirl2xaif -s -n --debug 1 -o \$@ \$<  
   
 # XAIF -> XAIF'  
 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  
         ./openad_adm -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r  
   
 # XAIF' -> WHIRL'  
 ad_input_code_sf.w2f.canon.xb.x2w.B : ad_input_code_sf.w2f.canon.xb.xaif xaif2whirl  
         ./xaif2whirl --debug 1 --structured ad_input_code_sf.w2f.canon.B \$<  
   
 # WHIRL' -> F'  
 ad_input_code_sf.w2f.canon.xb.x2w.w2f.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.B whirl2f whirl2f_be  
         ./whirl2f -FLIST:ftn_file=\$@ -openad \$<  
   
 # undo slice hiding  
 # insert template directives  
 ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.f$FS90 reslicer.py ../OAD_support/insertTemplateDir.bash  
         python reslicer.py \$< > \$<.1  
         ../OAD_support/insertTemplateDir.bash \$<.1  \$@  
         rm \$<.1  
   
 # postprocess F'  
 ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.f$FS90 multi-pp.pl ../OAD_support/ad_inline.f \$(wildcard ../OAD_support/ad_template.*.f)  
         perl multi-pp.pl -inline=../OAD_support/ad_inline.f \$<  
         # the postprocessor still gets the name wrong  
         cat \$<.pp | sed 's/RETURN//' > \$@  
   
 # extract all transformed modules  
 all_mods.xb.x2w.w2f.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90  
         cat \$< | sed -n '/MODULE /,/END MODULE/p' > \$@  
   
 # remove the transformed globals module from the  
 # transformed ad_input_code file  
 # and remove for now the duplicate variables  
 # and fix 2 data statements  
 ad_input_code.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90: ad_input_code_sf.w2f.canon.xb.x2w.w2f.rs.pp.f$FS90  
         cat \$< | sed '/MODULE /,/END MODULE/d' | sed '/^      INTEGER(w2f__i4) DOLOOP_UB/d' > \$@  
   
 # setup some links  
 %.xsd:  
         \$(LN) \${XAIFSCHEMAROOT}/schema/\$@ .  
   
 mfef90:  
         \$(LN) \${OPEN64ROOT}/crayf90/sgi/mfef90 .  
   
 # link the support files:  
 \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES):  
         \$(LN) ../OAD_support/\$@ .  
   
 whirl2xaif xaif2whirl:  
         \$(LN) \${OPENADFORTTK}/bin/\$@ .  
   
 %.pl:  
         \$(LN) \${OPENADFORTTK}/bin/\$@ .  
   
 %.py:  
         \$(LN) \${OPENADROOT}/OpenADFortTk/tools/canonicalize/\$@ .  
   
 whirl2f whirl2f_be:  
         \$(LN) \${OPEN64ROOT}/whirl2f/\$@ .  
   
 openad_adm:  
         \$(LN) \${XAIFBOOSTERROOT}/xaifBooster/algorithms/BasicBlockPreaccumulationReverse/test/t \$@  
   
 # ============ end OpenAD specific section ==============  
2752    
2753  EOF  EOF
2754    
 fi  
   
 #=========================================  
   
2755  if test "x$EXEHOOK" != x ; then  if test "x$EXEHOOK" != x ; then
2756      printf "\nexehook:\n\t%s\n" $EXEHOOK >> $MAKEFILE      printf "\nexehook:\n\t%s\n" $EXEHOOK >> $MAKEFILE
2757  fi  fi

Legend:
Removed from v.1.174  
changed lines
  Added in v.1.175

  ViewVC Help
Powered by ViewVC 1.1.22