/[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.259 by jahn, Tue Aug 20 17:27:03 2013 UTC revision 1.272 by heimbach, Fri Jul 3 21:33:55 2015 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        -nocat4ad | -dog4ad | -ncad | -dad
26              do not concatenate (cat) source code sent to TAF
27              resulting in compilation of multiple files
28    
29      -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME      -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME
30        -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME        -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME
31            Use "NAME" as the adoptfile.  By default, the file at            Use "NAME" as the adoptfile.  By default, the file at
32              "tools/adjoint_options/adjoint_oad" (for OpenAD built) or
33            "tools/adjoint_options/adjoint_default" will be used.            "tools/adjoint_options/adjoint_default" will be used.
34    
35      -nooptfile | --nooptfile      -nooptfile | --nooptfile
# Line 208  test_for_string_in_file() { Line 216  test_for_string_in_file() {
216  expand_pkg_groups() {  expand_pkg_groups() {
217      new_packages=      new_packages=
218      if test -r $PKG_GROUPS ; then      if test -r $PKG_GROUPS ; then
219          cat $PKG_GROUPS | sed -e 's/#.*$//g' | sed -e 's/:/ : /g' > ./p1.tmp          cat $PKG_GROUPS | sed -e 's/#.*$//g' | sed -e 's/:/ : /g' > $TMP.p1
220          cat ./p1.tmp | $AWK '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp          cat $TMP.p1 | $AWK '(NF>2 && $2==":"){ print $0 }' > $TMP.p2
221          matched=0          matched=0
222          for i in $PACKAGES ; do          for i in $PACKAGES ; do
223              line=`grep "^ *$i" ./p2.tmp`              line=`grep "^ *$i" $TMP.p2`
224              RETVAL=$?              RETVAL=$?
225              if test "x$RETVAL" = x0 ; then              if test "x$RETVAL" = x0 ; then
226                  matched=1                  matched=1
# Line 224  expand_pkg_groups() { Line 232  expand_pkg_groups() {
232              fi              fi
233          done          done
234          PACKAGES=$new_packages          PACKAGES=$new_packages
235          rm -f ./p[1,2].tmp          rm -f $TMP.p[1,2]
236          return $matched          return $matched
237      else      else
238          echo "Warning: can't read package groups definition file: $PKG_GROUPS"          echo "Warning: can't read package groups definition file: $PKG_GROUPS"
# Line 1079  EOF Line 1087  EOF
1087  }  }
1088    
1089  check_lapack_libs()  {  check_lapack_libs()  {
1090      if test ! "x$SKIP_LAPACK_CHECK" = x ; then      if test "x$CHECK_FOR_LAPACK" = xf ; then return ; fi
         return  
     fi  
1091      echo >> $LOGFILE      echo >> $LOGFILE
1092      echo "running: check_lapack_libs()" >> $LOGFILE      echo "running: check_lapack_libs()" >> $LOGFILE
1093      cat <<EOF > genmake_tla.F      cat <<EOF > genmake_tla.F
# Line 1277  GSL= Line 1283  GSL=
1283  DEVEL=  DEVEL=
1284  HAVE_TEST_L=  HAVE_TEST_L=
1285    
1286  # comment this line out to enable lapack test  # set this to "t" to enable lapack test
1287  SKIP_LAPACK_CHECK=t  CHECK_FOR_LAPACK=f
1288    
1289  # DEFINES checked by test compilation or command-line  # DEFINES checked by test compilation or command-line
1290  HAVE_SYSTEM=  HAVE_SYSTEM=
# Line 1325  FS= Line 1331  FS=
1331  FS90=  FS90=
1332    
1333  AUTODIFF_PKG_USED=f  AUTODIFF_PKG_USED=f
1334    OPENAD=
1335    OPENAD_DIVA=
1336  AD_OPTFILE=  AD_OPTFILE=
1337    CAT_SRC_FOR_TAF=1
1338  TAF=  TAF=
1339  AD_TAF_FLAGS=  AD_TAF_FLAGS=
1340  FTL_TAF_FLAGS=  FTL_TAF_FLAGS=
# Line 1351  gm_s3="FEXTRAFLAGS IEEE DEVEL GSL TS PAP Line 1360  gm_s3="FEXTRAFLAGS IEEE DEVEL GSL TS PAP
1360  gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM"  gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM"
1361  gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"
1362  gm_s6="PWD TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK"  gm_s6="PWD TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK"
1363  gm_s7="THISHOST THISUSER THISDATE THISVER MACHINE FC_NAMEMANGLE"  gm_s7="TMP THISHOST THISUSER THISDATE THISVER MACHINE FC_NAMEMANGLE"
1364  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"
1365    
1366  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1367  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"
1368  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"
1369  gm_s12="TAF_EXTRA TAMC_EXTRA DIVA MPIINCLUDEDIR MPI_HEADER_FILES"  gm_s12="TAF_EXTRA TAMC_EXTRA DIVA MPIINCLUDEDIR MPI_HEADER_FILES"
1370    
# Line 1407  for ac_option in "$@" ; do Line 1416  for ac_option in "$@" ; do
1416          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
1417              OPTFILE=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
1418    
1419            -oad | --oad)
1420                OPENAD="true" ; ALWAYS_USE_F90=1 ;;
1421            -nocat4ad | -dog4ad | -ncad | -dad)
1422                CAT_SRC_FOR_TAF=0 ;;
1423          -adoptfile | --adoptfile | -adof | --adof)          -adoptfile | --adoptfile | -adof | --adof)
1424              ac_prev=AD_OPTFILE ;;              ac_prev=AD_OPTFILE ;;
1425          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)
1426              AD_OPTFILE=$ac_optarg ;;              AD_OPTFILE=$ac_optarg ;;
1427    
1428            -diva | --diva)
1429                OPENAD_DIVA="ALLOW_OPENAD_DIVA=" ;;
1430    
1431          -pdepend | --pdepend)          -pdepend | --pdepend)
1432              ac_prev=PKG_DEPEND ;;              ac_prev=PKG_DEPEND ;;
1433          -pdepend=* | --pdepend=*)          -pdepend=* | --pdepend=*)
# Line 1576  for ac_option in "$@" ; do Line 1592  for ac_option in "$@" ; do
1592    
1593  done  done
1594    
1595    #TMP=./genmk_$$
1596    #- try to put temporary files in system-local /tmp dir
1597    TMP=/tmp/genmk_${USER}_$$
1598    touch $TMP ; retVal=$?
1599    if [ $retVal -eq 0 ] ; then
1600      if test ! -r $TMP ; then TMP=./genmk_$$ ; fi
1601    else
1602      TMP=./genmk_$$
1603    fi
1604    rm -f $TMP
1605    #echo "  temp files: $TMP.*"
1606    
1607  printf "  getting local config information:  "  printf "  getting local config information:  "
1608  if test -f $gm_local ; then  if test -f $gm_local ; then
1609      echo "using $gm_local"      echo "using $gm_local"
# Line 1668  fi Line 1696  fi
1696    
1697  echo "  getting AD_OPTFILE information:"  echo "  getting AD_OPTFILE information:"
1698  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1699      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" != x ; then
1700            AD_OPTFILE=$MITGCM_AD_OF
1701        elif test "x$OPENAD" = x ; then
1702          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default
1703      else      else
1704          AD_OPTFILE=$MITGCM_AD_OF          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_oad
1705      fi      fi
1706  fi  fi
1707  if test "x${AD_OPTFILE}" != xNONE ; then  if test "x${AD_OPTFILE}" != xNONE ; then
# Line 2237  if test "x${PKG_GROUPS}" != x ; then Line 2267  if test "x${PKG_GROUPS}" != x ; then
2267  fi  fi
2268    
2269  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
2270  echo "" > ./.tmp_pack  echo "" > $TMP.pack
2271  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2272      echo $i >> ./.tmp_pack      echo $i >> $TMP.pack
2273  done  done
2274  for i in `grep  "-" ./.tmp_pack` ; do  for i in `grep  "-" $TMP.pack` ; do
2275      j=`echo $i | sed 's/[-]//'`      j=`echo $i | sed 's/[-]//'`
2276      DISABLE="$DISABLE $j"      DISABLE="$DISABLE $j"
2277  done  done
# Line 2259  for p in $PACKAGES ; do Line 2289  for p in $PACKAGES ; do
2289  done  done
2290  PACKAGES="$pack"  PACKAGES="$pack"
2291  echo "  applying ENABLE settings"  echo "  applying ENABLE settings"
2292  echo "" > ./.tmp_pack  echo "" > $TMP.pack
2293  PACKAGES="$PACKAGES $ENABLE"  PACKAGES="$PACKAGES $ENABLE"
2294  # Test if each explicitly referenced package exists  # Test if each explicitly referenced package exists
2295  for i in $PACKAGES ; do  for i in $PACKAGES ; do
# Line 2268  for i in $PACKAGES ; do Line 2298  for i in $PACKAGES ; do
2298          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"
2299          exit 1          exit 1
2300      fi      fi
2301      echo $i >> ./.tmp_pack      echo $i >> $TMP.pack
2302  done  done
2303  PACKAGES=  PACKAGES=
2304  for i in `grep -v "-" ./.tmp_pack | sort | uniq` ; do  for i in `grep -v "-" $TMP.pack | sort | uniq` ; do
2305      PACKAGES="$PACKAGES $i"      PACKAGES="$PACKAGES $i"
2306  done  done
2307  rm -f ./.tmp_pack  rm -f $TMP.pack
2308  echo "    packages are: $PACKAGES"  echo "    packages are: $PACKAGES"
2309    
2310  #  Check for package MNC: if NetCDF is available, then build the MNC  #  Check for package MNC: if NetCDF is available, then build the MNC
# Line 2344  EOF Line 2374  EOF
2374      fi      fi
2375  fi  fi
2376    
2377  #  Check for package RADTRANS: if LAPACK is not available,  #  Make sure the openad package is enabled if using OpenAD
2378  #  then issue a warning that the direct radtrans solver is not available.  if test "x$OPENAD" != x ; then
2379  if test "x$HAVE_LAPACK" != xt ; then      echo " $PACKAGES " | grep ' openad ' > /dev/null 2>&1
     echo " $PACKAGES " | grep ' radtrans ' > /dev/null 2>&1  
