/[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.66 by edhill, Mon Feb 23 21:51:32 2004 UTC revision 1.84 by edhill, Mon Jul 12 15:49:08 2004 UTC
# Line 1  Line 1 
1  #! /usr/bin/env bash  #! /usr/bin/env sh
2  #  #
3  # $Header$  # $Header$
4  #  #
# Line 37  test_for_string_in_file() { Line 37  test_for_string_in_file() {
37      grep -i "$strng" $file > /dev/null 2>&1      grep -i "$strng" $file > /dev/null 2>&1
38      RETVAL=$?      RETVAL=$?
39      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
40          echo -n "Error: In $file there is an illegal line: "          printf "Error: In $file there is an illegal line: "
41          grep -i "$strng" $file          grep -i "$strng" $file
42          return 1          return 1
43      fi      fi
# Line 67  expand_pkg_groups() { Line 67  expand_pkg_groups() {
67          done          done
68          PACKAGES=$new_packages          PACKAGES=$new_packages
69          rm -f ./p[1,2].tmp          rm -f ./p[1,2].tmp
70            return $matched
71      else      else
72          echo "Warning: can't read package groups definition file: $PKG_GROUPS"          echo "Warning: can't read package groups definition file: $PKG_GROUPS"
73      fi      fi
74  }  }
75    
76    #  Check for broken environments (eg. cygwin, MacOSX w/HFS+) that
77    #  cannot distinguish [*.F/*.F90] from [*.f/*.f90] files.
78    check_for_broken_Ff()  {
79        #  Do we have defaults for $FS and/or $FS90 ?
80        tfs=f
81        tfs9=f90
82        if test "x$FS" != x ; then
83            tfs="$FS"
84        fi
85        if test "x$FS90" != x ; then
86            tfs9="$FS90"
87        fi
88    
89        #  First check the ability to create a *.F/.f pair.
90        cat <<EOF >> genmake_hello.F
91          program hello
92          write(*,*) 'hi'
93          stop
94          end
95    EOF
96        cp genmake_hello.F "genmake_hello."$tfs > /dev/null 2>&1
97        RETVAL=$?
98        if test "x$RETVAL" != x0 ; then
99            if test "x$FS" = x ; then
100                FS='for'
101                FS90='fr9'
102                check_for_broken_Ff
103            else
104                cat <<EOF 2>&1
105    ERROR: Your file system cannot distinguish between *.F and *.f files
106      (fails the "cp" test) and this program cannot find a suitable
107      replacement extension.  Please try a different build environment or
108      contact the <MITgcm-support@mitgcm.org> list for help.
109    
110    EOF
111                exit -1
112            fi
113            return
114        fi
115        rm -f genmake_hello.*
116    
117        #  Check the ability of ${MAKE} and ${LN} to use the current set
118        #  of extensions.
119        cat <<EOF >> genmake_hello.F
120          program hello
121          write(*,*) 'hi'
122          stop
123          end
124    EOF
125        test -e Makefile  &&  mv -f Makefile Makefile.bak
126        cat <<EOF >> Makefile
127    %.$tfs : %.F
128    .SUFFIXES:
129    genmake_hello.$tfs: genmake_hello.F
130            $LN genmake_hello.F genmake_hello.$tfs
131    EOF
132        $MAKE "genmake_hello."$tfs > /dev/null 2>&1
133        RETVAL=$?
134        if test "x$RETVAL" != x0 -o ! -e "genmake_hello."$tfs ; then
135            if test "x$FS" = x ; then
136                FS='for'
137                FS90='fr9'
138                check_for_broken_Ff
139            else
140                cat <<EOF 2>&1
141    ERROR: Your file system cannot distinguish between *.F and *.f files
142      (fails the "make/ln" test) and this program cannot find a suitable
143      replacement extension.  Please try a different build environment or
144      contact the <MITgcm-support@mitgcm.org> list for help.
145    
146    EOF
147                exit -1
148                return
149            fi
150        fi
151        rm -f genmake_hello.* Makefile
152        test -e Makefile  &&  mv -f Makefile.bak Makefile
153    
154        #  If we make it here, use the extensions
155        FS=$tfs
156        FS90=$tfs9
157        return
158    }
159    
160    
161    look_for_makedepend()  {
162    
163        #  The "original" makedepend is part of the Imake system that is
164        #  most often distributed with XFree86 or with an XFree86 source
165        #  package.  As a result, many machines (eg. generic Linux) do not
166        #  have a system-default "makedepend" available.  For those
167        #  systems, we have two fall-back options:
168        #
169        #    1) a makedepend implementation shipped with the cyrus-imapd
170        #       package:  ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
171        #
172        #    2) a known-buggy xmakedpend shell script
173        #
174        #  So the choices are, in order:
175        #
176        #    1) use the user-specified program
177        #    2) use a system-wide default
178        #    3) locally build and use the cyrus implementation
179        #    4) fall back to the buggy local xmakedpend script
180        #
181        if test "x${MAKEDEPEND}" = x ; then
182          which makedepend > /dev/null 2>&1
183          RV0=$?
184          cat <<EOF >> genmake_tc.f
185          program test
186          write(*,*) 'test'
187          stop
188          end
189    EOF
190          makedepend genmake_tc.f > /dev/null 2>&1
191          RV1=$?
192          if test ! "x${RV0}${RV1}" = x00 ; then
193             echo "    a system-default makedepend was not found."
194    
195             #  Try to build the cyrus impl
196             rm -f ./genmake_cy_md
197             (
198                 cd $ROOTDIR/tools/cyrus-imapd-makedepend  \
199                     &&  ./configure > /dev/null 2>&1  \
200                     &&  make > /dev/null 2>&1
201                 if test -x ./makedepend.exe ; then
202                     $LN ./makedepend.exe ./makedepend
203                 fi
204                 ./makedepend ifparser.c > /dev/null 2>&1  \
205                     &&  echo "true"
206             ) > ./genmake_cy_md
207             grep true ./genmake_cy_md > /dev/null 2>&1
208             RETVAL=$?
209             if test "x$RETVAL" = x0 ; then
210                 MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend'
211             else
212                 MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
213             fi
214             rm -f ./genmake_cy_md
215          fi
216        fi
217    }
218    
219    
220  # Guess possible config options for this host  # Guess possible config options for this host
221  find_possible_configs()  {  find_possible_configs()  {
222    
# Line 80  find_possible_configs()  { Line 225  find_possible_configs()  {
225      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
226      tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`      tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`
227      tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`      tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
228      PLATFORM=$tmp2      tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`
229        PLATFORM=$tmp3
230        echo $PLATFORM | grep cygwin > /dev/null 2>&1  &&  PLATFORM=cygwin_ia32
231      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
232      echo "  The platform appears to be:  $PLATFORM"      echo "  The platform appears to be:  $PLATFORM"
233            
# Line 100  find_possible_configs()  { Line 247  find_possible_configs()  {
247          CPP="cpp -traditional -P"          CPP="cpp -traditional -P"
248      fi      fi
249    
250      # makedepend is not always available      look_for_makedepend
     if test "x${MAKEDEPEND}" = x ; then  
       which makedepend >& /dev/null  
       RETVAL=$?  
       if test "x${RETVAL}" = x1 ; then  
          echo "    makedepend was not found. Using xmakedpend instead."  
          MAKEDEPEND='$(TOOLSDIR)/xmakedepend'  
       fi  
     fi  
251    
252      # look for possible fortran compilers      # look for possible fortran compilers
253      tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95"      tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95"
# Line 145  EOF Line 284  EOF
284          echo "   "$p_FC          echo "   "$p_FC
285          if test "x$FC" = x ; then          if test "x$FC" = x ; then
286              FC=`echo $p_FC | $AWK '{print $1}'`              FC=`echo $p_FC | $AWK '{print $1}'`
287                echo "  Setting FORTRAN compiler to: "$FC
288          fi          fi
289      fi      fi
290    
291      for i in $p_FC ; do      if test "x$OPTFILE" = x ; then
292          p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i          OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$FC
293          if test -r $p_OF ; then          if test ! -r $OPTFILE ; then
294              OPTFILE=$p_OF               echo "  I looked for the file "$OPTFILE" but did not find it"
295              echo "  The options file:  $p_OF"          fi
296              echo "    appears to match so we'll use it."      fi
297              break  #    echo "  The options file:  $p_OF"
298          fi  #    echo "    appears to match so we'll use it."
299      done  #   for i in $p_FC ; do
300    #p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i
301    #if test -r $p_OF ; then
302    #    OPTFILE=$p_OF
303    #    echo "  The options file:  $p_OF"
304    #    echo "    appears to match so we'll use it."
305    #    break
306    #fi
307    #   done
308      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
309          cat 1>&2 <<EOF          cat 1>&2 <<EOF
310    
# Line 215  get_pdepend_list()  { Line 363  get_pdepend_list()  {
363      . ./.pd_tmp      . ./.pd_tmp
364      rm -f ./.pd_tmp      rm -f ./.pd_tmp
365    
366      echo -n "PNAME = "${}      printf "PNAME = "${}
367  }  }
368    
369    
# Line 229  Usage: "$0" [OPTIONS] Line 377  Usage: "$0" [OPTIONS]
377      -help | --help | -h | --h      -help | --help | -h | --h
378            Print this help message and exit.            Print this help message and exit.
379    
380        -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME
381          -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME
382              Use "NAME" as the adoptfile.  By default, the file at
383              "tools/adjoint_options/adjoint_default" will be used.
384    
385      -nooptfile | --nooptfile      -nooptfile | --nooptfile
386        -optfile NAME | --optfile NAME | -of NAME | --of NAME        -optfile NAME | --optfile NAME | -of NAME | --of NAME
387        -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME        -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME
# Line 253  Usage: "$0" [OPTIONS] Line 406  Usage: "$0" [OPTIONS]
406        --makefile=NAME | -mf=NAME        --makefile=NAME | -mf=NAME
407            Call the makefile "NAME".  The default is "Makefile".            Call the makefile "NAME".  The default is "Makefile".
408    
409        -makedepend NAME | -md NAME
410          --makedepend=NAME | -md=NAME
411              Use "NAME" for the MAKEDEPEND program.
412    
413      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME
414        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME
415            Specify the location of the MITgcm ROOTDIR as "NAME".            Specify the location of the MITgcm ROOTDIR as "NAME".
# Line 294  Usage: "$0" [OPTIONS] Line 451  Usage: "$0" [OPTIONS]
451            *only* works if it is supported by the OPTFILE that            *only* works if it is supported by the OPTFILE that
452            is being used.            is being used.
453    
454        -mpi | --mpi
455              Include MPI header files and link to MPI libraries
456        -mpi=PATH | --mpi=PATH
457              Include MPI header files and link to MPI libraries using MPI_ROOT
458              set to PATH. i.e. Include files from $PATH/include, link to libraries
459              from $PATH/lib and use binaries from $PATH/bin.
460    
461        -bash NAME
462              Explicitly specify the Bourne or BASH shell to use
463    
464    While it is most often a single word, the "NAME" variables specified    While it is most often a single word, the "NAME" variables specified
465    above can in many cases be a space-delimited string such as:    above can in many cases be a space-delimited string such as:
466    
# Line 438  EOF Line 605  EOF
605    
606    
607  check_netcdf_libs()  {  check_netcdf_libs()  {
608      cat <<EOF > genmake_tnc.F      cat <<EOF > genmake_tnc.for
609        program fgennc        program fgennc
610  #include "netcdf.inc"  #include "netcdf.inc"
611        integer iret, ncid, xid        integer iret, ncid, xid
# Line 450  check_netcdf_libs()  { Line 617  check_netcdf_libs()  {
617        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
618        end        end
619  EOF  EOF
620      $CPP genmake_tnc.F > genmake_tnc.f  \      $CPP genmake_tnc.for > genmake_tnc.f  \
621          &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1          &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1
622      RET_COMPILE=$?      RET_COMPILE=$?
623      test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1      test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
# Line 459  EOF Line 626  EOF
626          HAVE_NETCDF=t          HAVE_NETCDF=t
627      else      else
628          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
629          $CPP genmake_tnc.F > genmake_tnc.f  \          $CPP genmake_tnc.for > genmake_tnc.f  \
630              &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \              &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \
631              $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1              $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1
632          RET_COMPILE=$?          RET_COMPILE=$?
# Line 476  EOF Line 643  EOF
643  }  }
644    
645    
646    
647    ###############################################################################
648    #   Sequential part of script starts here
649    ###############################################################################
650    
651  #  Set defaults here  #  Set defaults here
652  COMMANDL="$0 $@"  COMMANDL="$0 $@"
653    
# Line 486  KPP= Line 658  KPP=
658  FC=  FC=
659  CPP=  CPP=
660  LINK=  LINK=
 # DEFINES="-DWORDLENGTH=4"  
