/[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.37 by heimbach, Fri Nov 14 05:25:46 2003 UTC revision 1.84 by edhill, Mon Jul 12 15:49:08 2004 UTC
# Line 1  Line 1 
1  #!/bin/sh  #! /usr/bin/env sh
2  #  #
3  # $Header$  # $Header$
4  #  #
# Line 13  Line 13 
13  test_for_package_in_cpp_options() {  test_for_package_in_cpp_options() {
14      cpp_options=$1      cpp_options=$1
15      pkg=$2      pkg=$2
16      grep -i "#define.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg" || exit 99
17      RETVAL=$?      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg" || exit 99
18      if test "x${RETVAL}" = x0 ; then      test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg" || exit 99
19          echo "Error: In $cpp_options there is an illegal line: #define ALLOW_$pkg"      test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg" || exit 99
20          exit 99  }
21      fi  
22      grep -i "#undef.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1  # Search for particular CPP #cmds associated with MPI
23      RETVAL=$?  # usage: test_for_mpi_in_cpp_eeoptions CPP_file
24      if test "x${RETVAL}" = x0 ; then  test_for_mpi_in_cpp_eeoptions() {
25          echo "Error: In $cpp_options there is an illegal line: #undef ALLOW_$pkg"      cpp_options=$1
26          exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI" || exit 99
27      fi      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI" || exit 99
28      grep -i "#define.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1      test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI" || exit 99
29        test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI" || exit 99
30    }
31    
32    # Search for particular string in a file. Return 1 if detected, 0 if not
33    # usage: test_for_string_in_file file string
34    test_for_string_in_file() {
35        file=$1
36        strng=$2
37        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 "Error: In $cpp_options there is an illegal line: #define DISABLE_$pkg"          printf "Error: In $file there is an illegal line: "
41          exit 99          grep -i "$strng" $file
42            return 1
43      fi      fi
44      grep -i "#undef.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1      return 0
     RETVAL=$?  
     if test "x${RETVAL}" = x0 ; then  
         echo "Error: In $cpp_options there is an illegal line: #undef DISABLE_$pkg"  
         exit 99  
    fi  
45  }  }
46    
47  # Read the $ROOTDIR/pkg/pkg_groups file and expand any references to  # Read the $ROOTDIR/pkg/pkg_groups file and expand any references to
# Line 62  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    
223      tmp1=`uname`"_"`uname -m`      tmp1=`uname`"_"`uname -m`
224      tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`      tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
225      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
226      PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`      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/'`
228        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"
 #     if test "x$OFLIST" = x ; then  
 #       echo "  No pre-defined options files were found matching this platform"  
 #       echo "  but examples for other platforms can be found in:"  
 #       echo "    $ROOTDIR/tools/build_options"  
 #     else  
 #       echo "  Options files (located in $ROOTDIR/tools/build_options) that"  
 #       echo "  may work with this machine are:"  
 #       for i in $OFLIST ; do  
 #           echo "    $i"  
 #       done  
 #     fi  
233            
234      echo "test" > test      echo "test" > test
235      ln -s ./test link      ln -s ./test link
# Line 104  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 149  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 219  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    
370  #  Explain usage  #  Explain usage
371  usage()  {  usage()  {
372      echo  cat <<EOF
373      echo "Usage: "$0" [OPTIONS]"  
374      echo "  where [OPTIONS] can be:"  Usage: "$0" [OPTIONS]
375      echo    where [OPTIONS] can be:
376      echo "    -help | --help | -h | --h"  
377      echo "    -nooptfile | --nooptfile"      -help | --help | -h | --h
378      echo "      -optfile NAME | --optfile NAME | -of NAME | --of NAME"            Print this help message and exit.
379      echo "      -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME"  
380      echo "    -pdepend NAME | --pdepend NAME"      -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME
381      echo "      -pdepend=NAME | --pdepend=NAME"        -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME
382      echo "    -pdefault NAME | --pdefault NAME"            Use "NAME" as the adoptfile.  By default, the file at
383      echo "      -pdefault=NAME | --pdefault=NAME"            "tools/adjoint_options/adjoint_default" will be used.
384      echo "    -make NAME | -m NAME"  
385      echo "      --make=NAME | -m=NAME"      -nooptfile | --nooptfile
386      echo "    -makefile NAME | -mf NAME"        -optfile NAME | --optfile NAME | -of NAME | --of NAME
387      echo "      --makefile=NAME | -mf=NAME"        -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME
388      echo "    -platform NAME | --platform NAME | -pl NAME | --pl NAME"            Use "NAME" as the optfile.  By default, an attempt will be
389      echo "      -platform=NAME | --platform=NAME | -pl=NAME | --pl=NAME"            made to find an appropriate "standard" optfile in the
390      echo "    -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME"            tools/build_options/ directory.
391      echo "      -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME"  
392      echo "    -mods NAME | --mods NAME | -mo NAME | --mo NAME"      -pdepend NAME | --pdepend NAME
393      echo "      -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME"        -pdepend=NAME | --pdepend=NAME
394      echo "    -disable NAME | --disable NAME"            Get package dependency information from "NAME".
395      echo "      -disable=NAME | --disable=NAME"  
396      echo "    -enable NAME | --enable NAME"      -pdefault NAME | --pdefault NAME
397      echo "      -enable=NAME | --enable=NAME"        -pdefault=NAME | --pdefault=NAME
398      echo "    -standarddirs NAME | --standarddirs NAME"            Get the default package list from "NAME".
399      echo "      -standarddirs=NAME | --standarddirs=NAME"  
400      echo "    -noopt NAME | --noopt NAME"      -make NAME | -m NAME
401      echo "      -noopt=NAME | --noopt=NAME"        --make=NAME | -m=NAME
402  #    echo "    -cpp NAME | --cpp NAME"            Use "NAME" for the MAKE program. The default is "make" but
403  #    echo "      -cpp=NAME | --cpp=NAME"            many platforms, "gmake" is the preferred choice.
404      echo "    -fortran NAME | --fortran NAME | -fc NAME | --fc NAME"  
405      echo "      -fc=NAME | --fc=NAME"      -makefile NAME | -mf NAME
406      echo "    -[no]ieee | --[no]ieee"        --makefile=NAME | -mf=NAME
407      echo "    -[no]mpi | --[no]mpi"            Call the makefile "NAME".  The default is "Makefile".
408      echo "    -[no]jam | --[no]jam"  
409      echo      -makedepend NAME | -md NAME
410      echo "  and NAME is a string such as:"        --makedepend=NAME | -md=NAME
411      echo            Use "NAME" for the MAKEDEPEND program.
412      echo "    --enable pkg1   --enable 'pkg1 pkg2'   --enable 'pkg1 pkg2 pkg3'"  
413      echo "    -mods=dir1   -mods='dir1'   -mods='dir1 dir2 dir3'"      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME
414      echo "    -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'"        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME
415      echo            Specify the location of the MITgcm ROOTDIR as "NAME".
416      echo "  which, depending upon your shell, may need to be single-quoted"            By default, genamke will try to find the location by
417      echo "  if it contains spaces, dashes, or other special characters."            looking in parent directories (up to the 5th parent).
418    
419        -mods NAME | --mods NAME | -mo NAME | --mo NAME
420          -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME
421              Here, "NAME" specifies a list of directories that are
422              used for additional source code.  Files found in the
423              "mods list" are given preference over files of the same
424              name found elsewhere.
425    
426        -disable NAME | --disable NAME
427          -disable=NAME | --disable=NAME
428              Here "NAME" specifies a list of packages that we don't
429              want to use.  If this violates package dependencies,
430              genamke will exit with an error message.
431    
432        -enable NAME | --enable NAME
433          -enable=NAME | --enable=NAME
434              Here "NAME" specifies a list of packages that we wish
435              to specifically enable.  If this violates package
436              dependencies, genamke will exit with an error message.
437    
438        -standarddirs NAME | --standarddirs NAME
439          -standarddirs=NAME | --standarddirs=NAME
440              Here, "NAME" specifies a list of directories to be
441              used as the "standard" code.
442    
443        -fortran NAME | --fortran NAME | -fc NAME | --fc NAME
444          -fc=NAME | --fc=NAME
445              Use "NAME" as the fortran compiler.  By default, genmake
446              will search for a working compiler by trying a list of
447              "usual suspects" such as g77, f77, etc.
448    
449        -[no]ieee | --[no]ieee
450              Do or don't use IEEE numerics.  Note that this option
451              *only* works if it is supported by the OPTFILE that
452              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
465      above can in many cases be a space-delimited string such as:
466    
467        --enable pkg1   --enable 'pkg1 pkg2'   --enable 'pkg1 pkg2 pkg3'
468        -mods=dir1   -mods='dir1'   -mods='dir1 dir2 dir3'
469        -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'
470    
471      which, depending upon your shell, may need to be single-quoted.
472    
473      For more detailed genmake documentation, please see:
474    
475        http://mitgcm.org/devel_HOWTO/
476    
477    EOF
478    
479      exit 1      exit 1
480  }  }
481    
# Line 281  get_fortran_c_namemangling()  { Line 486  get_fortran_c_namemangling()  {
486      cat > genmake_test.c <<EOF      cat > genmake_test.c <<EOF
487  void tcall( char * string ) { tsub( string ); }  void tcall( char * string ) { tsub( string ); }
488  EOF  EOF
489      $MAKE genmake_test.o > genmake_test.log 2>&1      $MAKE genmake_test.o >> genmake_warnings 2>&1
490      RETVAL=$?      RETVAL=$?
491      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
         cat genmake_test.log >> genmake_errors  
492          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
493          echo          cat <<EOF>> genmake_errors
494          echo "WARNING: C test compile fails -- please see \"genmake_errors\""  
495          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"  WARNING: C test compile fails
496          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
497    WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
498    EOF
499          return 1          return 1
500      fi      fi
501      c_tcall=`nm genmake_test.o | grep tcall | cut -d ' ' -f 3`      c_tcall=`nm genmake_test.o | grep 'T ' | grep tcall | cut -d ' ' -f 3`
502      RETVAL=$?      RETVAL=$?
503      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
504          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
505          echo          cat <<EOF>> genmake_warnings
506          echo "WARNING: The \"nm\" command failed."  
507          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"  WARNING: The "nm" command failed.
508          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
509    WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
510    EOF
511          return 1          return 1
512      fi      fi
513      cat > genmake_tcomp.f <<EOF      cat > genmake_tcomp.f <<EOF
# Line 308  EOF Line 516  EOF
516        call tsub( string )        call tsub( string )
517        end        end
518  EOF  EOF
519      $FC $FFLAGS $DEFINES -c genmake_tcomp.f > genmake_tcomp.log 2>&1      $FC $FFLAGS $DEFINES -c genmake_tcomp.f >> genmake_warnings 2>&1
520      RETVAL=$?      RETVAL=$?
521      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
         cat genmake_tcomp.log >> genmake_errors  
522          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
523          echo          cat <<EOF>> genmake_warnings
524          echo "WARNING: FORTRAN test compile fails -- please see \"genmake_errors\""  
525          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"  WARNING: FORTRAN test compile fails -- please see "genmake_errors"
526          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
527    WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
528    EOF
529          return 1          return 1
530      fi      fi
531      f_tcall=`nm genmake_tcomp.o | grep tcall | cut -d ' ' -f 3`      f_tcall=`nm genmake_tcomp.o | grep 'T ' | grep tcall | cut -d ' ' -f 3`
532      RETVAL=$?      RETVAL=$?
533      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
534          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
535          echo          cat <<EOF>> genmake_warnings
536          echo "WARNING: The \"nm\" command failed."  
537          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"  WARNING: The "nm" command failed.
538          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
539    WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
540    EOF
541          return 1          return 1
542      fi      fi
543    
# Line 353  EOF Line 564  EOF
564      rm -f genmake_tcomp.* genmake_test.*      rm -f genmake_tcomp.* genmake_test.*
565  }  }
566    
567    
568    check_HAVE_CLOC()  {
569        get_fortran_c_namemangling
570        cat <<EOF > genmake_tc_1.c
571    $FC_NAMEMANGLE
572    #include <stdio.h>
573    #include <stdlib.h>
574    #include <unistd.h>
575    #include <assert.h>
576    #include <sys/time.h>
577    void FC_NAMEMANGLE(cloc) ( double *curtim )
578    {
579     struct timeval tv1;
580     gettimeofday(&tv1 , (void *)NULL );
581     *curtim =  (double)((tv1.tv_usec)+(tv1.tv_sec)*1.E6);
582     *curtim = *curtim/1.E6;
583    }
584    EOF
585        make genmake_tc_1.o >> genmake_tc.log 2>&1
586        RET_C=$?
587        cat <<EOF > genmake_tc_2.f
588          program hello
589          Real*8 wtime
590          external cloc
591          call cloc(wtime)
592          print *," HELLO WORLD", wtime
593          end program hello
594    EOF
595        $FC $FFLAGS -o genmake_tc genmake_tc_2.f genmake_tc_1.o >> genmake_tc.log 2>&1
596        RET_F=$?
597        test -x ./genmake_tc  &&  ./genmake_tc >> genmake_tc.log 2>&1
598        RETVAL=$?
599        if test "x$RETVAL" = x0 ; then
600            HAVE_CLOC=t
601            DEFINES="$DEFINES -DHAVE_CLOC"
602        fi
603        rm -f genmake_tc*
604    }
605    
606    
607    check_netcdf_libs()  {
608        cat <<EOF > genmake_tnc.for
609          program fgennc
610    #include "netcdf.inc"
611          integer iret, ncid, xid
612          iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)
613          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
614          iret = nf_def_dim(ncid, 'X', 11, xid)
615          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
616          iret = nf_close(ncid)
617          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
618          end
619    EOF
620        $CPP genmake_tnc.for > genmake_tnc.f  \
621            &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1
622        RET_COMPILE=$?
623        test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
624        RETVAL=$?
625        if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
626            HAVE_NETCDF=t
627        else
628            # try again with "-lnetcdf" added to the libs
629            $CPP genmake_tnc.for > genmake_tnc.f  \
630                &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \
631                $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1
632            RET_COMPILE=$?
633            test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
634            RETVAL=$?
635            if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
636                LIBS="$LIBS -lnetcdf"
637                HAVE_NETCDF=t
638            else
639                cat genmake_tnc.log >> genmake_warnings
640            fi
641        fi
642        rm -f genmake_tnc*
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 361  LN= Line 656  LN=
656  S64=  S64=
657  KPP=  KPP=
658  FC=  FC=
659    CPP=
660  LINK=  LINK=
 # DEFINES="-DWORDLENGTH=4"  
