/[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.256 by jmc, Fri Aug 9 01:02:24 2013 UTC revision 1.264 by jmc, Sat Jan 25 18:25:49 2014 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      -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME      -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME
26        -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME        -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME
27            Use "NAME" as the adoptfile.  By default, the file at            Use "NAME" as the adoptfile.  By default, the file at
28              "tools/adjoint_options/adjoint_oad" (for OpenAD built) or
29            "tools/adjoint_options/adjoint_default" will be used.            "tools/adjoint_options/adjoint_default" will be used.
30    
31      -nooptfile | --nooptfile      -nooptfile | --nooptfile
# Line 208  test_for_string_in_file() { Line 212  test_for_string_in_file() {
212  expand_pkg_groups() {  expand_pkg_groups() {
213      new_packages=      new_packages=
214      if test -r $PKG_GROUPS ; then      if test -r $PKG_GROUPS ; then
215          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
216          cat ./p1.tmp | $AWK '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp          cat $TMP.p1 | $AWK '(NF>2 && $2==":"){ print $0 }' > $TMP.p2
217          matched=0          matched=0
218          for i in $PACKAGES ; do          for i in $PACKAGES ; do
219              line=`grep "^ *$i" ./p2.tmp`              line=`grep "^ *$i" $TMP.p2`
220              RETVAL=$?              RETVAL=$?
221              if test "x$RETVAL" = x0 ; then              if test "x$RETVAL" = x0 ; then
222                  matched=1                  matched=1
# Line 224  expand_pkg_groups() { Line 228  expand_pkg_groups() {
228              fi              fi
229          done          done
230          PACKAGES=$new_packages          PACKAGES=$new_packages
231          rm -f ./p[1,2].tmp          rm -f $TMP.p[1,2]
232          return $matched          return $matched
233      else      else
234          echo "Warning: can't read package groups definition file: $PKG_GROUPS"          echo "Warning: can't read package groups definition file: $PKG_GROUPS"
# Line 1325  FS= Line 1329  FS=
1329  FS90=  FS90=
1330    
1331  AUTODIFF_PKG_USED=f  AUTODIFF_PKG_USED=f
1332    OPENAD=
1333  AD_OPTFILE=  AD_OPTFILE=
1334  TAF=  TAF=
1335  AD_TAF_FLAGS=  AD_TAF_FLAGS=
# Line 1351  gm_s3="FEXTRAFLAGS IEEE DEVEL GSL TS PAP Line 1356  gm_s3="FEXTRAFLAGS IEEE DEVEL GSL TS PAP
1356  gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM"  gm_s4="LN S64 LINK PACKAGES INCLUDES FFLAGS FOPTIM"
1357  gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"
1358  gm_s6="PWD TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK"  gm_s6="PWD TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK"
1359  gm_s7="THISHOST THISUSER THISDATE THISVER MACHINE FC_NAMEMANGLE"  gm_s7="TMP THISHOST THISUSER THISDATE THISVER MACHINE FC_NAMEMANGLE"
1360  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"
1361    
1362  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1363  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"
1364  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"
1365  gm_s12="TAF_EXTRA TAMC_EXTRA DIVA MPIINCLUDEDIR MPI_HEADER_FILES"  gm_s12="TAF_EXTRA TAMC_EXTRA DIVA MPIINCLUDEDIR MPI_HEADER_FILES"
1366    
# Line 1407  for ac_option in "$@" ; do Line 1412  for ac_option in "$@" ; do
1412          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
1413              OPTFILE=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
1414    
1415            -oad | --oad)
1416                OPENAD="true" ;;
1417          -adoptfile | --adoptfile | -adof | --adof)          -adoptfile | --adoptfile | -adof | --adof)
1418              ac_prev=AD_OPTFILE ;;              ac_prev=AD_OPTFILE ;;
1419          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)
# Line 1576  for ac_option in "$@" ; do Line 1583  for ac_option in "$@" ; do
1583    
1584  done  done
1585    
1586    #TMP=./genmk_$$
1587    #- try to put temporary files in system-local /tmp dir
1588    TMP=/tmp/genmk_$$
1589    touch $TMP ; retVal=$?
1590    if [ $retVal -eq 0 ] ; then
1591      if test ! -r $TMP ; then TMP=./genmk_$$ ; fi
1592    else
1593      TMP=./genmk_$$
1594    fi
1595    rm -f $TMP
1596    #echo "  temp files: $TMP.*"
1597    
1598  printf "  getting local config information:  "  printf "  getting local config information:  "
1599  if test -f $gm_local ; then  if test -f $gm_local ; then
1600      echo "using $gm_local"      echo "using $gm_local"
# Line 1668  fi Line 1687  fi
1687    
1688  echo "  getting AD_OPTFILE information:"  echo "  getting AD_OPTFILE information:"
1689  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1690      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" != x ; then
1691            AD_OPTFILE=$MITGCM_AD_OF
1692        elif test "x$OPENAD" = x ; then
1693          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default
1694      else      else
1695          AD_OPTFILE=$MITGCM_AD_OF          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_oad
1696      fi      fi
1697  fi  fi
1698  if test "x${AD_OPTFILE}" != xNONE ; then  if test "x${AD_OPTFILE}" != xNONE ; then
# Line 2237  if test "x${PKG_GROUPS}" != x ; then Line 2258  if test "x${PKG_GROUPS}" != x ; then
2258  fi  fi
2259    
2260  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
2261  echo "" > ./.tmp_pack  echo "" > $TMP.pack
2262  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2263      echo $i >> ./.tmp_pack      echo $i >> $TMP.pack
2264  done  done
2265  for i in `grep  "-" ./.tmp_pack` ; do  for i in `grep  "-" $TMP.pack` ; do
2266      j=`echo $i | sed 's/[-]//'`      j=`echo $i | sed 's/[-]//'`
2267      DISABLE="$DISABLE $j"      DISABLE="$DISABLE $j"
2268  done  done
# Line 2259  for p in $PACKAGES ; do Line 2280  for p in $PACKAGES ; do
2280  done  done
2281  PACKAGES="$pack"  PACKAGES="$pack"
2282  echo "  applying ENABLE settings"  echo "  applying ENABLE settings"
2283  echo "" > ./.tmp_pack  echo "" > $TMP.pack
2284  PACKAGES="$PACKAGES $ENABLE"  PACKAGES="$PACKAGES $ENABLE"
2285  # Test if each explicitly referenced package exists  # Test if each explicitly referenced package exists
2286  for i in $PACKAGES ; do  for i in $PACKAGES ; do
# Line 2268  for i in $PACKAGES ; do Line 2289  for i in $PACKAGES ; do
2289          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"
2290          exit 1          exit 1
2291      fi      fi
2292      echo $i >> ./.tmp_pack      echo $i >> $TMP.pack
2293  done  done
2294  PACKAGES=  PACKAGES=
2295  for i in `grep -v "-" ./.tmp_pack | sort | uniq` ; do  for i in `grep -v "-" $TMP.pack | sort | uniq` ; do
2296      PACKAGES="$PACKAGES $i"      PACKAGES="$PACKAGES $i"
2297  done  done
2298  rm -f ./.tmp_pack  rm -f $TMP.pack
2299  echo "    packages are: $PACKAGES"  echo "    packages are: $PACKAGES"
2300    
2301  #  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 2365  EOF
2365      fi      fi
2366  fi  fi
2367    
2368  #  Check for package RADTRANS: if LAPACK is not available,  #  Make sure the openad package is enabled if using OpenAD
2369  #  then issue a warning that the direct radtrans solver is not available.  if test "x$OPENAD" != x ; then
2370  if test "x$HAVE_LAPACK" != xt ; then      echo " $PACKAGES " | grep ' openad ' > /dev/null 2>&1
     echo " $PACKAGES " | grep ' radtrans ' > /dev/null 2>&1  