661  DEFINES=  DEFINES=
662  PACKAGES=  PACKAGES=
663  ENABLE=  ENABLE=
# Line 503  FOPTIM= Line 674  FOPTIM=
674  CFLAGS=  CFLAGS=
675  KFLAGS1=  KFLAGS1=
676  KFLAGS2=  KFLAGS2=
677    #LDADD=
678  LIBS=  LIBS=
679  KPPFILES=  KPPFILES=
680  NOOPTFILES=  NOOPTFILES=
681  NOOPTFLAGS=  NOOPTFLAGS=
682    MPI=
683    MPIPATH=
684    
685  # DEFINES checked by test compilation  # DEFINES checked by test compilation
686  HAVE_SYSTEM=  HAVE_SYSTEM=
# Line 514  HAVE_FDATE= Line 688  HAVE_FDATE=
688  FC_NAMEMANGLE=  FC_NAMEMANGLE=
689  HAVE_CLOC=  HAVE_CLOC=
690  HAVE_NETCDF=  HAVE_NETCDF=
691    HAVE_ETIME=
692    
693  MODS=  MODS=
694  TOOLSDIR=  TOOLSDIR=
# Line 521  SOURCEDIRS= Line 696  SOURCEDIRS=
696  INCLUDEDIRS=  INCLUDEDIRS=
697  STANDARDDIRS="USE_THE_DEFAULT"  STANDARDDIRS="USE_THE_DEFAULT"
698    
699    G2ARGS=
700    BASH=
701  PWD=`pwd`  PWD=`pwd`
702  MAKE=make  MAKE=make
703  AWK=awk  AWK=awk
# Line 536  IEEE= Line 713  IEEE=
713  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
714      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
715  fi  fi
716    FS=
717    FS90=
718    
719  AUTODIFF_PKG_USED=f  AUTODIFF_PKG_USED=f
720  AD_OPTFILE=  AD_OPTFILE=
# Line 560  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPE Line 739  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPE
739  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
740  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"
741  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
742  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE"  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME"
743    
744  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
745  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"
# Line 589  for i in . $MODS ; do Line 768  for i in . $MODS ; do
768          break          break
769      fi      fi
770  done  done
771  echo -n "  getting local config information:  "  printf "  getting local config information:  "
772  if test -e $gm_local ; then  if test -e $gm_local ; then
773      echo "using $gm_local"      echo "using $gm_local"
774      . $gm_local      . $gm_local
# Line 613  fi Line 792  fi
792  ac_prev=  ac_prev=
793  for ac_option ; do  for ac_option ; do
794    
795        G2ARGS="$G2ARGS \"$ac_option\""
796    
797      # If the previous option needs an argument, assign it.      # If the previous option needs an argument, assign it.
798      if test -n "$ac_prev"; then      if test -n "$ac_prev"; then
799          eval "$ac_prev=\$ac_option"          eval "$ac_prev=\$ac_option"
# Line 654  for ac_option ; do Line 835  for ac_option ; do
835          -make=* | --make=* | -m=* | --m=*)          -make=* | --make=* | -m=* | --m=*)
836              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
837                    
838            -bash | --bash)
839                ac_prev=BASH ;;
840            -bash=* | --bash=*)
841                BASH=$ac_optarg ;;
842            
843            -makedepend | --makedepend | -md | --md)
844                ac_prev=MAKEDEPEND ;;
845            -makedepend=* | --makedepend=* | -md=* | --md=*)
846                MAKEDEPEND=$ac_optarg ;;
847            
848          -makefile | --makefile | -ma | --ma)          -makefile | --makefile | -ma | --ma)
849              ac_prev=MAKEFILE ;;              ac_prev=MAKEFILE ;;
850          -makefile=* | --makefile=* | -ma=* | --ma=*)          -makefile=* | --makefile=* | -ma=* | --ma=*)
# Line 701  for ac_option ; do Line 892  for ac_option ; do
892          -fc=* | --fc=*)          -fc=* | --fc=*)
893              FC=$ac_optarg ;;              FC=$ac_optarg ;;
894                    
895            -fs | --fs)
896                ac_prev=FS ;;
897            -fs=* | --fs=*)
898                FS=$ac_optarg ;;
899            
900            -fs90 | --fs90)
901                ac_prev=FS90 ;;
902            -fs90=* | --fs90=*)
903                FS90=$ac_optarg ;;
904            
905          -ieee | --ieee)          -ieee | --ieee)
906              IEEE=true ;;              IEEE=true ;;
907          -noieee | --noieee)          -noieee | --noieee)
908              IEEE= ;;              IEEE= ;;
909    
910            -mpi | --mpi)
911                MPI=true ;;
912            -mpi=* | --mpi=*)
913                MPIPATH=$ac_optarg
914                MPI=true ;;
915                    
916  #       -jam | --jam)  #       -jam | --jam)
917  #           JAM=1 ;;  #           JAM=1 ;;
# Line 757  if test "x${ROOTDIR}" = x ; then Line 964  if test "x${ROOTDIR}" = x ; then
964          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do
965              if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then              if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then
966                  ROOTDIR=$d                  ROOTDIR=$d
967                  echo -n "Warning:  ROOTDIR was not specified but there appears to be"                  printf "Warning:  ROOTDIR was not specified but there appears to be"
968                  echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it."                  echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it."
969                  break                  break
970              fi              fi
# Line 791  if test "x$OPTFILE" != xNONE ; then Line 998  if test "x$OPTFILE" != xNONE ; then
998          . "$OPTFILE"          . "$OPTFILE"
999          RETVAL=$?          RETVAL=$?
1000          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
1001              echo -n "Error: failed to source OPTFILE \"$OPTFILE\""              printf "Error: failed to source OPTFILE \"$OPTFILE\""
1002              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
1003              exit 1              exit 1
1004          fi          fi
# Line 804  if test "x$OPTFILE" != xNONE ; then Line 1011  if test "x$OPTFILE" != xNONE ; then
1011      fi      fi
1012  fi  fi
1013    
1014    #  Check for broken systems that cannot correctly distinguish *.F and *.f files
1015    # check_for_broken_Ff
1016    
1017  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:  "
1018  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1019      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" = x ; then
# Line 818  if test "x${AD_OPTFILE}" != xNONE ; then Line 1028  if test "x${AD_OPTFILE}" != xNONE ; then
1028          . "$AD_OPTFILE"          . "$AD_OPTFILE"
1029          RETVAL=$?          RETVAL=$?
1030          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
1031              echo -n "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""              printf "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""
1032              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
1033              exit 1              exit 1
1034          fi          fi
# Line 833  fi Line 1043  fi
1043    
1044  #  Check that FC, LINK, CPP, S64, LN, and MAKE are defined.  If not,  #  Check that FC, LINK, CPP, S64, LN, and MAKE are defined.  If not,
1045  #  either set defaults or complain and abort!  #  either set defaults or complain and abort!
1046    if test ! "x$BASH" = x ; then
1047        # add a trailing space so that it works within the Makefile syntax (see below)
1048        BASH="$BASH "
1049    fi
1050  if test "x$FC" = x ; then  if test "x$FC" = x ; then
1051      cat <<EOF 1>&2      cat <<EOF 1>&2
1052    
# Line 853  if test "x$CPP" = x ; then Line 1067  if test "x$CPP" = x ; then
1067      CPP=cpp      CPP=cpp
1068  fi  fi
1069  #EH3 === UGLY ===  #EH3 === UGLY ===
1070  #  The following an ugly little hack to check for $CPP in /lib/ and it  #  The following is an ugly little hack to check for $CPP in /lib/ and
1071  #  should eventually be replaced with a more general function that  #  it should eventually be replaced with a more general function that
1072  #  searches a combo of the user's path and a list of "usual suspects"  #  searches a combo of the user's path and a list of "usual suspects"
1073  #  to find the correct location for binaries such as $CPP.  #  to find the correct location for binaries such as $CPP.
1074  for i in " " "/lib/" ; do  for i in " " "/lib/" ; do
# Line 877  EOF Line 1091  EOF
1091  else  else
1092      rm -f test_cpp      rm -f test_cpp
1093  fi  fi
1094  if test "x$MAKEDEPEND" = x ; then  look_for_makedepend
     MAKEDEPEND=makedepend  
 fi  