661  DEFINES=  DEFINES=
662  PACKAGES=  PACKAGES=
663  ENABLE=  ENABLE=
# Line 379  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=
687  HAVE_FDATE=  HAVE_FDATE=
688  FC_NAMEMANGLE=  FC_NAMEMANGLE=
689    HAVE_CLOC=
690    HAVE_NETCDF=
691    HAVE_ETIME=
692    
693  MODS=  MODS=
694  TOOLSDIR=  TOOLSDIR=
695  SOURCEDIRS=  SOURCEDIRS=
696  INCLUDEDIRS=  INCLUDEDIRS=
697  STANDARDDIRS=  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 410  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 426  TAMC_EXTRA= Line 731  TAMC_EXTRA=
731    
732    
733  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
734  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
735  gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS"  gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS"
736    
737  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
738  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM "  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM "
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 444  gm_s12="TAF_EXTRA TAMC_EXTRA" Line 749  gm_s12="TAF_EXTRA TAMC_EXTRA"
749  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7"  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7"
750  gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"  gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"
751    
752    cat <<EOF
753    
754    GENMAKE :
755    
756    A program for GENerating MAKEfiles for the MITgcm project.  For a
757    quick list of options, use "genmake -h" or for more detail see:
758    
759      http://mitgcm.org/devel_HOWTO/
760    
761    EOF
762    
 echo  