2380      RETVAL=$?      RETVAL=$?
2381      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" != x0 ; then
2382          cat <<EOF          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:  
2383    
   1) LAPACK is correctly installed for this compiler and  
   2) the LIBS variable (within the "optfile") specifies the correct  
      LAPACK library to link against.  
2384  *********************************************************************  *********************************************************************
2385    ERROR: when generating an adjoint with OpenAD, the openad package
2386      must be enabled.  Please add it to packages.conf.
2387    *********************************************************************
2388    
2389  EOF  EOF
2390            exit 1
2391      fi      fi
2392  fi  fi
2393    
# Line 2553  fi Line 2579  fi
2579    
2580  #  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
2581  #  compiler.  #  compiler.
2582  if test -f ./adSrcFiles.tmp ; then  if test -f $TMP.adSrcFiles ; then
2583      rm -f ./adSrcFiles.tmp      rm -f $TMP.adSrcFiles
2584  fi  fi
2585  echo "  Creating the list of files for the adjoint compiler."  echo "  Creating the list of files for the adjoint compiler."
2586  touch adSrcFiles.tmp  touch $TMP.adSrcFiles
2587  for i in $SOURCEDIRS ; do  for i in $SOURCEDIRS ; do
2588      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`
2589      for j in $list_files ; do      for j in $list_files ; do
2590          cat $i/$j >> adSrcFiles.tmp          cat $i/$j >> $TMP.adSrcFiles
2591      done      done
2592  done  done
2593  if test ! "x"$FS = "x.f" ; then  if test ! "x"$FS = "x.f" ; then
2594      cat adSrcFiles.tmp | sed -e "s/\.f/.$FS/g" > adSrcFiles.tmp_f      cat $TMP.adSrcFiles | sed -e "s/\.f/.$FS/g" > $TMP.adSrcFiles_f
2595      mv -f adSrcFiles.tmp_f adSrcFiles.tmp      mv -f $TMP.adSrcFiles_f $TMP.adSrcFiles
2596  fi  fi
2597    
2598  echo  echo
# Line 2588  if test ! "x$DIVA" = x -a ! "x$MPI" = x Line 2614  if test ! "x$DIVA" = x -a ! "x$MPI" = x
2614  fi  fi
2615    
2616  echo "  Determining the list of source and include files"  echo "  Determining the list of source and include files"
2617  rm -rf .links.tmp  rm -rf $TMP.links
2618  mkdir .links.tmp  mkdir $TMP.links
2619  touch .links.tmp/foo  touch $TMP.links/foo
2620  if test ! -r ".links.tmp/foo" ; then  if test ! -r "$TMP.links/foo" ; then
2621      echo      echo
2622      echo "ERROR : something is wrong with your directory permissions or"      echo "ERROR : something is wrong with your directory permissions or"
2623      echo "   your user file-creation mask (\"umask\") since creating a"      echo "   your user file-creation mask (\"umask\") since creating a"
# Line 2607  if test ! -r ".links.tmp/foo" ; then Line 2633  if test ! -r ".links.tmp/foo" ; then
2633      echo      echo
2634      exit 1      exit 1
2635  fi  fi
2636  rm -f .links.tmp/foo  rm -f $TMP.links/foo
2637    
2638  if test "x$OPENAD" != x ; then  if test "x$OPENAD" != x ; then
2639      OAD_DONT_COMPILE="/dev/null"      OAD_DONT_COMPILE="/dev/null"
# Line 2616  if test "x$OPENAD" != x ; then Line 2642  if test "x$OPENAD" != x ; then
2642      OAD_CB2M_FILES="/dev/null"      OAD_CB2M_FILES="/dev/null"
2643      OADTOOLS="$TOOLSDIR/OAD_support"      OADTOOLS="$TOOLSDIR/OAD_support"
2644      echo "  looking for dontCompile file:  "      echo "  looking for dontCompile file:  "
2645      for i in "." $MODS ; do      for i in "." $MODS $OADTOOLS ; do
2646          if test -r $i"/dontCompile" ; then          if test -r $i"/dontCompile" ; then
2647              OAD_DONT_COMPILE=$i"/dontCompile"              OAD_DONT_COMPILE=$i"/dontCompile"
2648              echo "     found $OAD_DONT_COMPILE"              echo "     found $OAD_DONT_COMPILE"
# Line 2624  if test "x$OPENAD" != x ; then Line 2650  if test "x$OPENAD" != x ; then
2650          fi          fi
2651      done      done
2652      echo "  looking for dontTransform file:  "      echo "  looking for dontTransform file:  "
2653      for i in "." $MODS ; do      for i in "." $MODS $OADTOOLS ; do
2654          if test -r $i"/dontTransform" ; then          if test -r $i"/dontTransform" ; then
2655              OAD_DONT_TRANSFORM=$i"/dontTransform"              OAD_DONT_TRANSFORM=$i"/dontTransform"
2656              echo "     found $OAD_DONT_TRANSFORM"              echo "     found $OAD_DONT_TRANSFORM"
# Line 2632  if test "x$OPENAD" != x ; then Line 2658  if test "x$OPENAD" != x ; then
2658          fi          fi
2659      done      done
2660      echo "  looking for keepOriginal file:  "      echo "  looking for keepOriginal file:  "
2661      for i in "." $MODS ; do      for i in "." $MODS $OADTOOLS ; do
2662          if test -r $i"/keepOriginal" ; then          if test -r $i"/keepOriginal" ; then
2663              OAD_KEEP_ORIGINAL=$i"/keepOriginal"              OAD_KEEP_ORIGINAL=$i"/keepOriginal"
2664              echo "     found $OAD_KEEP_ORIGINAL"              echo "     found $OAD_KEEP_ORIGINAL"
# Line 2640  if test "x$OPENAD" != x ; then Line 2666  if test "x$OPENAD" != x ; then
2666          fi          fi
2667      done      done
2668      echo "  looking for cb2mFiles:  "      echo "  looking for cb2mFiles:  "
2669      for i in "." $MODS ; do      for i in "." $MODS $OADTOOLS ; do
2670          if test -r $i"/cb2mFiles" ; then          if test -r $i"/cb2mFiles" ; then
2671              OAD_CB2M_FILES=$i"/cb2mFiles"              OAD_CB2M_FILES=$i"/cb2mFiles"
2672              echo "     found $OAD_CB2M_FILES"              echo "     found $OAD_CB2M_FILES"
# Line 2650  if test "x$OPENAD" != x ; then Line 2676  if test "x$OPENAD" != x ; then
2676      echo "   OpenAD exceptions:  "      echo "   OpenAD exceptions:  "
2677  fi  fi
2678    
2679  echo "# This section creates symbolic links" > srclinks.tmp  echo "# This section creates symbolic links" > $TMP.srclinks
2680  echo "" >> srclinks.tmp  echo "" >> $TMP.srclinks
2681  printf 'F77_SRC_FILES = ' > F77srclist.tmp  printf 'F77_SRC_FILES = ' > $TMP.F77srclist
2682  printf 'NON_AD_F77_SRC_FILES = ' > nonADF77srclist.tmp  printf 'NON_AD_F77_SRC_FILES = ' > $TMP.nonADF77srclist
2683  printf 'C_SRC_FILES = '   > csrclist.tmp  printf 'C_SRC_FILES = '   > $TMP.csrclist
2684  printf 'F90_SRC_FILES = ' > F90srclist.tmp  printf 'F90_SRC_FILES = ' > $TMP.F90srclist
2685  printf 'H_SRC_FILES = '   > hsrclist.tmp  printf 'H_SRC_FILES = '   > $TMP.hsrclist
2686  printf 'AD_FLOW_FILES = ' > ad_flow_files.tmp  printf 'AD_FLOW_FILES = ' > $TMP.ad_flow_files
2687  alldirs="$SOURCEDIRS $INCLUDEDIRS ."  alldirs="$SOURCEDIRS $INCLUDEDIRS ."
2688  for d in $alldirs ; do  for d in $alldirs ; do
2689      deplist=      deplist=
# Line 2667  for d in $alldirs ; do Line 2693  for d in $alldirs ; do
2693          sfiles=`( echo $sfiles | grep -v _cb2m\. )`          sfiles=`( echo $sfiles | grep -v _cb2m\. )`
2694      fi      fi
2695      for sf in $sfiles ; do      for sf in $sfiles ; do
2696          if test ! -r ".links.tmp/$sf" ; then          if test ! -r "$TMP.links/$sf" ; then
2697              if test -f "$d/$sf" ; then              if test -f "$d/$sf" ; then
2698                  ignore_f=f                  ignore_f=f
2699                  case $d/$sf in                  case $d/$sf in
# Line 2692  for d in $alldirs ; do Line 2718  for d in $alldirs ; do
2718                          if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then                          if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then
2719                              ignore_f=t                              ignore_f=t
2720                          else                          else
2721                              touch .links.tmp/$sf                              touch $TMP.links/$sf
2722                              deplist="$deplist $sf"                              deplist="$deplist $sf"
2723                          fi                          fi
2724                          ;;                          ;;
# Line 2701  for d in $alldirs ; do Line 2727  for d in $alldirs ; do
2727                      extn=`echo $sf | $AWK -F. '{print $NF}'`                      extn=`echo $sf | $AWK -F. '{print $NF}'`
2728                      case $extn in                      case $extn in
2729                        F)                        F)
2730                          echo    " \\"  >> F77srclist.tmp                          echo    " \\"  >> $TMP.F77srclist
2731                          printf " $sf" >> F77srclist.tmp                          printf " $sf" >> $TMP.F77srclist
2732                          if test "x$OPENAD" = x ; then                          if test "x$OPENAD" = x ; then
2733                              basename=${sf%%.F}                              basename=${sf%%.F}
2734                              isAD=`egrep ^$basename.f'[  ]*' adSrcFiles.tmp`                              isAD=`egrep ^$basename.f'[  ]*' $TMP.adSrcFiles`
2735                              if test -z "$isAD" ; then                              if test -z "$isAD" ; then
2736                                  echo    " \\"  >> nonADF77srclist.tmp                                  echo    " \\"  >> $TMP.nonADF77srclist
2737                                  printf " $sf" >> nonADF77srclist.tmp                                  printf " $sf" >> $TMP.nonADF77srclist
2738                              fi                              fi
2739                          else #- OpenAD case:                          else #- OpenAD case:
2740                              basename=${sf%%.F}                              basename=${sf%%.F}
2741                              isAD=`egrep ^$basename.f'[  ]*' adSrcFiles.tmp`                              isAD=`egrep ^$basename.f'[  ]*' $TMP.adSrcFiles`
2742                              if test -z "$isAD" ; then                              if test -z "$isAD" ; then
2743                                  toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE}`                                  toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE}`
2744                                  if test -z "$toBeIgnored" ; then                                  if test -z "$toBeIgnored" ; then
2745                                      echo    " \\"  >> nonADF77srclist.tmp                                      echo    " \\"  >> $TMP.nonADF77srclist
2746                                      printf " $sf" >> nonADF77srclist.tmp                                      printf " $sf" >> $TMP.nonADF77srclist
2747                                  else                                  else
2748                                      echo "    not to be compiled   :  $sf"                                      echo "    not to be compiled   :  $sf"
2749                                  fi                                  fi
# Line 2732  for d in $alldirs ; do Line 2758  for d in $alldirs ; do
2758                                      echo "    original to be kept  :  $sf"                                      echo "    original to be kept  :  $sf"
2759                                  fi                                  fi
2760                                  if test -n "$notToBeTransformed" -o -n "$untransformedVersionToBeKept" ; then                                  if test -n "$notToBeTransformed" -o -n "$untransformedVersionToBeKept" ; then
2761                                      echo    " \\"  >> nonADF77srclist.tmp                                      echo    " \\"  >> $TMP.nonADF77srclist
2762                                      printf " $sf" >> nonADF77srclist.tmp                                      printf " $sf" >> $TMP.nonADF77srclist
2763                                  fi                                  fi
2764                              fi                              fi
2765                          fi                          fi
2766                          ;;                          ;;
2767                      F90)                      F90)
2768                          echo    " \\"  >> F90srclist.tmp                          echo    " \\"  >> $TMP.F90srclist
2769                          printf " $sf" >> F90srclist.tmp                          printf " $sf" >> $TMP.F90srclist
2770                          ;;                          ;;
2771                      c)                      c)
2772                          echo    " \\"  >> csrclist.tmp                          echo    " \\"  >> $TMP.csrclist
2773                          printf " $sf" >> csrclist.tmp                          printf " $sf" >> $TMP.csrclist
2774                          ;;                          ;;
2775                      h)                      h)
2776                          echo    " \\"  >> hsrclist.tmp                          echo    " \\"  >> $TMP.hsrclist
2777                          printf " $sf" >> hsrclist.tmp                          printf " $sf" >> $TMP.hsrclist
2778                          ;;                          ;;
2779                      flow)                      flow)
2780                          echo    " \\"  >> ad_flow_files.tmp                          echo    " \\"  >> $TMP.ad_flow_files
2781                          printf " $sf" >> ad_flow_files.tmp                          printf " $sf" >> $TMP.ad_flow_files
2782                          ;;                          ;;
2783                     esac                     esac
2784                  fi                  fi
# Line 2761  for d in $alldirs ; do Line 2787  for d in $alldirs ; do
2787      done      done
2788      if test "x$deplist" != x ; then      if test "x$deplist" != x ; then
2789        if test "$d" != "." ; then        if test "$d" != "." ; then
2790          echo "" >> srclinks.tmp          echo "" >> $TMP.srclinks
2791          echo "#  These files are linked from $d" >> srclinks.tmp          echo "#  These files are linked from $d" >> $TMP.srclinks
2792          echo "$deplist :" >> srclinks.tmp          echo "$deplist :" >> $TMP.srclinks
2793  # We need to make sure that the link isn't already there.  # We need to make sure that the link isn't already there.
2794  # 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"
2795  # 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.
2796          printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> srclinks.tmp          printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> $TMP.srclinks
2797        fi        fi
2798      fi      fi
2799  done  done
2800  rm -rf .links.tmp  rm -rf $TMP.links
2801  echo "" >> F77srclist.tmp  echo "" >> $TMP.F77srclist
2802  echo "" >> nonADF77srclist.tmp  echo "" >> $TMP.nonADF77srclist
2803  echo "" >> csrclist.tmp  echo "" >> $TMP.csrclist
2804  echo "" >> F90srclist.tmp  echo "" >> $TMP.F90srclist
2805  echo "" >> hsrclist.tmp  echo "" >> $TMP.hsrclist
2806  echo "" >> ad_flow_files.tmp  echo "" >> $TMP.ad_flow_files
2807    
2808  CMDLINE=$0  CMDLINE=$0
2809  for xx in "$@" ; do nw=`echo $xx | wc -w`  for xx in "$@" ; do nw=`echo $xx | wc -w`
# Line 2868  F90C = ${F90C} Line 2894  F90C = ${F90C}
2894  CC = ${CC}  CC = ${CC}
2895  # Link editor  # Link editor
2896  LINK = ${LINK} ${LDADD}  LINK = ${LINK} ${LDADD}
2897    export $OPENAD_DIVA
2898    
2899  # Defines for CPP  # Defines for CPP
2900  DEFINES = ${DEFINES}  DEFINES = ${DEFINES}
# Line 2879  CPPINCLUDES = ${CPPINCLUDES} Line 2906  CPPINCLUDES = ${CPPINCLUDES}
2906  KFLAGS1 = ${KFLAGS1}  KFLAGS1 = ${KFLAGS1}
2907  KFLAGS2 = ${KFLAGS2}  KFLAGS2 = ${KFLAGS2}
2908  # Optim./debug for FC  # Optim./debug for FC
2909  FFLAGS = ${FFLAGS} ${FEXTRAFLAGS}  FFLAGS = ${FFLAGS}
2910  FOPTIM = ${FOPTIM}  FOPTIM = ${FOPTIM} ${FEXTRAFLAGS}
2911  # Optim./debug for FC  # Optim./debug for FC
2912  F90FLAGS = ${F90FLAGS}  F90FLAGS = ${F90FLAGS}
2913  F90OPTIM = ${F90OPTIM}  F90OPTIM = ${F90OPTIM}
# Line 2899  MAKE = ${MAKE} Line 2926  MAKE = ${MAKE}
2926    
2927  EOF  EOF
2928    
2929  cat F77srclist.tmp      >> $MAKEFILE  cat $TMP.F77srclist      >> $MAKEFILE
2930  cat nonADF77srclist.tmp >> $MAKEFILE  cat $TMP.nonADF77srclist >> $MAKEFILE
2931  cat csrclist.tmp        >> $MAKEFILE  cat $TMP.csrclist        >> $MAKEFILE
2932  cat F90srclist.tmp      >> $MAKEFILE  cat $TMP.F90srclist      >> $MAKEFILE
2933  cat hsrclist.tmp        >> $MAKEFILE  cat $TMP.hsrclist        >> $MAKEFILE
2934  cat ad_flow_files.tmp   >> $MAKEFILE  cat $TMP.ad_flow_files   >> $MAKEFILE
2935    
2936  rm -f F77srclist.tmp nonADF77srclist.tmp csrclist.tmp F90srclist.tmp hsrclist.tmp ad_flow_files.tmp  rm -f $TMP.F77srclist $TMP.nonADF77srclist $TMP.csrclist $TMP.F90srclist $TMP.hsrclist $TMP.ad_flow_files
2937    
2938  echo >> $MAKEFILE  echo >> $MAKEFILE
2939    
# Line 2956  links: \$(F77_SRC_FILES) \$(C_SRC_FILES) Line 2983  links: \$(F77_SRC_FILES) \$(C_SRC_FILES)
2983    
2984  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)
2985    
 output.txt: \$(EXECUTABLE)  
         @printf 'running ... '  
         @\$(EXECUTABLE) > \$@  
   
2986  # remove most of the files that "make" generates  # remove most of the files that "make" generates
2987  clean:  clean:
2988          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template
# Line 3103  done Line 3126  done
3126  echo "  Add the source list for AD code generation"  echo "  Add the source list for AD code generation"
3127  echo >> $MAKEFILE  echo >> $MAKEFILE
3128  printf "AD_FILES = " >> $MAKEFILE  printf "AD_FILES = " >> $MAKEFILE
3129  AD_FILES=`cat adSrcFiles.tmp`  AD_FILES=`cat $TMP.adSrcFiles`
3130  for i in $AD_FILES ; do  for i in $AD_FILES ; do
3131      echo    " \\" >> $MAKEFILE      echo    " \\" >> $MAKEFILE
3132      printf " $i" >> $MAKEFILE      printf " $i" >> $MAKEFILE
3133  done  done
3134  echo >> $MAKEFILE  echo >> $MAKEFILE
3135  rm -f adSrcFiles.tmp  rm -f $TMP.adSrcFiles
3136    
3137    if test $CAT_SRC_FOR_TAF = 0 ; then
3138    cat >>$MAKEFILE <<EOF
3139    
3140    # ... Utilities ...
3141    remove_comments:
3142            sed -i.bak -f \$(TOOLSDIR)/remove_comments_sed \$(AD_FILES)
3143            @-rm -f \$(AD_FILES:.$FS=.$FS.bak)
3144    adj_sed:
3145            sed -i.bak -f \$(TOOLSDIR)/adjoint_sed \$(AD_FILES:.$FS=_ad.$FS)
3146            @-rm -f \$(AD_FILES:.$FS=_ad.$FS.bak)
3147    ftl_sed:
3148            sed -i.bak -f \$(TOOLSDIR)/adjoint_sed \$(AD_FILES:.$FS=_tl.$FS)
3149            @-rm -f \$(AD_FILES:.$FS=_tl.$FS.bak)
3150    adobjfiles: \$(AD_FILES:.$FS=_ad.o)
3151    ftlobjfiles: \$(AD_FILES:.$FS=_tl.o)
3152    EOF
3153    fi
3154    
3155  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
3156    
# Line 3133  ad_input_code.$FS: \$(AD_FILES) \$(AD_FL Line 3174  ad_input_code.$FS: \$(AD_FILES) \$(AD_FL
3174          @\$(MAKE) -f \$(MAKEFILE) \$(FLOWFILES)          @\$(MAKE) -f \$(MAKEFILE) \$(FLOWFILES)
3175          cat \$(FLOWFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS          cat \$(FLOWFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS
3176    
3177  ad_taf_output.$FS: ad_input_code.$FS  adtafonly:
         @-rm -f ad_input_code_ad.$FS  
3178          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
3179          ls -l ad_input_code_ad.$FS          ls -l ad_input_code_ad.$FS
3180          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS
3181    
3182  adtafonly:  EOF
3183    
3184    if test $CAT_SRC_FOR_TAF = 1 ; then
3185    cat >>$MAKEFILE <<EOF
3186    # ... send 1 file to TAF ...
3187    ad_taf_output.$FS: ad_input_code.$FS
3188            @-rm -f ad_input_code_ad.$FS ; echo ''
3189          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
3190          ls -l ad_input_code_ad.$FS          ls -l ad_input_code_ad.$FS
3191          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS
# Line 3147  adtafonly: Line 3193  adtafonly:
3193  \$(EXE_AD): \$(SPECIAL_FILES) \$(H_SRC_FILES) ad_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(EMBEDDED_FILES)  \$(EXE_AD): \$(SPECIAL_FILES) \$(H_SRC_FILES) ad_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(EMBEDDED_FILES)
3194          \$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) ad_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(LIBS)          \$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) ad_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(LIBS)
3195    
3196  ad_tamc_output.$FS: ad_input_code.$FS  adobj: ad_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o)
         \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS  
         cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.$FS  
3197    
3198  ad_tamc: ad_tamc_output.o \$(OBJFILES)  EOF
3199          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)  
3200    else
3201    cat >>$MAKEFILE <<EOF
3202    # ... send multiple files to TAF ...
3203    ad_taf_output.$FS: \$(AD_FLOW_FILES) \$(AD_FILES)
3204            @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Adjoint version" -bAD_CONFIG_H -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > ad_config.template
3205            cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
3206            @-rm -f ad_config.template
3207            @\$(MAKE) -f \$(MAKEFILE) \$(F77_PP_SRC_FILES)
3208            @\$(MAKE) -f \$(MAKEFILE) \$(FLOWFILES)
3209            @-rm -f \$(AD_FILES:.$FS=_ad.$FS) \$(AD_FILES:.$FS=_ad.o); echo ''
3210            \$(MAKE) -f \$(MAKEFILE) remove_comments
3211            \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) \$(FLOWFILES) \$(AD_FILES)
3212            \$(MAKE) -f \$(MAKEFILE) adj_sed
3213            cat \$(AD_FILES:.$FS=_ad.$FS) > ad_taf_output.$FS
3214    
3215    \$(EXE_AD): \$(SPECIAL_FILES) \$(H_SRC_FILES) ad_taf_output.$FS \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(EMBEDDED_FILES)
3216            \$(MAKE) -f \$(MAKEFILE) adobjfiles
3217            \$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(AD_FILES:.$FS=_ad.o) \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(LIBS)
3218    
3219    adobj: ad_taf_output.$FS \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o)
3220            \$(MAKE) -f \$(MAKEFILE) adobjfiles
3221    
3222    EOF
3223    fi
3224    
3225    cat >>$MAKEFILE <<EOF
3226  adonlyfwd:  adonlyfwd:
3227          patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff          patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff
3228    
3229  adtrick:  adtrick:
3230          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff
3231    
3232  adobj: ad_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o)  ad_tamc_output.$FS: ad_input_code.$FS
3233            \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS
3234            cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.$FS
3235    
3236    ad_tamc: ad_tamc_output.o \$(OBJFILES)
3237            \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
3238    
3239  # ... FTL ...  # ... FTL ...
3240  ftlall: ftl_exe_target  ftlall: ftl_exe_target
# Line 3182  ftl_input_code.$FS: \$(AD_FILES) Line 3256  ftl_input_code.$FS: \$(AD_FILES)
3256          @\$(MAKE) -f \$(MAKEFILE) \$(AD_FLOW_FILES)          @\$(MAKE) -f \$(MAKEFILE) \$(AD_FLOW_FILES)
3257          cat \$(AD_FLOW_FILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ftl_input_code.$FS          cat \$(AD_FLOW_FILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ftl_input_code.$FS
3258    
3259  ftl_taf_output.$FS: ftl_input_code.$FS  ftltafonly:
         @-rm -f ftl_input_code_tl.$FS  
3260          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
3261          ls -l ftl_input_code_tl.$FS          ls -l ftl_input_code_tl.$FS
3262          cat ftl_input_code_tl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS          cat ftl_input_code_tl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS
3263    
3264  ftltafonly:  EOF
3265    
3266    if test $CAT_SRC_FOR_TAF = 1 ; then
3267    cat >>$MAKEFILE <<EOF
3268    # ... send 1 file to TAF ...
3269    ftl_taf_output.$FS: ftl_input_code.$FS
3270            @-rm -f ftl_input_code_tl.$FS ; echo ''
3271          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
3272          ls -l ftl_input_code_tl.$FS          ls -l ftl_input_code_tl.$FS
3273          cat ftl_input_code_tl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS          cat ftl_input_code_tl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS
# Line 3196  ftltafonly: Line 3275  ftltafonly:
3275  \$(EXE_FTL): \$(SPECIAL_FILES) \$(H_SRC_FILES) ftl_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(EMBEDDED_FILES)  \$(EXE_FTL): \$(SPECIAL_FILES) \$(H_SRC_FILES) ftl_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(EMBEDDED_FILES)
3276          \$(LINK) -o \${EXE_FTL} \$(FFLAGS) \$(FOPTIM) ftl_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(LIBS)          \$(LINK) -o \${EXE_FTL} \$(FFLAGS) \$(FOPTIM) ftl_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(LIBS)
3277    
3278    EOF
3279    
3280    else
3281    cat >>$MAKEFILE <<EOF
3282    # ... send multiple files to TAF ...
3283    ftl_taf_output.$FS: \$(AD_FLOW_FILES) \$(AD_FILES)
3284            @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "TangLin version" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN > ad_config.template
3285            cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
3286            @-rm -f ad_config.template
3287            @\$(MAKE) -f \$(MAKEFILE) \$(F77_PP_SRC_FILES)
3288            @\$(MAKE) -f \$(MAKEFILE) \$(AD_FLOW_FILES)
3289            @-rm -f \$(AD_FILES:.$FS=_tl.$FS) \$(AD_FILES:.$FS=_tl.o); echo ''
3290            \$(MAKE) -f \$(MAKEFILE) remove_comments
3291            \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) \$(AD_FLOW_FILES) \$(AD_FILES)
3292            \$(MAKE) -f \$(MAKEFILE) ftl_sed
3293            cat \$(AD_FILES:.$FS=_tl.$FS) > ftl_taf_output.$FS
3294    
3295    \$(EXE_FTL): \$(SPECIAL_FILES) \$(H_SRC_FILES) ftl_taf_output.$FS \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(EMBEDDED_FILES)
3296            \$(MAKE) -f \$(MAKEFILE) ftlobjfiles
3297            \$(LINK) -o \${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(AD_FILES:.$FS=_tl.o) \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o) \$(LIBS)
3298    
3299    EOF
3300    fi
3301    
3302    cat >>$MAKEFILE <<EOF
3303  ftl_tamc_output.$FS: ftl_input_code.$FS  ftl_tamc_output.$FS: ftl_input_code.$FS
3304          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS
3305          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.$FS          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.$FS
# Line 3238  if test "x$OPENAD" != x ; then Line 3342  if test "x$OPENAD" != x ; then
3342  # ============ begin OpenAD specific section ==============  # ============ begin OpenAD specific section ==============
3343    
3344  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
3345    # ... OpenAD ...
3346    
3347  # all the source files linked from the various locations:  # all the source files linked from the various locations:
3348  ALL_LINKED_FILES= \  ALL_LINKED_FILES= \
# Line 3277  for i in `cat ${OAD_CB2M_FILES}` ; do Line 3382  for i in `cat ${OAD_CB2M_FILES}` ; do
3382    echo    " \\" >> $MAKEFILE    echo    " \\" >> $MAKEFILE
3383    printf " ${i}_mod.f$FS90" >> $MAKEFILE    printf " ${i}_mod.f$FS90" >> $MAKEFILE
3384  done  done
3385  AD_FILES=`cat adSrcFiles.tmp`  AD_FILES=`cat $TMP.adSrcFiles`
3386  for i in $AD_FILES ; do  for i in $AD_FILES ; do
3387    basename=${i%%.f}    basename=${i%%.f}
3388    toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE} ${OAD_DONT_TRANSFORM}`    toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE} ${OAD_DONT_TRANSFORM}`
# Line 3287  for i in $AD_FILES ; do Line 3392  for i in $AD_FILES ; do
3392    fi    fi
3393  done  done
3394  echo >> $MAKEFILE  echo >> $MAKEFILE
3395  rm -f adSrcFiles.tmp  rm -f $TMP.adSrcFiles
3396    
3397  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
3398    
3399  adAll: \$(EXE_AD)  adAll: ad_exe_target
3400  .PHONY: adAll  .PHONY: adAll
3401    
3402    ad_exe_target:
3403            @echo Update AD_CONFIG.h and make \$(EXE_AD)
3404            @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Adjoint version" -bAD_CONFIG_H -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > ad_config.template
3405            @cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
3406            @-rm -f ad_config.template
3407            \$(MAKE) -f \$(MAKEFILE) \$(EXE_AD)
3408    
3409  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))
3410    
3411  .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 3310  OAD_active.F90 \ Line 3422  OAD_active.F90 \
3422  OAD_cp.F90 \  OAD_cp.F90 \
3423  OAD_rev.F90 \  OAD_rev.F90 \
3424  OAD_tape.F90 \  OAD_tape.F90 \
3425    OAD_regular_cp.F90 \
3426  revolve.F90  revolve.F90
3427    
3428  OPENAD_SUPPORT_C_SRC_FILES = \  OPENAD_SUPPORT_C_SRC_FILES = \
# Line 3351  AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(N Line 3464  AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(N
3464  small_f: \$(CB2M_F90_PP_SRC_FILES)  small_f: \$(CB2M_F90_PP_SRC_FILES)
3465  .PHONY: small_f  .PHONY: small_f
3466    
 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) > \$@  
   
3467  ad_input_code.f$FS90:  \$(CB2M_AD_FILES)  ad_input_code.f$FS90:  \$(CB2M_AD_FILES)
3468          cat \$^ > \$@          cat \$^ > \$@
3469    
# Line 3446  for i in $NOOPTFILES ; do Line 3552  for i in $NOOPTFILES ; do
3552  done  done
3553    
3554  echo "  Add rules for links"  echo "  Add rules for links"
3555  cat srclinks.tmp >> $MAKEFILE  cat $TMP.srclinks >> $MAKEFILE
3556  rm -f srclinks.tmp  rm -f $TMP.srclinks
3557    
3558  echo "  Adding makedepend marker"  echo "  Adding makedepend marker"
3559  printf "\n\n# DO NOT DELETE\n" >> $MAKEFILE  printf "\n\n# DO NOT DELETE\n" >> $MAKEFILE

Legend:
Removed from v.1.259  
changed lines
  Added in v.1.272

  ViewVC Help
Powered by ViewVC 1.1.22