1095  if test "x$LN" = x ; then  if test "x$LN" = x ; then
1096      LN="ln -s"      LN="ln -s"
1097  fi  fi
# Line 897  EOF Line 1109  EOF
1109  fi  fi
1110  rm -f genmake_test_ln genmake_tlink  rm -f genmake_test_ln genmake_tlink
1111    
1112    #  Check for broken *.F/*.f handling and fix if possible
1113    check_for_broken_Ff
1114    
1115    if test ! "x$MPI" = x ; then
1116          echo "  Turning on MPI cpp macros"
1117          DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI"
1118    fi
1119    
1120  printf "\n===  Checking system libraries  ===\n"  printf "\n===  Checking system libraries  ===\n"
1121  echo -n "  Do we have the system() command using $FC...  "  printf "  Do we have the system() command using $FC...  "
1122  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.f <<EOF
1123        program hello        program hello
1124        call system('echo hi')        call system('echo hi')
# Line 917  else Line 1136  else
1136  fi  fi
1137  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1138    
1139  echo -n "  Do we have the fdate() command using $FC...  "  printf "  Do we have the fdate() command using $FC...  "
1140  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.f <<EOF
1141        program hello        program hello
1142        CHARACTER(128) string        CHARACTER(128) string
# Line 938  else Line 1157  else
1157  fi  fi
1158  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1159    
1160  echo -n "  Can we call simple C routines (here, \"cloc()\") using $FC...  "  printf "  Do we have the etime() command using $FC...  "
1161    cat > genmake_tcomp.f <<EOF
1162          program hello
1163          REAL*4 ACTUAL, TARRAY(2)
1164          EXTERNAL ETIME
1165          REAL*4 ETIME
1166          actual = etime( tarray )
1167          print *, tarray
1168          end
1169    EOF
1170    $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1
1171    RETVAL=$?
1172    if test "x$RETVAL" = x0 ; then
1173        HAVE_ETIME=t
1174        DEFINES="$DEFINES -DHAVE_ETIME"
1175        echo "yes"
1176    else
1177        HAVE_ETIME=
1178        echo "no"
1179    fi
1180    rm -f genmake_tcomp*
1181    
1182    printf "  Can we call simple C routines (here, \"cloc()\") using $FC...  "
1183  check_HAVE_CLOC  check_HAVE_CLOC
1184  if test "x$HAVE_CLOC" != x ; then  if test "x$HAVE_CLOC" != x ; then
1185      echo "yes"      echo "yes"
# Line 947  else Line 1188  else
1188  fi  fi
1189  rm -f genmake_t*  rm -f genmake_t*
1190    
1191  echo -n "  Can we create NetCDF-enabled binaries...  "  printf "  Can we create NetCDF-enabled binaries...  "
1192  check_netcdf_libs  check_netcdf_libs
1193  if test "x$HAVE_NETCDF" != x ; then  if test "x$HAVE_NETCDF" != x ; then
1194      echo "yes"      echo "yes"
# Line 957  fi Line 1198  fi
1198    
1199    
1200  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
1201  echo -n "  Adding MODS directories:  "  printf "  Adding MODS directories:  "
1202  for d in $MODS ; do  for d in $MODS ; do
1203      if test ! -d $d ; then      if test ! -d $d ; then
1204          echo          echo
1205          echo "Error: MODS directory \"$d\" not found!"          echo "Error: MODS directory \"$d\" not found!"
1206          exit 1          exit 1
1207      else      else
1208          echo -n " $d"          printf " $d"
1209          SOURCEDIRS="$SOURCEDIRS $d"          SOURCEDIRS="$SOURCEDIRS $d"
1210          INCLUDEDIRS="$INCLUDEDIRS $d"          INCLUDEDIRS="$INCLUDEDIRS $d"
1211      fi      fi
# Line 1089  else Line 1330  else
1330          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`
1331          RETVAL=$?          RETVAL=$?
1332          if test "x${RETVAL}" != x0 ; then          if test "x${RETVAL}" != x0 ; then
1333              echo -n "Error: can't parse default package list "              printf "Error: can't parse default package list "
1334              echo "-- please check PDEFAULT=\"$PDEFAULT\""              echo "-- please check PDEFAULT=\"$PDEFAULT\""
1335              exit 1              exit 1
1336          fi          fi
# Line 1097  else Line 1338  else
1338              PACKAGES="$PACKAGES $i"              PACKAGES="$PACKAGES $i"
1339          done          done
1340          echo "    before group expansion packages are: $PACKAGES"          echo "    before group expansion packages are: $PACKAGES"
1341          expand_pkg_groups          while ! expand_pkg_groups; do echo > /dev/null; done
1342          echo "    after group expansion packages are:  $PACKAGES"          echo "    after group expansion packages are:  $PACKAGES"
1343      fi      fi
1344  fi  fi
1345    
1346  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
1347    for i in $PACKAGES ; do
1348        echo $i >> ./.tmp_pack
1349    done
1350    for i in `grep  "-" ./.tmp_pack` ; do
1351        j=`echo $i | sed 's/[-]//'`
1352        DISABLE="$DISABLE $j"
1353    done
1354  pack=  pack=
1355  for p in $PACKAGES ; do  for p in $PACKAGES ; do
1356      addit="t"      addit="t"
# Line 1119  PACKAGES="$pack" Line 1367  PACKAGES="$pack"
1367  echo "  applying ENABLE settings"  echo "  applying ENABLE settings"
1368  echo "" > ./.tmp_pack  echo "" > ./.tmp_pack
1369  PACKAGES="$PACKAGES $ENABLE"  PACKAGES="$PACKAGES $ENABLE"
1370    # Test if each explicitly referenced package exists
1371  for i in $PACKAGES ; do  for i in $PACKAGES ; do
1372      if test ! -d "$ROOTDIR/pkg/$i" ; then      j=`echo $i | sed 's/[-+]//'`
1373        if test ! -d "$ROOTDIR/pkg/$j" ; then
1374          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""
1375          exit 1          exit 1
1376      fi      fi
1377      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
1378  done  done
 pack=`cat ./.tmp_pack | sort | uniq`  
 rm -f ./.tmp_pack  
1379  PACKAGES=  PACKAGES=
1380  for i in $pack ; do  for i in `grep -v "-" ./.tmp_pack | sort | uniq` ; do
1381      PACKAGES="$PACKAGES $i"      PACKAGES="$PACKAGES $i"
1382  done  done
1383    rm -f ./.tmp_pack
1384  echo "    packages are:  $PACKAGES"  echo "    packages are:  $PACKAGES"
1385    
1386  echo "  applying package dependency rules"  echo "  applying package dependency rules"
# Line 1372  rm -rf .links.tmp Line 1621  rm -rf .links.tmp
1621  mkdir .links.tmp  mkdir .links.tmp
1622  echo "# This section creates symbolic links" > srclinks.tmp  echo "# This section creates symbolic links" > srclinks.tmp
1623  echo "" >> srclinks.tmp  echo "" >> srclinks.tmp
1624  echo -n 'SRCFILES = '    > srclist.inc  printf 'SRCFILES = '    > srclist.inc
1625  echo -n 'CSRCFILES = '   > csrclist.inc  printf 'CSRCFILES = '   > csrclist.inc
1626  echo -n 'F90SRCFILES = ' > f90srclist.inc  printf 'F90SRCFILES = ' > f90srclist.inc
1627  echo -n 'HEADERFILES = ' > hlist.inc  printf 'HEADERFILES = ' > hlist.inc
1628  echo -n 'AD_FLOW_FILES = ' > ad_flow_files.inc  printf 'AD_FLOW_FILES = ' > ad_flow_files.inc
1629  alldirs="$SOURCEDIRS $INCLUDEDIRS ."  alldirs="$SOURCEDIRS $INCLUDEDIRS ."
1630  for d in $alldirs ; do  for d in $alldirs ; do
1631      deplist=      deplist=
# Line 1401  for d in $alldirs ; do Line 1650  for d in $alldirs ; do
1650                  case $extn in                  case $extn in
1651                      F)                      F)
1652                          echo    " \\"  >> srclist.inc                          echo    " \\"  >> srclist.inc
1653                          echo -n " $sf" >> srclist.inc                          printf " $sf" >> srclist.inc
1654                          ;;                          ;;
1655                      F90)                      F90)
1656                          echo    " \\"  >> f90srclist.inc                          echo    " \\"  >> f90srclist.inc
1657                          echo -n " $sf" >> f90srclist.inc                          printf " $sf" >> f90srclist.inc
1658                          ;;                          ;;
1659                      c)                      c)
1660                          echo    " \\"  >> csrclist.inc                          echo    " \\"  >> csrclist.inc
1661                          echo -n " $sf" >> csrclist.inc                          printf " $sf" >> csrclist.inc
1662                          ;;                          ;;
1663                      h)                      h)
1664                          echo    " \\"  >> hlist.inc                          echo    " \\"  >> hlist.inc
1665                          echo -n " $sf" >> hlist.inc                          printf " $sf" >> hlist.inc
1666                          ;;                          ;;
1667                      flow)                      flow)
1668                          echo    " \\"  >> ad_flow_files.inc                          echo    " \\"  >> ad_flow_files.inc
1669                          echo -n " $sf" >> ad_flow_files.inc                          printf " $sf" >> ad_flow_files.inc
1670                          ;;                          ;;
1671                  esac                  esac
1672              fi              fi
# Line 1446  echo "#    $MACHINE" >> $MAKEFILE Line 1695  echo "#    $MACHINE" >> $MAKEFILE
1695  echo "# This makefile was generated automatically on" >> $MAKEFILE  echo "# This makefile was generated automatically on" >> $MAKEFILE
1696  echo "#    $THISDATE" >> $MAKEFILE  echo "#    $THISDATE" >> $MAKEFILE
1697  echo "# by the command:" >> $MAKEFILE  echo "# by the command:" >> $MAKEFILE
1698  echo "#    $0 $@" >> $MAKEFILE  echo "#    $0 $G2ARGS" >> $MAKEFILE
1699  echo "# executed by:" >> $MAKEFILE  echo "# executed by:" >> $MAKEFILE
1700  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE
1701    
# Line 1514  FC = ${FC} Line 1763  FC = ${FC}
1763  # Fortran compiler  # Fortran compiler
1764  F90C = ${F90C}  F90C = ${F90C}
1765  # Link editor  # Link editor
1766  LINK = ${LINK}  LINK = ${LINK} ${LDADD}
1767    
1768  # Defines for CPP  # Defines for CPP
1769  DEFINES = ${DEFINES}  DEFINES = ${DEFINES}
# Line 1546  cat csrclist.inc      >> $MAKEFILE Line 1795  cat csrclist.inc      >> $MAKEFILE
1795  cat f90srclist.inc    >> $MAKEFILE  cat f90srclist.inc    >> $MAKEFILE
1796  cat hlist.inc         >> $MAKEFILE  cat hlist.inc         >> $MAKEFILE
1797  cat ad_flow_files.inc >> $MAKEFILE  cat ad_flow_files.inc >> $MAKEFILE
1798  echo               >> $MAKEFILE  echo >> $MAKEFILE
1799  echo 'F77FILES =  $(SRCFILES:.F=.f)'                                           >> $MAKEFILE  echo 'F77FILES =  $(SRCFILES:.F=.'$FS')'      >> $MAKEFILE
1800  echo 'F90FILES =  $(F90SRCFILES:.F90=.f90)'                                    >> $MAKEFILE  echo 'F90FILES =  $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE
1801  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE
1802    echo >> $MAKEFILE
1803    echo '.SUFFIXES:' >> $MAKEFILE
1804    echo '.SUFFIXES: .o .'$FS' .p .F .c .'$FS90' .F90' >> $MAKEFILE
1805  rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc  rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc
1806  rm -f ad_flow_files.inc  rm -f ad_flow_files.inc
1807    
1808  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
1809    
 .SUFFIXES:  
 .SUFFIXES: .o .f .p .F .c .F90 .f90  
   
1810  all: \$(EXECUTABLE)  all: \$(EXECUTABLE)
1811  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES)  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES)
1812          @echo Creating \$@ ...          @echo Creating \$@ ...
1813          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
1814  depend:  depend:
1815          @make links          @make links
1816          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)          \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
1817          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
1818            -rm -f makedepend.out
1819    
1820  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)
1821    
# Line 1577  output.txt: \$(EXECUTABLE) Line 1826  output.txt: \$(EXECUTABLE)
1826          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
1827    
1828  clean:  clean:
1829          -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} *.template          -rm -rf *.o *.$FS *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template
1830  Clean:  Clean:
1831          @make clean          @make clean
1832          @make cleanlinks          @make cleanlinks
# Line 1588  CLEAN: Line 1837  CLEAN:
1837          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
1838          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
1839          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
1840          -rm -f \$(EXECUTABLE) output.txt          -rm -f \$(EXECUTABLE) output.txt STD*
1841    
1842  #eh3 Makefile: makefile  #eh3 Makefile: makefile
1843  makefile:  makefile:
1844          $THIS_SCRIPT $@          $THIS_SCRIPT $G2ARGS
1845  cleanlinks:  cleanlinks:
1846          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
1847    
1848  # Special targets ($SPECIAL_FILES) which are create by make  # Special targets ($SPECIAL_FILES) which are create by make
1849  ${PACKAGES_DOT_H}:  ${PACKAGES_DOT_H}:
1850          @echo Creating \$@ ...          @echo Creating \$@ ...
1851          @\$(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) > \$@
1852  AD_CONFIG.h:  AD_CONFIG.h:
1853          @echo Creating \$@ ...          @echo Creating \$@ ...
1854          @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@
1855  FC_NAMEMANGLE.h:  FC_NAMEMANGLE.h:
1856          @echo Creating \$@ ...          @echo Creating \$@ ...
1857          echo "$FC_NAMEMANGLE" > \$@          echo "$FC_NAMEMANGLE" > \$@
1858    
1859  # The normal chain of rules is (  .F - .f - .o  )  # The normal chain of rules is (  .F - .$FS - .o  )
1860  .F.f:  
1861    %.o : %.F
1862    
1863    .F.$FS:
1864          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1865  .f.o:  .$FS.o:
1866          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
1867  .F90.f90:  .F90.$FS90:
1868          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1869  .f90.o:  .$FS90.o:
1870          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<
1871  .c.o:  .c.o:
1872          \$(CC) \$(CFLAGS) -c \$<          \$(CC) \$(CFLAGS) -c \$<
1873    
1874  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain  # Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain
1875  .F.p:  .F.p:
1876          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1877  .p.f:  .p.$FS:
1878          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
1879    
1880  #=========================================  #=========================================
# Line 1649  done Line 1901  done
1901    
1902  echo "  Add the source list for AD code generation"  echo "  Add the source list for AD code generation"
1903  echo >> $MAKEFILE  echo >> $MAKEFILE
1904  echo -n "AD_FILES = " >> $MAKEFILE  printf "AD_FILES = " >> $MAKEFILE
1905  AD_FILES=`cat ad_files`  AD_FILES=`cat ad_files`
1906  for i in $AD_FILES ; do  for i in $AD_FILES ; do
1907      echo    " \\" >> $MAKEFILE      echo    " \\" >> $MAKEFILE
1908      echo -n " $i" >> $MAKEFILE      printf " $i" >> $MAKEFILE
1909  done  done
1910  echo >> $MAKEFILE  echo >> $MAKEFILE
1911  rm -f ad_files  rm -f ad_files
# Line 1666  adtaf: ad_taf_output.f Line 1918  adtaf: ad_taf_output.f
1918  adtamc: ad_tamc_output.f  adtamc: ad_tamc_output.f
1919    
1920  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1921          @\$(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
1922          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
1923          -rm -f ad_config.template          -rm -f ad_config.template
1924          @make \$(F77FILES)          @make \$(F77FILES)
# Line 1698  ftltaf: ftl_taf_output.f Line 1950  ftltaf: ftl_taf_output.f
1950  ftltamc: ftl_tamc_output.f  ftltamc: ftl_tamc_output.f
1951    
1952  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1953          @\$(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
1954          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
1955          -rm -f ftl_config.template          -rm -f ftl_config.template
1956          @make \$(F77FILES)          @make \$(F77FILES)
# Line 1747  for i in $KPPFILES ; do Line 1999  for i in $KPPFILES ; do
1999      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
2000          echo "Error: unable to add file \"$i\" to the exceptions list"          echo "Error: unable to add file \"$i\" to the exceptions list"
2001      fi      fi
2002      echo "$base.f: $base.p" >> $MAKEFILE      echo "$base.$FS: $base.p" >> $MAKEFILE
2003  done  done
2004    
2005  echo "  Making list of NOOPTFILES"  echo "  Making list of NOOPTFILES"
# Line 1757  for i in $NOOPTFILES ; do Line 2009  for i in $NOOPTFILES ; do
2009      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
2010          echo "Error: unable to add file \"$i\" to the exceptions list"          echo "Error: unable to add file \"$i\" to the exceptions list"
2011      fi      fi
2012      echo "$base.o: $base.f" >> $MAKEFILE      echo "$base.o: $base.$FS" >> $MAKEFILE
2013      printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE      printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE
2014  done  done
2015    
# Line 1771  printf "\n\n# DO NOT DELETE\n" >> $MAKEF Line 2023  printf "\n\n# DO NOT DELETE\n" >> $MAKEF
2023  printf "\n===  Done  ===\n"  printf "\n===  Done  ===\n"
2024    
2025  # Create special header files  # Create special header files
2026  $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" $DISABLED_PACKAGES " " "Enabled packages:" $ENABLED_PACKAGES > $PACKAGES_DOT_H".tmp"  $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 > $PACKAGES_DOT_H".tmp"
2027  if test ! -f $PACKAGES_DOT_H ; then  if test ! -f $PACKAGES_DOT_H ; then
2028      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
2029  else  else
# Line 1785  else Line 2037  else
2037      fi      fi
2038  fi  fi
2039  if test ! -f AD_CONFIG.h ; then  if test ! -f AD_CONFIG.h ; then
2040      $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > AD_CONFIG.h      $BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > AD_CONFIG.h
2041  fi  fi
2042    
2043    
2044  #  Write the "state" for future records  #  Write the "state" for future records
2045  if test "x$DUMPSTATE" != xf ; then  if test "x$DUMPSTATE" != xf ; then
2046      echo -n "" > genmake_state      printf "" > genmake_state
2047      for i in $gm_state ; do      for i in $gm_state ; do
2048          t1="t2=\$$i"          t1="t2=\$$i"
2049          eval $t1          eval $t1

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.84

  ViewVC Help
Powered by ViewVC 1.1.22