763  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
764  gm_local="genmake_local"  gm_local="genmake_local"
765  for i in . $MODS ; do  for i in . $MODS ; do
# Line 454  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 478  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 499  for ac_option ; do Line 815  for ac_option ; do
815          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
816              OPTFILE=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
817                    
818          -adoptfile | --adoptfile | -ad | --ad)          -adoptfile | --adoptfile | -adof | --adof)
819              ac_prev=AD_OPTFILE ;;              ac_prev=AD_OPTFILE ;;
820          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)
821              AD_OPTFILE=$ac_optarg ;;              AD_OPTFILE=$ac_optarg ;;
# Line 519  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=*)
851              MAKEFILE=$ac_optarg ;;              MAKEFILE=$ac_optarg ;;
852                    
853          -platform | --platform | -pl | --pl)          -platform | --platform | -pl | --pl | -platform=* | --platform=* | -pl=* | --pl=*)
854              ac_prev=PLATFORM ;;              echo "ERROR: The platform option has been removed.  Please specify"
855          -platform=* | --platform=* | -pl=* | --pl=*)              echo "  the build options using the \"optfile\" mechanism."
856              PLATFORM=$ac_optarg ;;              echo
857                usage
858                ;;
859                    
860          -rootdir | --rootdir | -rd | --rd)          -rootdir | --rootdir | -rd | --rd)
861              ac_prev=ROOTDIR ;;              ac_prev=ROOTDIR ;;
# Line 554  for ac_option ; do Line 882  for ac_option ; do
882          -standarddirs=* | --standarddirs=*)          -standarddirs=* | --standarddirs=*)
883              STANDARDDIRS=$ac_optarg ;;              STANDARDDIRS=$ac_optarg ;;
884    
         -noopt | --noopt)  
             ac_prev=NOOPT ;;  
         -noopt=* | --noopt=*)  
             NOOPT=$ac_optarg ;;  
           