2371      RETVAL=$?      RETVAL=$?
2372      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" != x0 ; then
2373          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:  
2374    
   1) LAPACK is correctly installed for this compiler and  
   2) the LIBS variable (within the "optfile") specifies the correct  
      LAPACK library to link against.  
2375  *********************************************************************  *********************************************************************
2376    ERROR: when generating an adjoint with OpenAD, the openad package
2377      must be enabled.  Please add it to packages.conf.
2378    *********************************************************************
2379    
2380  EOF  EOF
2381            exit 1
2382      fi      fi
2383  fi  fi
2384    
# Line 2553  fi Line 2570  fi
2570    
2571  #  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
2572  #  compiler.  #  compiler.
2573  if test -f ./adSrcFiles.tmp ; then  if test -f $TMP.adSrcFiles ; then
2574      rm -f ./adSrcFiles.tmp      rm -f $TMP.adSrcFiles
2575  fi  fi
2576  echo "  Creating the list of files for the adjoint compiler."  echo "  Creating the list of files for the adjoint compiler."
2577  touch adSrcFiles.tmp  touch $TMP.adSrcFiles
2578  for i in $SOURCEDIRS ; do  for i in $SOURCEDIRS ; do
2579      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`
2580      for j in $list_files ; do      for j in $list_files ; do
2581          cat $i/$j >> adSrcFiles.tmp          cat $i/$j >> $TMP.adSrcFiles
2582      done      done
2583  done  done
2584  if test ! "x"$FS = "x.f" ; then  if test ! "x"$FS = "x.f" ; then
2585      cat adSrcFiles.tmp | sed -e "s/\.f/.$FS/g" > adSrcFiles.tmp_f      cat $TMP.adSrcFiles | sed -e "s/\.f/.$FS/g" > $TMP.adSrcFiles_f
2586      mv -f adSrcFiles.tmp_f adSrcFiles.tmp      mv -f $TMP.adSrcFiles_f $TMP.adSrcFiles
2587  fi  fi
2588    
2589  echo  echo
# Line 2588  if test ! "x$DIVA" = x -a ! "x$MPI" = x Line 2605  if test ! "x$DIVA" = x -a ! "x$MPI" = x
2605  fi  fi
2606    
2607  echo "  Determining the list of source and include files"  echo "  Determining the list of source and include files"
2608  rm -rf .links.tmp  rm -rf $TMP.links
2609  mkdir .links.tmp  mkdir $TMP.links
2610  touch .links.tmp/foo  touch $TMP.links/foo
2611  if test ! -r ".links.tmp/foo" ; then  if test ! -r "$TMP.links/foo" ; then
2612      echo      echo
2613      echo "ERROR : something is wrong with your directory permissions or"      echo "ERROR : something is wrong with your directory permissions or"
2614      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 2624  if test ! -r ".links.tmp/foo" ; then
2624      echo      echo
2625      exit 1      exit 1
2626  fi  fi
2627  rm -f .links.tmp/foo  rm -f $TMP.links/foo
2628    
2629  if test "x$OPENAD" != x ; then  if test "x$OPENAD" != x ; then
2630      OAD_DONT_COMPILE="/dev/null"      OAD_DONT_COMPILE="/dev/null"
# Line 2650  if test "x$OPENAD" != x ; then Line 2667  if test "x$OPENAD" != x ; then
2667      echo "   OpenAD exceptions:  "      echo "   OpenAD exceptions:  "
2668  fi  fi
2669    
2670  echo "# This section creates symbolic links" > srclinks.tmp  echo "# This section creates symbolic links" > $TMP.srclinks
2671  echo "" >> srclinks.tmp  echo "" >> $TMP.srclinks
2672  printf 'F77_SRC_FILES = ' > F77srclist.tmp  printf 'F77_SRC_FILES = ' > $TMP.F77srclist
2673  printf 'NON_AD_F77_SRC_FILES = ' > nonADF77srclist.tmp  printf 'NON_AD_F77_SRC_FILES = ' > $TMP.nonADF77srclist
2674  printf 'C_SRC_FILES = '   > csrclist.tmp  printf 'C_SRC_FILES = '   > $TMP.csrclist
2675  printf 'F90_SRC_FILES = ' > F90srclist.tmp  printf 'F90_SRC_FILES = ' > $TMP.F90srclist
2676  printf 'H_SRC_FILES = '   > hsrclist.tmp  printf 'H_SRC_FILES = '   > $TMP.hsrclist
2677  printf 'AD_FLOW_FILES = ' > ad_flow_files.tmp  printf 'AD_FLOW_FILES = ' > $TMP.ad_flow_files
2678  alldirs="$SOURCEDIRS $INCLUDEDIRS ."  alldirs="$SOURCEDIRS $INCLUDEDIRS ."
2679  for d in $alldirs ; do  for d in $alldirs ; do
2680      deplist=      deplist=
# Line 2667  for d in $alldirs ; do Line 2684  for d in $alldirs ; do
2684          sfiles=`( echo $sfiles | grep -v _cb2m\. )`          sfiles=`( echo $sfiles | grep -v _cb2m\. )`
2685      fi      fi
2686      for sf in $sfiles ; do      for sf in $sfiles ; do
2687          if test ! -r ".links.tmp/$sf" ; then          if test ! -r "$TMP.links/$sf" ; then
2688              if test -f "$d/$sf" ; then              if test -f "$d/$sf" ; then
2689                  ignore_f=f                  ignore_f=f
2690                  case $d/$sf in                  case $d/$sf in
# Line 2692  for d in $alldirs ; do Line 2709  for d in $alldirs ; do
2709                          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
2710                              ignore_f=t                              ignore_f=t
2711                          else                          else
2712                              touch .links.tmp/$sf                              touch $TMP.links/$sf
2713                              deplist="$deplist $sf"                              deplist="$deplist $sf"
2714                          fi                          fi
2715                          ;;                          ;;
# Line 2701  for d in $alldirs ; do Line 2718  for d in $alldirs ; do
2718                      extn=`echo $sf | $AWK -F. '{print $NF}'`                      extn=`echo $sf | $AWK -F. '{print $NF}'`
2719                      case $extn in                      case $extn in
2720                        F)                        F)
2721                          echo    " \\"  >> F77srclist.tmp                          echo    " \\"  >> $TMP.F77srclist
2722                          printf " $sf" >> F77srclist.tmp                          printf " $sf" >> $TMP.F77srclist
2723                          if test "x$OPENAD" = x ; then                          if test "x$OPENAD" = x ; then
2724                              basename=${sf%%.F}                              basename=${sf%%.F}
2725                              isAD=`egrep ^$basename.f'[  ]*' adSrcFiles.tmp`                              isAD=`egrep ^$basename.f'[  ]*' $TMP.adSrcFiles`
2726                              if test -z "$isAD" ; then                              if test -z "$isAD" ; then
2727                                  echo    " \\"  >> nonADF77srclist.tmp                                  echo    " \\"  >> $TMP.nonADF77srclist
2728                                  printf " $sf" >> nonADF77srclist.tmp                                  printf " $sf" >> $TMP.nonADF77srclist
2729                              fi                              fi
2730                          else #- OpenAD case:                          else #- OpenAD case:
2731                              basename=${sf%%.F}                              basename=${sf%%.F}
2732                              isAD=`egrep ^$basename.f'[  ]*' adSrcFiles.tmp`                              isAD=`egrep ^$basename.f'[  ]*' $TMP.adSrcFiles`
2733                              if test -z "$isAD" ; then                              if test -z "$isAD" ; then
2734                                  toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE}`                                  toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE}`
2735                                  if test -z "$toBeIgnored" ; then                                  if test -z "$toBeIgnored" ; then
2736                                      echo    " \\"  >> nonADF77srclist.tmp                                      echo    " \\"  >> $TMP.nonADF77srclist
2737                                      printf " $sf" >> nonADF77srclist.tmp                                      printf " $sf" >> $TMP.nonADF77srclist
2738                                  else                                  else
2739                                      echo "    not to be compiled   :  $sf"                                      echo "    not to be compiled   :  $sf"
2740                                  fi                                  fi
# Line 2732  for d in $alldirs ; do Line 2749  for d in $alldirs ; do
2749                                      echo "    original to be kept  :  $sf"                                      echo "    original to be kept  :  $sf"
2750                                  fi                                  fi
2751                                  if test -n "$notToBeTransformed" -o -n "$untransformedVersionToBeKept" ; then                                  if test -n "$notToBeTransformed" -o -n "$untransformedVersionToBeKept" ; then
2752                                      echo    " \\"  >> nonADF77srclist.tmp                                      echo    " \\"  >> $TMP.nonADF77srclist
2753                                      printf " $sf" >> nonADF77srclist.tmp                                      printf " $sf" >> $TMP.nonADF77srclist
2754                                  fi                                  fi
2755                              fi                              fi
2756                          fi                          fi
2757                          ;;                          ;;
2758                      F90)                      F90)
2759                          echo    " \\"  >> F90srclist.tmp                          echo    " \\"  >> $TMP.F90srclist
2760                          printf " $sf" >> F90srclist.tmp                          printf " $sf" >> $TMP.F90srclist
2761                          ;;                          ;;
2762                      c)                      c)
2763                          echo    " \\"  >> csrclist.tmp                          echo    " \\"  >> $TMP.csrclist
2764                          printf " $sf" >> csrclist.tmp                          printf " $sf" >> $TMP.csrclist
2765                          ;;                          ;;
2766                      h)                      h)
2767                          echo    " \\"  >> hsrclist.tmp                          echo    " \\"  >> $TMP.hsrclist
2768                          printf " $sf" >> hsrclist.tmp                          printf " $sf" >> $TMP.hsrclist
2769                          ;;                          ;;
2770                      flow)                      flow)
2771                          echo    " \\"  >> ad_flow_files.tmp                          echo    " \\"  >> $TMP.ad_flow_files
2772                          printf " $sf" >> ad_flow_files.tmp                          printf " $sf" >> $TMP.ad_flow_files
2773                          ;;                          ;;
2774                     esac                     esac
2775                  fi                  fi
# Line 2761  for d in $alldirs ; do Line 2778  for d in $alldirs ; do
2778      done      done
2779      if test "x$deplist" != x ; then      if test "x$deplist" != x ; then
2780        if test "$d" != "." ; then        if test "$d" != "." ; then
2781          echo "" >> srclinks.tmp          echo "" >> $TMP.srclinks
2782          echo "#  These files are linked from $d" >> srclinks.tmp          echo "#  These files are linked from $d" >> $TMP.srclinks
2783          echo "$deplist :" >> srclinks.tmp          echo "$deplist :" >> $TMP.srclinks
2784  # We need to make sure that the link isn't already there.  # We need to make sure that the link isn't already there.
2785  # 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"
2786  # 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.
2787          printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> srclinks.tmp          printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> $TMP.srclinks
2788        fi        fi
2789      fi      fi
2790  done  done
2791  rm -rf .links.tmp  rm -rf $TMP.links
2792  echo "" >> F77srclist.tmp  echo "" >> $TMP.F77srclist
2793  echo "" >> nonADF77srclist.tmp  echo "" >> $TMP.nonADF77srclist
2794  echo "" >> csrclist.tmp  echo "" >> $TMP.csrclist
2795  echo "" >> F90srclist.tmp  echo "" >> $TMP.F90srclist
2796  echo "" >> hsrclist.tmp  echo "" >> $TMP.hsrclist
2797  echo "" >> ad_flow_files.tmp  echo "" >> $TMP.ad_flow_files
2798    
2799  CMDLINE=$0  CMDLINE=$0
2800  for xx in "$@" ; do nw=`echo $xx | wc -w`  for xx in "$@" ; do nw=`echo $xx | wc -w`
# Line 2899  MAKE = ${MAKE} Line 2916  MAKE = ${MAKE}
2916    
2917  EOF  EOF
2918    
2919  cat F77srclist.tmp      >> $MAKEFILE  cat $TMP.F77srclist      >> $MAKEFILE
2920  cat nonADF77srclist.tmp >> $MAKEFILE  cat $TMP.nonADF77srclist >> $MAKEFILE
2921  cat csrclist.tmp        >> $MAKEFILE  cat $TMP.csrclist        >> $MAKEFILE
2922  cat F90srclist.tmp      >> $MAKEFILE  cat $TMP.F90srclist      >> $MAKEFILE
2923  cat hsrclist.tmp        >> $MAKEFILE  cat $TMP.hsrclist        >> $MAKEFILE
2924  cat ad_flow_files.tmp   >> $MAKEFILE  cat $TMP.ad_flow_files   >> $MAKEFILE
2925    
2926  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
2927    
2928  echo >> $MAKEFILE  echo >> $MAKEFILE
2929    
# Line 3103  done Line 3120  done
3120  echo "  Add the source list for AD code generation"  echo "  Add the source list for AD code generation"
3121  echo >> $MAKEFILE  echo >> $MAKEFILE
3122  printf "AD_FILES = " >> $MAKEFILE  printf "AD_FILES = " >> $MAKEFILE
3123  AD_FILES=`cat adSrcFiles.tmp`  AD_FILES=`cat $TMP.adSrcFiles`
3124  for i in $AD_FILES ; do  for i in $AD_FILES ; do
3125      echo    " \\" >> $MAKEFILE      echo    " \\" >> $MAKEFILE
3126      printf " $i" >> $MAKEFILE      printf " $i" >> $MAKEFILE
3127  done  done
3128  echo >> $MAKEFILE  echo >> $MAKEFILE
3129  rm -f adSrcFiles.tmp  rm -f $TMP.adSrcFiles
3130    
3131  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
3132    
# Line 3134  ad_input_code.$FS: \$(AD_FILES) \$(AD_FL Line 3151  ad_input_code.$FS: \$(AD_FILES) \$(AD_FL
3151          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
3152    
3153  ad_taf_output.$FS: ad_input_code.$FS  ad_taf_output.$FS: ad_input_code.$FS
3154            @-rm -f ad_input_code_ad.$FS ; echo ''
3155          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
3156          ls -l ad_input_code_ad.$FS          ls -l ad_input_code_ad.$FS
3157          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 3144  adtafonly: Line 3162  adtafonly:
3162          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
3163    
3164  \$(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)
3165          \$(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)
3166    
3167  ad_tamc_output.$FS: ad_input_code.$FS  ad_tamc_output.$FS: ad_input_code.$FS
3168          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS
# Line 3159  adonlyfwd: Line 3177  adonlyfwd:
3177  adtrick:  adtrick:
3178          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff
3179    
3180  adobj: ad_taf_output.o \$(OBJFILES)  adobj: ad_taf_output.o \$(NON_AD_F77_SRC_FILES:.F=.o) \$(F90_SRC_FILES:.F90=.o) \$(C_SRC_FILES:.c=.o)
3181    
3182  # ... FTL ...  # ... FTL ...
3183  ftlall: ftl_exe_target  ftlall: ftl_exe_target
# Line 3182  ftl_input_code.$FS: \$(AD_FILES) Line 3200  ftl_input_code.$FS: \$(AD_FILES)
3200          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
3201    
3202  ftl_taf_output.$FS: ftl_input_code.$FS  ftl_taf_output.$FS: ftl_input_code.$FS
3203            @-rm -f ftl_input_code_tl.$FS ; echo ''
3204          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
3205          ls -l ftl_input_code_tl.$FS          ls -l ftl_input_code_tl.$FS
3206          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 3192  ftltafonly: Line 3211  ftltafonly:
3211          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
3212    
3213  \$(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)
3214          \$(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)
3215    
3216  ftl_tamc_output.$FS: ftl_input_code.$FS  ftl_tamc_output.$FS: ftl_input_code.$FS
3217          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS
# Line 3275  for i in `cat ${OAD_CB2M_FILES}` ; do Line 3294  for i in `cat ${OAD_CB2M_FILES}` ; do
3294    echo    " \\" >> $MAKEFILE    echo    " \\" >> $MAKEFILE
3295    printf " ${i}_mod.f$FS90" >> $MAKEFILE    printf " ${i}_mod.f$FS90" >> $MAKEFILE
3296  done  done
3297  AD_FILES=`cat adSrcFiles.tmp`  AD_FILES=`cat $TMP.adSrcFiles`
3298  for i in $AD_FILES ; do  for i in $AD_FILES ; do
3299    basename=${i%%.f}    basename=${i%%.f}
3300    toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE} ${OAD_DONT_TRANSFORM}`    toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE} ${OAD_DONT_TRANSFORM}`
# Line 3285  for i in $AD_FILES ; do Line 3304  for i in $AD_FILES ; do
3304    fi    fi
3305  done  done
3306  echo >> $MAKEFILE  echo >> $MAKEFILE
3307  rm -f adSrcFiles.tmp  rm -f $TMP.adSrcFiles
3308    
3309  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
3310    
# Line 3391  ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS Line 3410  ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS
3410  ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 \${OADTOOLS}/insertTemplateDir.bash  ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 \${OADTOOLS}/insertTemplateDir.bash
3411          \${OADTOOLS}/insertTemplateDir.bash \$< \$@          \${OADTOOLS}/insertTemplateDir.bash \$< \$@
3412    
3413  PPEXTRAS=\$(wildcard \${OADTOOLS}/ad_template.*.F) \${OADTOOLS}/ad_inline.F  PPEXTRAS=\$(notdir \$(wildcard \${OADTOOLS}/ad_template.*.F)) ad_inline.F
3414  # postprocess F'  # postprocess F'
3415  postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90  postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90
3416          \${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i \${OADTOOLS}/ad_inline.f \$<          \${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i ad_inline.f \$<
3417          # the target is a placeholder to trigger a single execution of the rule          # the target is a placeholder to trigger a single execution of the rule
3418          touch \$@          touch \$@
3419  # put this so make knows about the postprocessing output  # put this so make knows about the postprocessing output
# Line 3405  OAD_intrinsics_oad.f \$(CB2M_AD_FILES:.f Line 3424  OAD_intrinsics_oad.f \$(CB2M_AD_FILES:.f
3424          \$(LN) \${XAIFSCHEMAROOT}/schema/\$@ .          \$(LN) \${XAIFSCHEMAROOT}/schema/\$@ .
3425    
3426  # link the support files:  # link the support files:
3427  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES):  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES) \$(PPEXTRAS):
3428          \$(LN) \${OADTOOLS}/\$@ .          \$(LN) \${OADTOOLS}/\$@ .
3429    
3430  AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag \$(PPEXTRAS:.F=.f)  AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag
3431    
3432  # ============ end OpenAD specific section ==============  # ============ end OpenAD specific section ==============
3433    
# Line 3444  for i in $NOOPTFILES ; do Line 3463  for i in $NOOPTFILES ; do
3463  done  done
3464    
3465  echo "  Add rules for links"  echo "  Add rules for links"
3466  cat srclinks.tmp >> $MAKEFILE  cat $TMP.srclinks >> $MAKEFILE
3467  rm -f srclinks.tmp  rm -f $TMP.srclinks
3468    
3469  echo "  Adding makedepend marker"  echo "  Adding makedepend marker"
3470  printf "\n\n# DO NOT DELETE\n" >> $MAKEFILE  printf "\n\n# DO NOT DELETE\n" >> $MAKEFILE

Legend:
Removed from v.1.256  
changed lines
  Added in v.1.264

  ViewVC Help
Powered by ViewVC 1.1.22