885  #           -cpp | --cpp)  #           -cpp | --cpp)
886  #               ac_prev=cpp ;;  #               ac_prev=cpp ;;
887  #           -cpp=* | --cpp=*)  #           -cpp=* | --cpp=*)
# Line 569  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)          -mpi | --mpi)
911              MPI=true ;;              MPI=true ;;
912          -nompi | --nompi)          -mpi=* | --mpi=*)
913              MPI= ;;              MPIPATH=$ac_optarg
914                MPI=true ;;
915                    
916          -jam | --jam)  #       -jam | --jam)
917              JAM=1 ;;  #           JAM=1 ;;
918          -nojam | --nojam)  #       -nojam | --nojam)
919              JAM=0 ;;  #           JAM=0 ;;
920                    
921          -ds | --ds)          -ds | --ds)
922              DUMPSTATE=t ;;              DUMPSTATE=t ;;
# Line 630  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 664  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 677  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 691  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 704  if test "x${AD_OPTFILE}" != xNONE ; then Line 1041  if test "x${AD_OPTFILE}" != xNONE ; then
1041      fi      fi
1042  fi  fi
1043    
1044  #  Check that FC, LINK, CPP, S64, and LN are defined.  If not,  #  Check that FC, LINK, CPP, S64, LN, and MAKE are defined.  If not,
1045  #  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 719  fi Line 1060  fi
1060  if test "x$LINK" = x ; then  if test "x$LINK" = x ; then
1061      LINK=$FC      LINK=$FC
1062  fi  fi
1063    if test "x$MAKE" = x ; then
1064        MAKE="make"
1065    fi
1066  if test "x$CPP" = x ; then  if test "x$CPP" = x ; then
1067      CPP="cpp"      CPP=cpp
1068  fi  fi
1069    #EH3 === UGLY ===
1070    #  The following is an ugly little hack to check for $CPP in /lib/ and
1071    #  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"
1073    #  to find the correct location for binaries such as $CPP.
1074    for i in " " "/lib/" ; do
1075        echo "#define A a" | $i$CPP > test_cpp 2>&1 && CPP=$i$CPP
1076    done
1077    #EH3 === UGLY ===
1078  echo "#define A a" | $CPP > test_cpp 2>&1  echo "#define A a" | $CPP > test_cpp 2>&1
1079  RETVAL=$?  RETVAL=$?
1080  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
# Line 738  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 758  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 777  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 798  else Line 1157  else
1157  fi  fi
1158  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1159    
1160  echo "  The name mangling convention for $FC is...  "  printf "  Do we have the etime() command using $FC...  "
1161  #FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _"  cat > genmake_tcomp.f <<EOF
1162  if test "x$FC_NAMEMANGLE" = x ; then        program hello
1163      get_fortran_c_namemangling        REAL*4 ACTUAL, TARRAY(2)
1164  fi        EXTERNAL ETIME
1165  echo "    '$FC_NAMEMANGLE'"        REAL*4 ETIME
1166  echo "$FC_NAMEMANGLE" > FC_NAMEMANGLE.h.template        actual = etime( tarray )
1167  cmp FC_NAMEMANGLE.h FC_NAMEMANGLE.h.template > /dev/null 2>&1        print *, tarray
1168          end
1169    EOF
1170    $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1
1171  RETVAL=$?  RETVAL=$?
1172  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" = x0 ; then
1173      mv -f FC_NAMEMANGLE.h.template FC_NAMEMANGLE.h      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
1184    if test "x$HAVE_CLOC" != x ; then
1185        echo "yes"
1186    else
1187        echo "no"
1188    fi
1189    rm -f genmake_t*
1190    
1191    printf "  Can we create NetCDF-enabled binaries...  "
1192    check_netcdf_libs
1193    if test "x$HAVE_NETCDF" != x ; then
1194        echo "yes"
1195    else
1196        echo "no"
1197  fi  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 850  if test "x${TOOLSDIR}" = x ; then Line 1235  if test "x${TOOLSDIR}" = x ; then
1235      TOOLSDIR="$ROOTDIR/tools"      TOOLSDIR="$ROOTDIR/tools"
1236  fi  fi
1237  if test ! -d ${TOOLSDIR} ; then  if test ! -d ${TOOLSDIR} ; then
1238      echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!"      echo "Error: the specified TOOLSDIR (\"$TOOLSDIR\") does not exist!"
1239      exit 1      exit 1
1240  fi  fi
1241  if test "x$S64" = x ; then  if test "x$S64" = x ; then
1242      S64='$(TOOLSDIR)/set64bitConst.sh'      S64='$(TOOLSDIR)/set64bitConst.sh'
1243  fi  fi
1244    THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'`
1245    
1246  EXECUTABLE=${EXECUTABLE:-mitgcmuv}  EXECUTABLE=${EXECUTABLE:-mitgcmuv}
1247    
# Line 870  if test -r $ROOTDIR"/eesupp/src/Makefile Line 1256  if test -r $ROOTDIR"/eesupp/src/Makefile
1256          rm -f make_eesupp.errors          rm -f make_eesupp.errors
1257      else      else
1258          echo "Error: problem encountered while building source files in eesupp:"          echo "Error: problem encountered while building source files in eesupp:"
1259          cat make_eesupp.errors          cat make_eesupp.errors 1>&2
1260          exit 1          exit 1
1261      fi      fi
1262  fi  fi
1263    
1264    #same for exch2
1265    if test -r $ROOTDIR"/pkg/exch2/Makefile" ; then
1266        echo "  Making source files in exch2 from  templates"
1267        ( cd $ROOTDIR"/pkg/exch2/" && $MAKE ) > make_exch2.errors 2>&1
1268        RETVAL=$?
1269        if test "x${RETVAL}" = x0 ; then
1270            rm -f make_exch2.errors
1271        else
1272            echo "Error: problem encountered while building source files in exch2:"
1273            cat make_exch2.errors 1>&2
1274            exit 1
1275        fi
1276    fi
1277    
1278  printf "\n===  Determining package settings  ===\n"  printf "\n===  Determining package settings  ===\n"
1279  if  test "x${PDEPEND}" = x ; then  if  test "x${PDEPEND}" = x ; then
1280      tmp=$ROOTDIR"/pkg/pkg_depend"      tmp=$ROOTDIR"/pkg/pkg_depend"
# Line 907  rm -f ./.pd_tmp Line 1307  rm -f ./.pd_tmp
1307  #  Search for default packages.  Note that a "$ROOTDIR/pkg/pkg_groups"  #  Search for default packages.  Note that a "$ROOTDIR/pkg/pkg_groups"
1308  #  file should eventually be added so that, for convenience, one can  #  file should eventually be added so that, for convenience, one can
1309  #  specify groups of packages using names like "ocean" and "atmosphere".  #  specify groups of packages using names like "ocean" and "atmosphere".
1310  echo  -n "  checking default package list:  "  echo "  checking default package list:  "
1311  if test "x${PDEFAULT}" = x ; then  if test "x${PDEFAULT}" = x ; then
1312      for i in "." $MODS ; do      for i in "." $MODS ; do
1313          if test -r $i"/packages.conf" ; then          if test -r $i"/packages.conf" ; then
# Line 920  if test "x${PDEFAULT}" = x ; then Line 1320  if test "x${PDEFAULT}" = x ; then
1320      PDEFAULT="$ROOTDIR/pkg/pkg_default"      PDEFAULT="$ROOTDIR/pkg/pkg_default"
1321  fi  fi
1322  if test "x${PDEFAULT}" = xNONE ; then  if test "x${PDEFAULT}" = xNONE ; then
1323      echo "default packages file disabled"      echo "    default packages file disabled"
1324  else  else
1325      if test ! -r $PDEFAULT ; then      if test ! -r $PDEFAULT ; then
         echo ""  
1326          echo "Warning:  can't read default packages from PDEFAULT=\"$PDEFAULT\""          echo "Warning:  can't read default packages from PDEFAULT=\"$PDEFAULT\""
1327      else      else
1328          echo "  using PDEFAULT=\"$PDEFAULT\""          echo "    using PDEFAULT=\"$PDEFAULT\""
1329          #  Strip the comments and add all the names          #  Strip the comments and add all the names
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 939  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 961  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 1059  for i in $PACKAGES ; do Line 1466  for i in $PACKAGES ; do
1466      fi      fi
1467  done  done
1468    
1469    #  Build MNC templates and check for ability to build and use NetCDF
1470    echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1
1471    RETVAL=$?
1472    if test "x$RETVAL" = x0 ; then
1473        ( cd $ROOTDIR"/pkg/mnc" && $MAKE templates ) > make_mnc.errors 2>&1
1474        RETVAL=$?
1475        if test "x${RETVAL}" = x0 ; then
1476            rm -f make_mnc.errors
1477        else
1478            echo "Error: problem encountered while building source files in pkg/mnc:"
1479            cat make_mnc.errors 1>&2
1480            exit 1
1481        fi
1482        if test "x$HAVE_NETCDF" != xt ; then
1483            cat <<EOF
1484    
1485  # Create a list of #define and #undef to enable/disable packages  WARNING: the "mnc" package has been enabled but tests failed to
1486  PACKAGES_DOT_H=PACKAGES_CONFIG.h    compile and/or execute NetCDF applications.  Please check that:
 cat <<EOF >$PACKAGES_DOT_H".tmp"  
 C=== GENMAKE v2 ===  
 C  The following defines have been set by GENMAKE, so please do not  
 C  edit anything below these comments.  In general, you should  
 C  add or remove packages by re-running genmake with different  
 C  "-enable" and/or "-disable" options.  
   
 #ifndef PACKAGES_H  
 #define PACKAGES_H  
1487    
1488  C  Packages disabled by genmake:    1) NetCDF is installed for your compiler and
1489      2) the LIBS variable (within the 'optfile") specifies the correct
1490           NetCDF library to link against.
1491      
1492  EOF  EOF
1493        fi
1494    fi
1495    
1496    # Create a list of #define and #undef to enable/disable packages
1497    PACKAGES_DOT_H=PACKAGES_CONFIG.h
1498  #  The following UGLY HACK sets multiple "#undef"s and it needs to go  #  The following UGLY HACK sets multiple "#undef"s and it needs to go
1499  #  away.  On 2003-08-12, CNH, JMC, and EH3 agreed that the CPP_OPTIONS.h  #  away.  On 2003-08-12, CNH, JMC, and EH3 agreed that the CPP_OPTIONS.h
1500  #  file would eventually be split up so that all package-related #define  #  file would eventually be split up so that all package-related #define
1501  #  statements could be separated and handled only by genmake.  #  statements could be separated and handled only by genmake.
1502  names=`ls -1 "$ROOTDIR/pkg"`  names=`ls -1 "$ROOTDIR/pkg"`
1503  all_pack=  all_pack=
1504    DISABLED_PACKAGES=
1505  for n in $names ; do  for n in $names ; do
1506      if test -d "$ROOTDIR/pkg/$n" -a "x$n" != xCVS ; then      if test -d "$ROOTDIR/pkg/$n" -a "x$n" != xCVS ; then
1507          has_pack="f"          has_pack="f"
# Line 1091  for n in $names ; do Line 1513  for n in $names ; do
1513          done          done
1514          if test "x$has_pack" = xf ; then          if test "x$has_pack" = xf ; then
1515              undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`              undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`
1516              echo "#undef $undef" >> $PACKAGES_DOT_H".tmp"              DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef"
1517          fi          fi
1518      fi      fi
1519  done  done
1520  cat <<EOF >>$PACKAGES_DOT_H".tmp"  ENABLED_PACKAGES=
   
 C  Packages enabled by genmake:  
 EOF  
1521  for i in $PACKAGES ; do  for i in $PACKAGES ; do
1522      def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'`      def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'`
1523      echo "#define $def" >> $PACKAGES_DOT_H".tmp"      ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def"
1524  #eh3 DEFINES="$DEFINES -D$def"  #eh3 DEFINES="$DEFINES -D$def"
1525    
1526  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
1527      case $i in      case $i in
1528          aim_v23)          aim_v23)
1529              echo "#define   ALLOW_AIM" >> $PACKAGES_DOT_H".tmp"              ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM"
1530              DEFINES="$DEFINES -DALLOW_AIM"              echo "Warning: ALLOW_AIM is set to enable aim_v23."
             echo "Warning: ALLOW_AIM is set to enable aim_v23. This is REALLY ugly Jean-Michel :-)"  
1531              ;;              ;;
1532      esac      esac
1533  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
1534    
1535  done  done
 cat <<EOF >>$PACKAGES_DOT_H".tmp"  
   
 #endif /* PACKAGES_H */  
 EOF  
   
 if test ! -f $PACKAGES_DOT_H ; then  
     mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H  
 else  
     cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H  
     RETVAL=$?  
     if test "x$RETVAL" = x0 ; then  
         rm -f $PACKAGES_DOT_H".tmp"  
     else  
         mv -f $PACKAGES_DOT_H $PACKAGES_DOT_H".bak"  
         mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H  
     fi  
 fi  
1536    
1537  echo "  Adding STANDARDDIRS"  echo "  Adding STANDARDDIRS"
1538  BUILDDIR=${BUILDDIR:-.}  BUILDDIR=${BUILDDIR:-.}
1539  if test "x$STANDARDDIRS" = x ; then  if test "x$STANDARDDIRS" = xUSE_THE_DEFAULT ; then
1540      STANDARDDIRS="eesupp model"      STANDARDDIRS="eesupp model"
1541  fi  fi
1542  for d in $STANDARDDIRS ; do  if test "x$STANDARDDIRS" != x ; then
1543      adr="$ROOTDIR/$d/src"      for d in $STANDARDDIRS ; do
1544      if test ! -d $adr ; then          adr="$ROOTDIR/$d/src"
1545          echo "Error:  directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""          if test ! -d $adr ; then
1546          echo "  is correct and that you correctly specified the STANDARDDIRS option"              echo "Error:  directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""
1547          exit 1              echo "  is correct and that you correctly specified the STANDARDDIRS option"
1548      else              exit 1
1549          SOURCEDIRS="$SOURCEDIRS $adr"          else
1550      fi              SOURCEDIRS="$SOURCEDIRS $adr"
1551      adr="$ROOTDIR/$d/inc"          fi
1552      if test ! -d $adr ; then          adr="$ROOTDIR/$d/inc"
1553          echo "Error:  directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""          if test ! -d $adr ; then
1554          echo "  is correct and that you correctly specified the STANDARDDIRS option"              echo "Error:  directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""
1555          exit 1              echo "  is correct and that you correctly specified the STANDARDDIRS option"
1556      else              exit 1
1557          INCLUDEDIRS="$INCLUDEDIRS $adr"          else
1558      fi              INCLUDEDIRS="$INCLUDEDIRS $adr"
1559  done          fi
1560        done
1561    fi
1562    
1563  echo "  Searching for CPP_OPTIONS.h in order to warn about the presence"  echo "  Searching for *OPTIONS.h files in order to warn about the presence"
1564  echo "    of \"#define ALLOW_PKGNAME\"-type statements:"  echo "    of \"#define \"-type statements that are no longer allowed:"
1565  CPP_OPTIONS=  CPP_OPTIONS=
1566    CPP_EEOPTIONS=
1567  spaths=". $INCLUDEDIRS"  spaths=". $INCLUDEDIRS"
1568    names=`ls -1 "$ROOTDIR/pkg"`
1569  for i in $spaths ; do  for i in $spaths ; do
1570      try="$i/CPP_OPTIONS.h"      try="$i/CPP_OPTIONS.h"
1571      #  echo -n "    trying $try : "      if test -f $try -a -r $try -a "x$CPP_OPTIONS" = x ; then
     if test -f $try -a -r $try ; then  
1572          echo "    found CPP_OPTIONS=\"$try\""          echo "    found CPP_OPTIONS=\"$try\""
1573          CPP_OPTIONS="$try"          CPP_OPTIONS="$try"
1574          break          # New safety test: make sure packages are not mentioned in CPP_OPTIONS.h
1575            for n in $names ; do
1576                test_for_package_in_cpp_options $CPP_OPTIONS $n
1577            done
1578        fi
1579        try="$i/CPP_EEOPTIONS.h"
1580        if test -f $try -a -r $try -a "x$CPP_EEOPTIONS" = x ; then
1581            echo "    found CPP_EEOPTIONS=\"$try\""
1582            # New safety test: make sure MPI is not determined by CPP_EEOPTIONS.h
1583    #**** not yet enabled ****
1584    #        test_for_mpi_in_cpp_eeoptions $try
1585    #**** not yet enabled ****
1586            CPP_EEOPTIONS="$try"
1587      fi      fi
1588  done  done
1589  if test "x$CPP_OPTIONS" = x ; then  if test "x$CPP_OPTIONS" = x ; then
1590      echo "Error: can't find \"CPP_OPTIONS.h\" in the path list: $spaths"      echo "Error: can't find \"CPP_OPTIONS.h\" in the path list: $spaths"
1591      exit 1      exit 1
1592  fi  fi
 # New safety test: make sure packages are not mentioned in CPP_OPTIONS.h  
 names=`ls -1 "$ROOTDIR/pkg"`  
 for n in $names ; do  
     test_for_package_in_cpp_options $CPP_OPTIONS $n  
 done  
   
1593    
1594  #  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
1595  #  compiler.  #  compiler.
# Line 1194  for i in $SOURCEDIRS ; do Line 1604  for i in $SOURCEDIRS ; do
1604      done      done
1605  done  done
1606    
 cat <<EOF > adjoint_sed  
 s/call adopen(/call adopen ( mythid,\\  
      \&           /g  
 s/call adclose(/call adclose( mythid,\\  
      \&           /g  
 s/call adread(/call adread ( mythid,\\  
      \&           /g  
 s/call adwrite(/call adwrite( mythid,\\  
      \&           /g  
   
 EOF  
1607    
1608  echo  echo
1609  echo "===  Creating the Makefile  ==="  echo "===  Creating the Makefile  ==="
# Line 1222  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 1235  for d in $alldirs ; do Line 1634  for d in $alldirs ; do
1634      for sf in $sfiles ; do      for sf in $sfiles ; do
1635          if test ! -r ".links.tmp/$sf" ; then          if test ! -r ".links.tmp/$sf" ; then
1636              if test -f "$d/$sf" ; then              if test -f "$d/$sf" ; then
1637                    case $d/$sf in
1638                      ./$PACKAGES_DOT_H)
1639                            ;;
1640                      ./AD_CONFIG.h)
1641                            ;;
1642                      ./FC_NAMEMANGLE.h)
1643                            ;;
1644                      *)
1645                            touch .links.tmp/$sf
1646                            deplist="$deplist $sf"
1647                            ;;
1648                    esac
1649                  extn=`echo $sf | $AWK -F '.' '{print $NF}'`                  extn=`echo $sf | $AWK -F '.' '{print $NF}'`
                 touch .links.tmp/$sf  
                 deplist="$deplist $sf"  
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 1286  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 1295  EXE_FTL=$EXECUTABLE"_ftl" Line 1704  EXE_FTL=$EXECUTABLE"_ftl"
1704  EXE_SVD=$EXECUTABLE"_svd"  EXE_SVD=$EXECUTABLE"_svd"
1705    
1706  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
1707    #
1708    # OPTFILE="$OPTFILE"
1709  #  #
1710  # BUILDDIR     : Directory where object files are written  # BUILDDIR     : Directory where object files are written
1711  # SOURCEDIRS   : Directories containing the source (.F) files  # SOURCEDIRS   : Directories containing the source (.F) files
# Line 1328  EXE_AD      = ${EXE_AD} Line 1739  EXE_AD      = ${EXE_AD}
1739  EXE_FTL     = ${EXE_FTL}  EXE_FTL     = ${EXE_FTL}
1740  EXE_SVD     = ${EXE_SVD}  EXE_SVD     = ${EXE_SVD}
1741    
1742    ENABLED_PACKAGES = ${ENABLED_PACKAGES}
1743    DISABLED_PACKAGES = ${DISABLED_PACKAGES}
1744    
1745    # These files are created by Makefile
1746    SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h
1747    
1748  EOF  EOF
1749    
1750  #  Note: figure out some way to add Hyades JAM libraries here  #  Note: figure out some way to add Hyades JAM libraries here
# Line 1346  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 1378  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): \$(OBJFILES)  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES)
1812            @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)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)
1821    
1822  small_f: \$(F77FILES) \$(F90FILES)  small_f: \$(F77FILES) \$(F90FILES)
1823    
# Line 1408  output.txt: \$(EXECUTABLE) Line 1826  output.txt: \$(EXECUTABLE)
1826          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
1827    
1828  clean:  clean:
1829          -cat AD_CONFIG.template > AD_CONFIG.h          -rm -rf *.o *.$FS *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template
         -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl}  
1830  Clean:  Clean:
1831          @make clean          @make clean
1832          @make cleanlinks          @make cleanlinks
1833          -rm -f Makefile.bak genmake_state genmake_*optfile make.log          -rm -f \$(SPECIAL_FILES)
1834            -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak
1835  CLEAN:  CLEAN:
1836          @make Clean          @make 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          ${0} $@          $THIS_SCRIPT $G2ARGS
1845  cleanlinks:  cleanlinks:
1846          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
1847    
1848  # The normal chain of rules is (  .F - .f - .o  )  # Special targets ($SPECIAL_FILES) which are create by make
1849  .F.f:  ${PACKAGES_DOT_H}:
1850            @echo Creating \$@ ...
1851            @$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:
1853            @echo Creating \$@ ...
1854            @$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:
1856            @echo Creating \$@ ...
1857            echo "$FC_NAMEMANGLE" > \$@
1858    
1859    # The normal chain of rules is (  .F - .$FS - .o  )
1860    
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 1469  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 1486  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            @$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
1924          @make \$(F77FILES)          @make \$(F77FILES)
1925          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
1926          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f
1927    
1928  ad_taf_output.f: ad_input_code.f  ad_taf_output.f: ad_input_code.f
1929          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1930          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f
1931    
1932  adtafonly:  adtafonly:
1933          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1934          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f
1935    
1936  ad_taf: ad_taf_output.o \$(OBJFILES)  ad_taf: ad_taf_output.o \$(OBJFILES)
1937          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
1938    
1939  ad_tamc_output.f: ad_input_code.f  ad_tamc_output.f: ad_input_code.f
1940          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f
1941          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_tamc_output.f          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.f
1942    
1943  ad_tamc: ad_tamc_output.o \$(OBJFILES)  ad_tamc: ad_tamc_output.o \$(OBJFILES)
1944          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
# Line 1516  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            @$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
1956          @make \$(F77FILES)          @make \$(F77FILES)
1957          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
1958          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f
1959    
1960  ftl_taf_output.f: ftl_input_code.f  ftl_taf_output.f: ftl_input_code.f
1961          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1962          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f
1963    
1964    ftltafonly:
1965            \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1966            cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f
1967    
1968  ftl_taf: ftl_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
1969          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
1970    
1971  ftl_tamc_output.f: ftl_input_code.f  ftl_tamc_output.f: ftl_input_code.f
1972          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f
1973          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.f
1974    
1975  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
1976          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
1977    
1978    
1979  # ... SVD ...  # ... SVD ...
1980  svd: svd_taf  svdtaf: ad_taf_output.f ftl_taf_output.f
1981  svd_taf_f: svd_taf_output.f  svdall: svd_taf
1982    
1983  svd_input_code.f: \$(SRCFILES)  svd_taf: ad_taf_output.o ftl_taf_output.o \$(OBJFILES)
1984          cmp svd_config.template AD_CONFIG.h || cat svd_config.template > AD_CONFIG.h          \$(LINK) -o mitgcmuv_svd \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o ftl_taf_output.o \$(LIBS)
         @make \$(F77FILES)  
         @make \$(AD_FLOW_FILES)  
         cat \$(AD_FLOW_FILES) \$(AD_FILES) > svd_input_code.f  
   
 svd_taf_output.f: svd_input_code.f  
         \$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) svd_input_code.f  
         cat svd_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f  
   
 svd_taf: svd_taf_output.o \$(OBJFILES)  
         \$(LINK) -o ${EXE_SVD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS)  
1985    
1986    
1987  #=========================================  #=========================================
# Line 1569  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 1579  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 1592  printf "\n\n# DO NOT DELETE\n" >> $MAKEF Line 2022  printf "\n\n# DO NOT DELETE\n" >> $MAKEF
2022    
2023  printf "\n===  Done  ===\n"  printf "\n===  Done  ===\n"
2024    
2025  #  Write the "template" files for the adjoint builds  # Create special header files
2026  cat >AD_CONFIG.template <<EOF  $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  C  WARNING: This file is automatically generated by genmake2 and  if test ! -f $PACKAGES_DOT_H ; then
2028  C    used by the Makefile rules.  Please DO NOT EDIT this file      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
2029  C    unless you are CERTAIN that you know what you are doing.  else
2030        cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H > /dev/null 2>&1
2031  #undef ALLOW_ADJOINT_RUN      RETVAL=$?
2032  #undef ALLOW_TANGENTLINEAR_RUN      if test "x$RETVAL" = x0 ; then
2033  #undef ALLOW_ECCO_OPTIMIZATION          rm -f $PACKAGES_DOT_H".tmp"
2034  EOF      else
2035  cat >ad_config.template <<EOF          mv -f $PACKAGES_DOT_H $PACKAGES_DOT_H".bak"
2036  C  WARNING: This file is automatically generated by genmake2 and          mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
2037  C    used by the Makefile rules.  Please DO NOT EDIT this file      fi
2038  C    unless you are CERTAIN that you know what you are doing.  fi
2039    if test ! -f AD_CONFIG.h ; then
2040  #define ALLOW_ADJOINT_RUN      $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  #undef ALLOW_TANGENTLINEAR_RUN  fi
 #undef ALLOW_ECCO_OPTIMIZATION  
 EOF  
 cat >ftl_config.template <<EOF  
 C  WARNING: This file is automatically generated by genmake2 and  
 C    used by the Makefile rules.  Please DO NOT EDIT this file  
 C    unless you are CERTAIN that you know what you are doing.  
   
 #undef ALLOW_ADJOINT_RUN  
 #define ALLOW_TANGENTLINEAR_RUN  
 #undef ALLOW_ECCO_OPTIMIZATION  
 EOF  
 cat >svd_config.template <<EOF  
 C  WARNING: This file is automatically generated by genmake2 and  
 C    used by the Makefile rules.  Please DO NOT EDIT this file  
 C    unless you are CERTAIN that you know what you are doing.  
   
 #undef ALLOW_ADJOINT_RUN  
 #undef ALLOW_TANGENTLINEAR_RUN  
 #undef ALLOW_ECCO_OPTIMIZATION  
 EOF  
 cp AD_CONFIG.template AD_CONFIG.h  
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.37  
changed lines
  Added in v.1.84

  ViewVC Help
Powered by ViewVC 1.1.22