/[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.211 by jmc, Tue Nov 2 22:45:07 2010 UTC revision 1.237 by jmc, Fri Aug 24 23:41:17 2012 UTC
# Line 1  Line 1 
1  #! /usr/bin/env bash  #! /usr/bin/env bash
2  #  #
3  # $Header$  # $Header$
4    # $Name$
5  #  #
6  # Makefile generator for MITgcm UV codes  # Makefile generator for MITgcm UV codes
7  #   created  by cnh 03/98  #   created  by cnh 03/98
# Line 8  Line 9 
9  #   modified by aja 01/00  #   modified by aja 01/00
10  #   rewritten in bash by eh3 08/03  #   rewritten in bash by eh3 08/03
11    
12    #  Explain usage
13    usage()  {
14    cat <<EOF
15    
16    Usage: "$0" [OPTIONS]
17      where [OPTIONS] can be:
18    
19        -help | --help | -h | --h
20              Print this help message and exit.
21    
22        -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME
23          -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME
24              Use "NAME" as the adoptfile.  By default, the file at
25              "tools/adjoint_options/adjoint_default" will be used.
26    
27        -nooptfile | --nooptfile
28          -optfile NAME | --optfile NAME | -of NAME | --of NAME
29          -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME
30              Use "NAME" as the optfile.  By default, an attempt will be
31              made to find an appropriate "standard" optfile in the
32              tools/build_options/ directory.
33    
34        -pdepend NAME | --pdepend NAME
35          -pdepend=NAME | --pdepend=NAME
36              Get package dependency information from "NAME".
37    
38        -pgroups NAME | --pgroups NAME
39          -pgroups=NAME | --pgroups=NAME
40              Get the package groups information from "NAME".
41    
42        -bash NAME
43              Explicitly specify the Bourne or BASH shell to use
44    
45        -make NAME | -m NAME
46          --make=NAME | -m=NAME
47              Use "NAME" for the MAKE program. The default is "make" but
48              many platforms, "gmake" is the preferred choice.
49    
50        -makefile NAME | -mf NAME
51          --makefile=NAME | -mf=NAME
52              Call the makefile "NAME".  The default is "Makefile".
53    
54        -makedepend NAME | -md NAME
55          --makedepend=NAME | -md=NAME
56              Use "NAME" for the MAKEDEPEND program.
57    
58        -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME
59          -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME
60              Specify the location of the MITgcm ROOTDIR as "NAME".
61              By default, genamke will try to find the location by
62              looking in parent directories (up to the 5th parent).
63    
64        -mods NAME | --mods NAME | -mo NAME | --mo NAME
65          -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME
66              Here, "NAME" specifies a list of directories that are
67              used for additional source code.  Files found in the
68              "mods list" are given preference over files of the same
69              name found elsewhere.
70    
71        -disable NAME | --disable NAME
72          -disable=NAME | --disable=NAME
73              Here "NAME" specifies a list of packages that we don't
74              want to use.  If this violates package dependencies,
75              genamke will exit with an error message.
76    
77        -enable NAME | --enable NAME
78          -enable=NAME | --enable=NAME
79              Here "NAME" specifies a list of packages that we wish
80              to specifically enable.  If this violates package
81              dependencies, genamke will exit with an error message.
82    
83        -standarddirs NAME | --standarddirs NAME
84          -standarddirs=NAME | --standarddirs=NAME
85              Here, "NAME" specifies a list of directories to be
86              used as the "standard" code.
87    
88        -fortran NAME | --fortran NAME | -fc NAME | --fc NAME
89          -fc=NAME | --fc=NAME
90              Use "NAME" as the fortran compiler.  By default, genmake
91              will search for a working compiler by trying a list of
92              "usual suspects" such as g77, f77, etc.
93    
94        -cc NAME | --cc NAME | -cc=NAME | --cc=NAME
95              Use "NAME" as the C compiler.  By default, genmake
96              will search for a working compiler by trying a list of
97              "usual suspects" such as gcc, c89, cc, etc.
98    
99        -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4
100              Use "real*4" type for _RS variable (#undef REAL4_IS_SLOW)
101              *only* works if CPP_EEOPTIONS.h allows this.
102    
103        -ignoretime | -ignore_time | --ignoretime | --ignore_time
104              Ignore all the "wall clock" routines entirely.  This will
105              not in any way hurt the model results -- it simply means
106              that the code that checks how long the model spends in
107              various routines will give junk values.
108    
109        -ts | --ts
110              Produce timing information per timestep
111        -papis | --papis
112              Produce summary MFlop/s (and IPC) with PAPI per timestep
113        -pcls | --pcls
114              Produce summary MFlop/s etc. with PCL per timestep
115        -foolad | --foolad
116              Fool the AD code generator
117        -papi | --papi
118              Performance analysis with PAPI
119        -pcl | --pcl
120              Performance analysis with PCL
121        -hpmt | --hpmt
122              Performance analysis with the HPM Toolkit
123    
124        -ieee | --ieee
125              use IEEE numerics.  Note that this option *only* works
126              if it is supported by the OPTFILE that is being used.
127        -devel | --devel
128              Add additional warning and debugging flags for development
129              (if supported by the OPTFILE); also switch to IEEE numerics.
130        -gsl | --gsl
131              Use GSL to control floating point rounding and precision
132    
133        -mpi | --mpi
134              Include MPI header files and link to MPI libraries
135        -mpi=PATH | --mpi=PATH
136              Include MPI header files and link to MPI libraries using MPI_ROOT
137              set to PATH. i.e. Include files from \$PATH/include, link to libraries
138              from \$PATH/lib and use binaries from \$PATH/bin.
139    
140        -omp | --omp
141              Activate OpenMP code + use Compiler option OMPFLAG
142        -omp=OMPFLAG | --omp=OMPFLAG
143              Activate OpenMP code + use Compiler option OMPFLAG
144    
145        -es | --es | -embed-source | --embed-source
146              Embed a tarball containing the full source code
147              (including the Makefile, etc.) used to build the
148              executable [off by default]
149    
150        -ds | --ds
151              Report genmake internal variables status (DUMPSTATE)
152              to file "genmake_state" (for debug purpose)
153    
154      While it is most often a single word, the "NAME" variables specified
155      above can in many cases be a space-delimited string such as:
156    
157        --enable pkg1   --enable 'pkg1 pkg2'   --enable 'pkg1 pkg2 pkg3'
158        -mods=dir1   -mods='dir1'   -mods='dir1 dir2 dir3'
159        -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'
160    
161      which, depending upon your shell, may need to be single-quoted.
162    
163      For more detailed genmake documentation, please see:
164    
165        http://mitgcm.org/public/devel_HOWTO/
166    
167    EOF
168    
169        exit 1
170    }
171    
172  # Search for particular CPP #cmds associated with packages  # Search for particular CPP #cmds associated with packages
173  # usage: test_for_package_in_cpp_options CPP_file package_name  # usage: test_for_package_in_cpp_options CPP_file package_name
174  test_for_package_in_cpp_options() {  test_for_package_in_cpp_options() {
# Line 46  test_for_string_in_file() { Line 207  test_for_string_in_file() {
207      RETVAL=$?      RETVAL=$?
208      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
209          printf "Error: In $file there is an illegal line: "          printf "Error: In $file there is an illegal line: "
210          grep -i "$strng" $file          grep -i "$strng" $file
211          exit 99          exit 99
212      fi      fi
213      return 0      return 0
# Line 136  EOF Line 297  EOF
297  .F.$tfs:  .F.$tfs:
298          $LN \$< \$@          $LN \$< \$@
299  EOF  EOF
300      $MAKE "genmake_hello."$tfs > /dev/null 2>&1      $MAKE -f $MAKEFILE "genmake_hello."$tfs > /dev/null 2>&1
301      RETVAL=$?      RETVAL=$?
302      if test "x$RETVAL" != x0 -o ! -f "genmake_hello."$tfs ; then      if test "x$RETVAL" != x0 -o ! -f "genmake_hello."$tfs ; then
303          if test "x$FS" = x ; then          if test "x$FS" = x ; then
# Line 144  EOF Line 305  EOF
305              FS90='fr9'              FS90='fr9'
306              check_for_broken_Ff              check_for_broken_Ff
307          else          else
308              cat <<EOF 2>&1              echo "ERROR: test: '$MAKE -f $MAKEFILE genmake_hello.$tfs' Failed"
309  ERROR: Your file system cannot distinguish between *.F and *.f files              echo "       see simple makefile: '$MAKEFILE' (left here)"
310    (fails the "make/ln" test) and this program cannot find a suitable              echo "  Please check (1) your '$MAKE' command, (2) your '$LN' command"
311    replacement extension.  Please try a different build environment or              echo "           and (3) the allowed sufix '.F' and '.$tfs' in makefile"
312    contact the <MITgcm-support@mitgcm.org> list for help.              echo "  or contact the <MITgcm-support@mitgcm.org> list for help."
313                echo ""
 EOF  
314              exit -1              exit -1
315              return              return
316          fi          fi
# Line 164  EOF Line 324  EOF
324      return      return
325  }  }
326    
   
327  look_for_makedepend()  {  look_for_makedepend()  {
328    
329      #  The "original" makedepend is part of the Imake system that is      #  The "original" makedepend is part of the Imake system that is
# Line 185  look_for_makedepend()  { Line 344  look_for_makedepend()  {
344      #    3) locally build and use the cyrus implementation      #    3) locally build and use the cyrus implementation
345      #    4) fall back to the buggy local xmakedpend script      #    4) fall back to the buggy local xmakedpend script
346      #      #
347        echo >> $LOGFILE
348        echo "running: look_for_makedepend()" >> $LOGFILE
349        if test "x${MAKEDEPEND}" != x ; then
350            echo "${MAKEDEPEND}" | grep -i cyrus > /dev/null 2>&1
351            RETVAL=$?
352            if test x"$RETVAL" = x0 ; then
353                build_cyrus_makedepend
354                RETVAL=$?
355                if test "x$RETVAL" != x0 ; then
356                    echo "WARNING: unable to build cyrus-makedepend. Try 'makedepend'"
357                    MAKEDEPEND=
358                fi
359            else
360                echo "${MAKEDEPEND}" | grep 'tools.xmakedepend' > /dev/null 2>&1
361                RETVAL=$?
362                if test "x$RETVAL" = x0 ; then
363                    MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
364                fi
365                echo " -->     MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE
366            fi
367        fi
368      if test "x${MAKEDEPEND}" = x ; then      if test "x${MAKEDEPEND}" = x ; then
369          which makedepend > /dev/null 2>&1          which makedepend > /dev/null 2>&1
370          RV0=$?          RV0=$?
# Line 203  EOF Line 383  EOF
383        stop        stop
384        end        end
385  EOF  EOF
386          makedepend genmake_tc.f > /dev/null 2>&1          makedepend -f $MAKEFILE genmake_tc.f > /dev/null 2>&1
387          RV1=$?          RV1=$?
388          test -f $MAKEFILE  &&  rm -f $MAKEFILE          test -f $MAKEFILE  &&  rm -f $MAKEFILE
389          test -f $MAKEFILE".tst"  &&  mv -f $MAKEFILE".tst" $MAKEFILE          test -f $MAKEFILE".tst"  &&  mv -f $MAKEFILE".tst" $MAKEFILE
390          if test "x${RV0}${RV1}" = x00 ; then          if test "x${RV0}${RV1}" = x00 ; then
391              MAKEDEPEND=makedepend              MAKEDEPEND=makedepend
392                echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE
393          else          else
394              echo "    a system-default makedepend was not found."              echo "    system-default makedepend not found. Try to build cyrus-makedepend"
   
395              #  Try to build the cyrus implementation              #  Try to build the cyrus implementation
396              build_cyrus_makedepend              build_cyrus_makedepend
397              RETVAL=$?              RETVAL=$?
398              if test "x$RETVAL" != x0 ; then              if test "x$RETVAL" != x0 ; then
399                    echo "WARNING: unable to build cyrus-makedepend. Use local xmakedepend"
400                  MAKEDEPEND='$(TOOLSDIR)/xmakedepend'                  MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
401                    echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE
402              fi              fi
             rm -f ./genmake_cy_md  
         fi  
     else  
         #  echo "MAKEDEPEND=${MAKEDEPEND}"  
         echo "${MAKEDEPEND}" | grep -i cyrus > /dev/null 2>&1  
         RETVAL=$?  
         if test x"$RETVAL" = x0 ; then  
             build_cyrus_makedepend  
403          fi          fi
404      fi      fi
405  }  }
406    
   
407  build_cyrus_makedepend()  {  build_cyrus_makedepend()  {
408        echo >> $LOGFILE
409        echo "running: build_cyrus_makedepend()" >> $LOGFILE
410      rm -f ./genmake_cy_md      rm -f ./genmake_cy_md
411      (      (
412          cd $ROOTDIR/tools/cyrus-imapd-makedepend  \          cd $ROOTDIR/tools/cyrus-imapd-makedepend  \
# Line 248  build_cyrus_makedepend()  { Line 423  build_cyrus_makedepend()  {
423      rm -f ./genmake_cy_md      rm -f ./genmake_cy_md
424      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
425          MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend'          MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend'
426            echo " --> set MAKEDEPEND=${MAKEDEPEND}" >> $LOGFILE
427          return 0          return 0
428      else      else
429          echo "WARNING: unable to build cyrus-imapd-makedepend"          echo "WARNING: fail to build cyrus-imapd-makedepend" >> $LOGFILE
430          return 1          return 1
431      fi      fi
432  }  }
433    
   
434  build_embed_encode()  build_embed_encode()
435  {  {
436      printf "  building the embed-encode utility...  "      printf "  building the embed-encode utility...  "
437      if test ! -e "$ROOTDIR/tools/embed_encode/encode_files" ; then      if test ! -e "$ROOTDIR/tools/embed_encode/encode_files" ; then
438          if test ! -d "$ROOTDIR/tools/embed_encode" ; then          if test ! -d "$ROOTDIR/tools/embed_encode" ; then
439              echo              echo
440              echo "    Error: can't locate \"$ROOTDIR/tools/embed_encode\""              echo "    Error: can't locate \"$ROOTDIR/tools/embed_encode\""
441              echo              echo
442              EMBED_SRC=f              EMBED_SRC=f
443              return 1              return 1
444          fi          fi
445          clist="cc gcc c89 $CC"          clist="cc gcc c89 $CC"
446          for ic in $clist ; do          for ic in $clist ; do
447              comm="$ic -o encode_files encode_files.c"              comm="$ic -o encode_files encode_files.c"
# Line 274  build_embed_encode() Line 449  build_embed_encode()
449              RETVAL=$?              RETVAL=$?
450              if test "x$RETVAL" = x0 ; then              if test "x$RETVAL" = x0 ; then
451                  echo "OK"                  echo "OK"
                 DEFINES="$DEFINES -DHAVE_EMBED_SRC"  
452                  return 0                  return 0
453              fi              fi
454          done          done
# Line 286  build_embed_encode() Line 460  build_embed_encode()
460          return 1          return 1
461      fi      fi
462      echo "OK"      echo "OK"
     DEFINES="$DEFINES -DHAVE_EMBED_SRC"  
463  }  }
464    
465    #  look for possible C compilers
466  # Guess possible config options for this host  look_for_C_compilers() {
467  find_possible_configs()  {      echo >> $LOGFILE
468        echo "running: look_for_C_compilers()" >> $LOGFILE
469      tmp1=`uname`"_"`uname -m`      rm -f ./genmake_hello.c  ./genmake_hello
470      tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`      cat >> genmake_hello.c << EOF
     tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`  
     tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`  
     tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`  
     tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`  
     PLATFORM=$tmp3  
     echo $PLATFORM | grep cygwin > /dev/null 2>&1  &&  PLATFORM=cygwin_ia32  
     OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`  
     echo "  The platform appears to be:  $PLATFORM"  
   
     echo "test" > test  
     ln -s ./test link  
     RETVAL=$?  
     if test "x${RETVAL}" = x0 ; then  
         LN="ln -s"  
     else  
         echo "Error: \"ln -s\" does not appear to work on this system!"  
         echo "  For help, please contact <MITgcm-support@mitgcm.org>."  
         exit 1  
     fi  
     rm -f test link  
   
     if test "x$CPP" = x ; then  
         CPP="cpp -traditional -P"  
     fi  
   
     look_for_makedepend  
   
     #================================================================  
     #  look for possible C compilers  
     tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc"  
     p_CC=  
     for c in $tmp ; do  
         rm -f ./genmake_hello.c  ./genmake_hello  
         cat >> genmake_hello.c << EOF  
471  #include <stdio.h>  #include <stdio.h>
472  int main(int argc, char **argv) {  int main(int argc, char **argv) {
473    printf("Hello!\n");    printf("Hello!\n");
474    return 0;    return 0;
475  }  }
476  EOF  EOF
477          $c -o genmake_hello genmake_hello.c > /dev/null 2>&1      tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc"
478        p_CC=
479        for c in $tmp ; do
480            COMM="$c $CFLAGS -o genmake_hello genmake_hello.c"
481            echo $COMM >> $LOGFILE
482            $COMM >> $LOGFILE 2>&1
483          RETVAL=$?          RETVAL=$?
484          if test "x${RETVAL}" = x0 ; then          if test "x${RETVAL}" = x0 ; then
485                echo " $c test successful" >> $LOGFILE
486              p_CC="$p_CC $c"              p_CC="$p_CC $c"
487          fi          fi
488      done      done
# Line 353  Error: No C compilers were found in your Line 498  Error: No C compilers were found in your
498  EOF  EOF
499          exit 1          exit 1
500      else      else
501          echo "  The possible C compilers found in your path are:"          echo "  The possible C compilers found in your path are: $p_CC" | tee -a $LOGFILE
         echo "   "$p_CC  
502          if test "x$CC" = x ; then          if test "x$CC" = x ; then
503              CC=`echo $p_CC | $AWK '{print $1}'`              CC=`echo $p_CC | $AWK '{print $1}'`
504              echo "  Setting C compiler to: "$CC              echo "  Setting C compiler to: "$CC
505          fi          fi
506      fi      fi
507        echo " --> set CC='$CC'" >> $LOGFILE
508    }
509    
510    # Guess possible config options for this host
511    find_possible_optfile()  {
512    
513        echo >> $LOGFILE
514        echo "running: find_possible_optfile()" >> $LOGFILE
515        tmp1=`uname`"_"`uname -m`
516        tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
517        tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
518        tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`
519        tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
520        tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`
521        PLATFORM=$tmp3
522        echo $PLATFORM | grep cygwin > /dev/null 2>&1  &&  PLATFORM=cygwin_ia32
523        OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
524        echo "  The platform appears to be:  $PLATFORM" | tee -a $LOGFILE
525    
526      #================================================================      #================================================================
527      #  look for possible FORTRAN compilers      #  look for possible FORTRAN compilers
528      tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 gfortran g95"      echo "  look for possible FORTRAN compilers" >> $LOGFILE
529        tmp="$MITGCM_FC $FC efc gfortran g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 g95"
530      p_FC=      p_FC=
531      for c in $tmp ; do      rm -f ./genmake_hello.f
532          rm -f ./hello.f ./hello      cat >> genmake_hello.f <<EOF
         cat >> hello.f <<EOF  
533        program hello        program hello
534        do i=1,3        do i=1,3
535          print *, 'hello world : ', i          print *, 'hello world : ', i
536        enddo        enddo
537        end        end
538  EOF  EOF
539          $c -o hello hello.f > /dev/null 2>&1      for f in $tmp ; do
540            COMM="$f -o genmake_hello genmake_hello.f"
541            echo $COMM >> $LOGFILE
542            $COMM >> $LOGFILE 2>&1
543          RETVAL=$?          RETVAL=$?
544          if test "x${RETVAL}" = x0 ; then          if test "x${RETVAL}" = x0 ; then
545              p_FC="$p_FC $c"              echo " $f test successful" >> $LOGFILE
546                p_FC="$p_FC $f"
547          fi          fi
548      done      done
549      rm -f ./hello.f ./hello      rm -f ./genmake_hello.f ./genmake_hello
550      if test "x${p_FC}" = x ; then      if test "x${p_FC}" = x ; then
551          cat 1>&2 <<EOF          cat 1>&2 <<EOF
552    
# Line 393  Error: No Fortran compilers were found i Line 559  Error: No Fortran compilers were found i
559  EOF  EOF
560          exit 1          exit 1
561      else      else
562          echo "  The possible FORTRAN compilers found in your path are:"          echo "  The possible FORTRAN compilers found in your path are: $p_FC" | tee -a $LOGFILE
         echo "   "$p_FC  
563      fi      fi
564    
565      #  Use the first of the compilers found in the current PATH      #  Use the first of the compilers found in the current PATH
# Line 403  EOF Line 568  EOF
568          for i in $p_FC ; do          for i in $p_FC ; do
569              OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i              OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i
570              if test -r $OPTFILE ; then              if test -r $OPTFILE ; then
571                  echo "  Setting OPTFILE to: "$OPTFILE                  echo "  Setting OPTFILE to: "$OPTFILE | tee -a $LOGFILE
572                  break                  break
573              fi              fi
574          done          done
# Line 412  EOF Line 577  EOF
577      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
578          OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$FC          OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$FC
579          if test ! -r $OPTFILE ; then          if test ! -r $OPTFILE ; then
580               echo "  I looked for the file "$OPTFILE" but did not find it"               echo "  I looked for the file "$OPTFILE" but did not find it"
581          fi          fi
582      fi      fi
583  #    echo "  The options file:  $p_OF"  
 #    echo "    appears to match so we'll use it."  
 #   for i in $p_FC ; do  
 #p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i  
 #if test -r $p_OF ; then  
 #    OPTFILE=$p_OF  
 #    echo "  The options file:  $p_OF"  
 #    echo "    appears to match so we'll use it."  
 #    break  
 #fi  
 #   done  
584      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
585          cat 1>&2 <<EOF          cat 1>&2 <<EOF
586    
# Line 470  EOF Line 625  EOF
625  #       fi  #       fi
626  #       rm -f test.f out  #       rm -f test.f out
627  #     fi  #     fi
   
628  }  }
629    
630  #  Parse the package dependency information  #  Parse the package dependency information
# Line 488  get_pdepend_list()  { Line 642  get_pdepend_list()  {
642      fi      fi
643      . ./.pd_tmp      . ./.pd_tmp
644      rm -f ./.pd_tmp      rm -f ./.pd_tmp
   
 }  
   
   
 #  Explain usage  
 usage()  {  
 cat <<EOF  
   
 Usage: "$0" [OPTIONS]  
   where [OPTIONS] can be:  
   
     -help | --help | -h | --h  
           Print this help message and exit.  
   
     -adoptfile NAME | --adoptfile NAME | -adof NAME | --adof NAME  
       -adoptfile=NAME | --adoptfile=NAME | -adof=NAME | --adof=NAME  
           Use "NAME" as the adoptfile.  By default, the file at  
           "tools/adjoint_options/adjoint_default" will be used.  
   
     -nooptfile | --nooptfile  
       -optfile NAME | --optfile NAME | -of NAME | --of NAME  
       -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME  
           Use "NAME" as the optfile.  By default, an attempt will be  
           made to find an appropriate "standard" optfile in the  
           tools/build_options/ directory.  
   
     -pdepend NAME | --pdepend NAME  
       -pdepend=NAME | --pdepend=NAME  
           Get package dependency information from "NAME".  
   
     -pgroups NAME | --pgroups NAME  
       -pgroups=NAME | --pgroups=NAME  
           Get the package groups information from "NAME".  
   
     -bash NAME  
           Explicitly specify the Bourne or BASH shell to use  
   
     -make NAME | -m NAME  
       --make=NAME | -m=NAME  
           Use "NAME" for the MAKE program. The default is "make" but  
           many platforms, "gmake" is the preferred choice.  
   
     -makefile NAME | -mf NAME  
       --makefile=NAME | -mf=NAME  
           Call the makefile "NAME".  The default is "Makefile".  
   
     -makedepend NAME | -md NAME  
       --makedepend=NAME | -md=NAME  
           Use "NAME" for the MAKEDEPEND program.  
   
     -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME  
       -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME  
           Specify the location of the MITgcm ROOTDIR as "NAME".  
           By default, genamke will try to find the location by  
           looking in parent directories (up to the 5th parent).  
   
     -mods NAME | --mods NAME | -mo NAME | --mo NAME  
       -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME  
           Here, "NAME" specifies a list of directories that are  
           used for additional source code.  Files found in the  
           "mods list" are given preference over files of the same  
           name found elsewhere.  
   
     -disable NAME | --disable NAME  
       -disable=NAME | --disable=NAME  
           Here "NAME" specifies a list of packages that we don't  
           want to use.  If this violates package dependencies,  
           genamke will exit with an error message.  
   
     -enable NAME | --enable NAME  
       -enable=NAME | --enable=NAME  
           Here "NAME" specifies a list of packages that we wish  
           to specifically enable.  If this violates package  
           dependencies, genamke will exit with an error message.  
   
     -standarddirs NAME | --standarddirs NAME  
       -standarddirs=NAME | --standarddirs=NAME  
           Here, "NAME" specifies a list of directories to be  
           used as the "standard" code.  
   
     -fortran NAME | --fortran NAME | -fc NAME | --fc NAME  
       -fc=NAME | --fc=NAME  
           Use "NAME" as the fortran compiler.  By default, genmake  
           will search for a working compiler by trying a list of  
           "usual suspects" such as g77, f77, etc.  
   
     -cc NAME | --cc NAME | -cc=NAME | --cc=NAME  
           Use "NAME" as the C compiler.  By default, genmake  
           will search for a working compiler by trying a list of  
           "usual suspects" such as gcc, c89, cc, etc.  
   
     -[no]ieee | --[no]ieee  
           Do or don't use IEEE numerics.  Note that this option  
           *only* works if it is supported by the OPTFILE that  
           is being used.  
   
     -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4  
           Use "real*4" type for _RS variable (#undef REAL4_IS_SLOW)  
           *only* works if CPP_EEOPTIONS.h allows this.  
   
     -ignoretime | -ignore_time | --ignoretime | --ignore_time  
           Ignore all the "wall clock" routines entirely.  This will  
           not in any way hurt the model results -- it simply means  
           that the code that checks how long the model spends in  
           various routines will give junk values.  
   
     -ts | --ts  
           Produce timing information per timestep  
     -papis | --papis  
           Produce summary MFlop/s (and IPC) with PAPI per timestep  
     -pcls | --pcls  
           Produce summary MFlop/s etc. with PCL per timestep  
     -foolad | --foolad  
           Fool the AD code generator  
     -papi | --papi  
           Performance analysis with PAPI  
     -pcl | --pcl  
           Performance analysis with PCL  
     -hpmt | --hpmt  
           Performance analysis with the HPM Toolkit  
   
     -gsl | --gsl  
           Use GSL to control floating point rounding and precision  
     -devel | --devel  
           Add additional warning and debugging flags for development  
   
     -mpi | --mpi  
           Include MPI header files and link to MPI libraries  
     -mpi=PATH | --mpi=PATH  
           Include MPI header files and link to MPI libraries using MPI_ROOT  
           set to PATH. i.e. Include files from \$PATH/include, link to libraries  
           from \$PATH/lib and use binaries from \$PATH/bin.  
   
     -omp | --omp  
           Activate OpenMP code + use Compiler option OMPFLAG  
     -omp=OMPFLAG | --omp=OMPFLAG  
           Activate OpenMP code + use Compiler option OMPFLAG  
   
     -es | --es | -embed-source | --embed-source  
           Embed a tarball containing the full source code  
           (including the Makefile, etc.) used to build the  
           executable [off by default]  
   
   While it is most often a single word, the "NAME" variables specified  
   above can in many cases be a space-delimited string such as:  
   
     --enable pkg1   --enable 'pkg1 pkg2'   --enable 'pkg1 pkg2 pkg3'  
     -mods=dir1   -mods='dir1'   -mods='dir1 dir2 dir3'  
     -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'  
   
   which, depending upon your shell, may need to be single-quoted.  
   
   For more detailed genmake documentation, please see:  
   
     http://mitgcm.org/public/devel_HOWTO/  
   
 EOF  
   
     exit 1  
645  }  }
646    
647  #  Build a CPP macro to automate calling C routines from FORTRAN  #  Build a CPP macro to automate calling C routines from FORTRAN
# Line 654  get_fortran_c_namemangling()  { Line 649  get_fortran_c_namemangling()  {
649    
650      #echo "FC_NAMEMANGLE = \"$FC_NAMEMANGLE\""      #echo "FC_NAMEMANGLE = \"$FC_NAMEMANGLE\""
651      if test ! "x$FC_NAMEMANGLE" = x ; then      if test ! "x$FC_NAMEMANGLE" = x ; then
652          return 0          return 0
653      fi      fi
654      echo "running: get_fortran_c_namemangling()" >> $LOGFILE      echo " running: get_fortran_c_namemangling()" >> $LOGFILE
655    
656      default_nm="#define FC_NAMEMANGLE(X) X ## _"      default_nm="#define FC_NAMEMANGLE(X) X ## _"
657    
658      cat > genmake_test.c <<EOF      cat > genmake_test.c <<EOF
659  void tcall( char * string ) { tsub( string ); }  void tcall( char * string ) { tsub( string ); }
660  EOF  EOF
661      $MAKE genmake_test.o >> $LOGFILE 2>&1      COMM="$CC $CFLAGS -c genmake_test.c"
662        echo ' '$COMM >> $LOGFILE
663        $COMM >> $LOGFILE 2>&1
664      RETVAL=$?      RETVAL=$?
665      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
666          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
667          cat <<EOF>> $LOGFILE          cat <<EOF>> $LOGFILE
668    
669  WARNING: C test compile fails   WARNING: C test compile fails
670  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
671  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
672  EOF  EOF
673          return 1          return 1
674      fi      fi
# Line 681  EOF Line 678  EOF
678          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
679          cat <<EOF>> $LOGFILE          cat <<EOF>> $LOGFILE
680    
681  WARNING: The "nm" command failed.   WARNING: The "nm" command failed.
682  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
683  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
684  EOF  EOF
685          return 1          return 1
686      fi      fi
# Line 693  EOF Line 690  EOF
690        call tsub( string )        call tsub( string )
691        end        end
692  EOF  EOF
693      $FC $FFLAGS -c genmake_tcomp.$FS >> $LOGFILE 2>&1      COMM="$FC $FFLAGS -c genmake_tcomp.$FS"
694        echo ' '$COMM >> $LOGFILE
695        $COMM >> $LOGFILE 2>&1
696      RETVAL=$?      RETVAL=$?
697      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
698          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
699          cat <<EOF>> $LOGFILE          cat <<EOF>> $LOGFILE
700    
701  WARNING: FORTRAN test compile fails -- please see '$LOGFILE'   WARNING: FORTRAN test compile fails -- please see '$LOGFILE'
702  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
703  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
704  EOF  EOF
705          return 1          return 1
706      fi      fi
# Line 711  EOF Line 710  EOF
710          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
711          cat <<EOF>> $LOGFILE          cat <<EOF>> $LOGFILE
712    
713  WARNING: The "nm" command failed.   WARNING: The "nm" command failed.
714  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
715  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
716  EOF  EOF
717          return 1          return 1
718      fi      fi
# Line 739  EOF Line 738  EOF
738    
739      #  cleanup the testing files      #  cleanup the testing files
740      rm -f genmake_tcomp.* genmake_test.*      rm -f genmake_tcomp.* genmake_test.*
 }  
741    
742        echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE
743    }
744    
745  check_HAVE_CLOC()  {  check_HAVE_CLOC()  {
746      echo >> $LOGFILE      echo >> $LOGFILE
# Line 781  EOF Line 781  EOF
781      RETVAL=$?      RETVAL=$?
782      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
783          HAVE_CLOC=t          HAVE_CLOC=t
         DEFINES="$DEFINES -DHAVE_CLOC"  
784      fi      fi
785      rm -f genmake_tc*      rm -f genmake_tc*
786        echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE
787  }  }
788    
   
789  check_HAVE_SIGREG()  {  check_HAVE_SIGREG()  {
790      if test ! "x$HAVE_SIGREG" = x ; then      if test ! "x$HAVE_SIGREG" = x ; then
791          return          return
# Line 843  EOF Line 842  EOF
842      RETVAL=$?      RETVAL=$?
843      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
844          HAVE_SIGREG=t          HAVE_SIGREG=t
         DEFINES="$DEFINES -DHAVE_SIGREG"  
845      fi      fi
846      rm -f genmake_tc*      rm -f genmake_tc*
847        echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE
848  }  }
849    
   
850  check_HAVE_SETRLSTK()  {  check_HAVE_SETRLSTK()  {
     if test "x$HAVE_SETRLSTK" = xt ; then  
         DEFINES="$DEFINES -DHAVE_SETRLSTK"  
         return  
     fi    
851      if test ! "x$HAVE_SETRLSTK" = x ; then      if test ! "x$HAVE_SETRLSTK" = x ; then
852          return          return
853      fi      fi
# Line 891  EOF Line 885  EOF
885      RETVAL=$?      RETVAL=$?
886      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
887          HAVE_SETRLSTK=t          HAVE_SETRLSTK=t
         DEFINES="$DEFINES -DHAVE_SETRLSTK"  
888      fi      fi
889      rm -f genmake_tc*      rm -f genmake_tc*
890        echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE
891  }  }
892    
   
893  check_HAVE_STAT()  {  check_HAVE_STAT()  {
894      echo >> $LOGFILE      echo >> $LOGFILE
895      echo "running: check_HAVE_STAT()" >> $LOGFILE      echo "running: check_HAVE_STAT()" >> $LOGFILE
# Line 938  EOF Line 931  EOF
931      RETVAL=$?      RETVAL=$?
932      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
933          HAVE_STAT=t          HAVE_STAT=t
         DEFINES="$DEFINES -DHAVE_STAT"  
934      fi      fi
935      rm -f genmake_tc*      rm -f genmake_tc*
936        echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE
937  }  }
938    
   
939  check_netcdf_libs()  {  check_netcdf_libs()  {
940      if test ! "x$SKIP_NETCDF_CHECK" = x ; then      if test ! "x$SKIP_NETCDF_CHECK" = x ; then
941          return          return
# Line 1033  EOF Line 1025  EOF
1025          fi          fi
1026      fi      fi
1027      rm -f genmake_tnc*      rm -f genmake_tnc*
1028        echo " --> set HAVE_NETCDF='$HAVE_NETCDF'" >> $LOGFILE
1029  }  }
1030    
1031    check_lapack_libs()  {
1032        if test ! "x$SKIP_LAPACK_CHECK" = x ; then
1033            return
1034        fi
1035        echo >> $LOGFILE
1036        echo "running: check_lapack_libs()" >> $LOGFILE
1037        cat <<EOF > genmake_tla.F
1038          program fgenla
1039          integer info
1040          integer ipiv( 2 )
1041          double precision ab( 4, 2 ), b( 2 )
1042          data ab / 0., 0., 1., 2., 0., 2., 1., 0. /
1043          data b / 1., 1. /
1044          call dgbsv( 2, 1, 1, 1, ab, 4, ipiv, b, 2, info )
1045          IF (info .NE. 0) write(*,*) 'Error:', info
1046          write(*,*) b
1047          end
1048    EOF
1049        echo "===  genmake_tla.F  >>>" > genmake_tla.log
1050        cat genmake_tla.F >> genmake_tla.log
1051        echo "<<<  genmake_tla.F  ===" >> genmake_tla.log
1052        RET_CPP=f
1053        COMM="cat genmake_tla.F | $CPP $DEFINES $INCLUDES"
1054        echo "$COMM" >> genmake_tla.log
1055        eval $COMM > genmake_tla.$FS 2>/dev/null  &&  RET_CPP=t
1056        if test "x$RET_CPP" = xf ; then
1057            echo "  WARNING: CPP failed to pre-process the lapack test." \
1058                >> genmake_tla.log
1059            echo "    Please check that \$INCLUDES is properly set." \
1060                >> genmake_tla.log
1061        fi
1062        echo "$FC $FFLAGS $FOPTIM -c genmake_tla.$FS  \ " >> genmake_tla.log
1063        echo "  &&  $LINK $FFLAGS $FOPTIM -o genmake_tla.o $LIBS" >> genmake_tla.log
1064        $FC $FFLAGS $FOPTIM -c genmake_tla.$FS >> genmake_tla.log 2>&1  \
1065            &&  $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS >> genmake_tla.log 2>&1
1066        RET_COMPILE=$?
1067        cat genmake_tla.log >> $LOGFILE
1068    
1069        # test program execution not always possible (see check_netcdf_libs)
1070        #
1071        #test -x ./genmake_tla  &&  ./genmake_tla >> genmake_tla.log 2>&1
1072        #RETVAL=$?
1073        #if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
1074    
1075        if test "x$RET_COMPILE" = x0 ; then
1076            HAVE_LAPACK=t
1077            echo "check_lapack: successful" >> $LOGFILE
1078        else
1079            # try again with "-llapack" added to the libs
1080            echo "==> try again with added '-llapack'" > genmake_tla.log
1081            echo "cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS \ " >> genmake_tla.log
1082            echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tla.$FS \ " >> genmake_tla.log
1083            echo " &&  $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack" >> genmake_tla.log
1084            cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS 2>/dev/null  \
1085                &&  $FC $FFLAGS $FOPTIM -c genmake_tla.$FS >> genmake_tla.log 2>&1  \
1086                &&  $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack >> genmake_tla.log 2>&1
1087            RET_COMPILE=$?
1088            echo >> $LOGFILE
1089            cat genmake_tla.log >> $LOGFILE
1090            if test "x$RET_COMPILE" = x0 ; then
1091                LIBS="$LIBS -llapack"
1092                HAVE_LAPACK=t
1093                echo "check_lapack: successful" >> $LOGFILE
1094            else
1095            # try again with "-lf77blas -lcblas" added to the libs
1096                echo "==> try again with added '-llapack -lf77blas -lcblas'" > genmake_tla.log
1097                echo "cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS \ " >> genmake_tla.log
1098                echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tla.$FS \ " >> genmake_tla.log
1099                echo " &&  $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack -lf77blas -lcblas" >> genmake_tla.log
1100                cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS 2>/dev/null  \
1101                    &&  $FC $FFLAGS $FOPTIM -c genmake_tla.$FS >> genmake_tla.log 2>&1  \
1102                    &&  $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack -lf77blas -lcblas >> genmake_tla.log 2>&1
1103                RET_COMPILE=$?
1104                echo >> $LOGFILE
1105                cat genmake_tla.log >> $LOGFILE
1106                if test "x$RET_COMPILE" = x0 ; then
1107                    LIBS="$LIBS -llapack -lf77blas -lcblas"
1108                    HAVE_LAPACK=t
1109                    echo "check_lapack: successful" >> $LOGFILE
1110                else
1111                # try again with "-latlas" added to the libs
1112                    echo "==> try again with added '-llapack -lf77blas -lcblas -latlas'" > genmake_tla.log
1113                    echo "cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS \ " >> genmake_tla.log
1114                    echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tla.$FS \ " >> genmake_tla.log
1115                    echo " &&  $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack -lf77blas -lcblas -latlas" >> genmake_tla.log
1116                    cat genmake_tla.F | $CPP $DEFINES $INCLUDES > genmake_tla.$FS 2>/dev/null  \
1117                        &&  $FC $FFLAGS $FOPTIM -c genmake_tla.$FS >> genmake_tla.log 2>&1  \
1118                        &&  $LINK $FFLAGS $FOPTIM -o genmake_tla genmake_tla.o $LIBS -llapack -lf77blas -lcblas -latlas >> genmake_tla.log 2>&1
1119                    RET_COMPILE=$?
1120                    echo >> $LOGFILE
1121                    cat genmake_tla.log >> $LOGFILE
1122                    if test "x$RET_COMPILE" = x0 ; then
1123                        LIBS="$LIBS -llapack -lf77blas -lcblas -latlas"
1124                        HAVE_LAPACK=t
1125                        echo "check_lapack: successful" >> $LOGFILE
1126                    fi
1127                fi
1128            fi
1129        fi
1130        rm -f genmake_tla*
1131        echo " --> set HAVE_LAPACK='$HAVE_LAPACK'" >> $LOGFILE
1132    }
1133    
1134    
1135  ###############################################################################  ###############################################################################
# Line 1068  FOPTIM= Line 1163  FOPTIM=
1163  FEXTRAFLAGS=  FEXTRAFLAGS=
1164  USE_EXTENDED_SRC=  USE_EXTENDED_SRC=
1165  EXTENDED_SRC_FLAG=  EXTENDED_SRC_FLAG=
1166    GET_FC_VERSION=
1167  CFLAGS=  CFLAGS=
1168  KFLAGS1=  KFLAGS1=
1169  KFLAGS2=  KFLAGS2=
# Line 1102  HAVE_STAT= Line 1198  HAVE_STAT=
1198  HAVE_NETCDF=  HAVE_NETCDF=
1199  HAVE_ETIME=  HAVE_ETIME=
1200  IGNORE_TIME=  IGNORE_TIME=
1201    HAVE_LAPACK=
1202    
1203  MODS=  MODS=
1204  TOOLSDIR=  TOOLSDIR=
# Line 1109  SOURCEDIRS= Line 1206  SOURCEDIRS=
1206  INCLUDEDIRS=  INCLUDEDIRS=
1207  STANDARDDIRS="USE_THE_DEFAULT"  STANDARDDIRS="USE_THE_DEFAULT"
1208    
1209    #- local config file
1210    gm_local="genmake_local"
1211    
1212  G2ARGS=  G2ARGS=
1213  BASH=  BASH=
1214  PWD=`pwd`  PWD=`pwd`
# Line 1124  MACHINE=`uname -a` Line 1224  MACHINE=`uname -a`
1224  EXECUTABLE=  EXECUTABLE=
1225  EXEHOOK=  EXEHOOK=
1226  EXEDIR=  EXEDIR=
 PACKAGES_CONF=  
1227  IEEE=  IEEE=
1228  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
1229      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
# Line 1146  SVD_TAMC_FLAGS= Line 1245  SVD_TAMC_FLAGS=
1245  TAMC_EXTRA=  TAMC_EXTRA=
1246    
1247  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1248  gm_s1="OPTFILE PKG_DEPEND PKG_GROUPS MAKEFILE MAKEDEPEND PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PKG_DEPEND PKG_GROUPS DISABLE ENABLE MAKEFILE MAKEDEPEND PLATFORM"
1249  gm_s2="FC IEEE USE_R4 TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS"  gm_s2="FC CC MPI OMP USE_R4 TS PAPIS PCLS PAPI PCL HPMT IEEE DEVEL GSL FEXTRAFLAGS"
1250    gm_s3="ROOTDIR STANDARDDIRS MODS DUMPSTATE"
1251    
1252  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1253  gm_s3="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM FEXTRAFLAGS"  gm_s4="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM"
1254  gm_s4="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s5="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"
1255  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD THISHOST THISUSER THISDATE THISVER MACHINE"  gm_s6="TOOLSDIR SOURCEDIRS INCLUDEDIRS EXEDIR EXECUTABLE EXEHOOK"
1256  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s7="PWD THISHOST THISUSER THISDATE THISVER MACHINE"
1257  gm_s7="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME"  gm_s8="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME HAVE_LAPACK"
1258    
1259  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1260  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"
1261  gm_s11="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS"  gm_s11="FTL_TAMC_FLAGS FTL_TAF_FLAGS SVD_TAMC_FLAGS SVD_TAF_FLAGS"
1262  gm_s12="TAF_EXTRA TAMC_EXTRA"  gm_s12="TAF_EXTRA TAMC_EXTRA"
1263    
1264  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 $gm_s8"
1265  gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"  gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"
1266    
1267  cat <<EOF  cat <<EOF
# Line 1180  LOGFILE="genmake.log" Line 1280  LOGFILE="genmake.log"
1280  rm -f genmake_state genmake_*optfile $LOGFILE  rm -f genmake_state genmake_*optfile $LOGFILE
1281    
1282  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
 gm_local="genmake_local"  
 printf "  getting local config information:  "  
 if test -f $gm_local ; then  
     echo "using $gm_local"  
     . $gm_local  
     # echo "DISABLE=$DISABLE"  
     # echo "ENABLE=$ENABLE"  
 else  
     echo "none found"  
 fi  
1283    
1284  #echo "$0::$1:$2:$3:$4:$5:$6:$7:"  #echo "$0::$1:$2:$3:$4:$5:$6:$7:"
1285  #parse_options  #parse_options
# Line 1208  for ac_option in "$@" ; do Line 1298  for ac_option in "$@" ; do
1298      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
1299    
1300      case $ac_option in      case $ac_option in
1301            
1302          -help | --help | -h | --h)          -help | --help | -h | --h)
1303              usage ;;              usage ;;
1304            
1305          -nooptfile | --nooptfile)          -nooptfile | --nooptfile)
1306              OPTFILE="NONE" ;;              OPTFILE="NONE" ;;
1307          -optfile | --optfile | -of | --of)          -optfile | --optfile | -of | --of)
1308              ac_prev=OPTFILE ;;              ac_prev=OPTFILE ;;
1309          -optfile=* | --optfile=* | -of=* | --of=*)          -optfile=* | --optfile=* | -of=* | --of=*)
1310              OPTFILE=$ac_optarg ;;              OPTFILE=$ac_optarg ;;
1311            
1312          -adoptfile | --adoptfile | -adof | --adof)          -adoptfile | --adoptfile | -adof | --adof)
1313              ac_prev=AD_OPTFILE ;;              ac_prev=AD_OPTFILE ;;
1314          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)          -adoptfile=* | --adoptfile=* | -adof=* | --adof=*)
1315              AD_OPTFILE=$ac_optarg ;;              AD_OPTFILE=$ac_optarg ;;
1316            
1317          -pdepend | --pdepend)          -pdepend | --pdepend)
1318              ac_prev=PKG_DEPEND ;;              ac_prev=PKG_DEPEND ;;
1319          -pdepend=* | --pdepend=*)          -pdepend=* | --pdepend=*)
1320              PKG_DEPEND=$ac_optarg ;;              PKG_DEPEND=$ac_optarg ;;
1321            
1322          -pgroups | --pgroups)          -pgroups | --pgroups)
1323              ac_prev=PKG_GROUPS ;;              ac_prev=PKG_GROUPS ;;
1324          -pgroups=* | --pgroups=*)          -pgroups=* | --pgroups=*)
1325              PKG_GROUPS=$ac_optarg ;;              PKG_GROUPS=$ac_optarg ;;
1326            
1327          -make | --make | -m | --m)          -make | --make | -m | --m)
1328              ac_prev=MAKE ;;              ac_prev=MAKE ;;
1329          -make=* | --make=* | -m=* | --m=*)          -make=* | --make=* | -m=* | --m=*)
1330              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
1331            
1332          -bash | --bash)          -bash | --bash)
1333              ac_prev=BASH ;;              ac_prev=BASH ;;
1334          -bash=* | --bash=*)          -bash=* | --bash=*)
1335              BASH=$ac_optarg ;;              BASH=$ac_optarg ;;
1336            
1337          -makedepend | --makedepend | -md | --md)          -makedepend | --makedepend | -md | --md)
1338              ac_prev=MAKEDEPEND ;;              ac_prev=MAKEDEPEND ;;
1339          -makedepend=* | --makedepend=* | -md=* | --md=*)          -makedepend=* | --makedepend=* | -md=* | --md=*)
1340              MAKEDEPEND=$ac_optarg ;;              MAKEDEPEND=$ac_optarg ;;
1341            
1342          -makefile | --makefile | -ma | --ma)          -makefile | --makefile | -mf | --mf)
1343              ac_prev=MAKEFILE ;;              ac_prev=MAKEFILE ;;
1344          -makefile=* | --makefile=* | -ma=* | --ma=*)          -makefile=* | --makefile=* | -mf=* | --mf=*)
1345              MAKEFILE=$ac_optarg ;;              MAKEFILE=$ac_optarg ;;
1346            
1347          -platform | --platform | -pl | --pl | -platform=* | --platform=* | -pl=* | --pl=*)          -platform | --platform | -pl | --pl | -platform=* | --platform=* | -pl=* | --pl=*)
1348              echo "ERROR: The platform option has been removed.  Please specify"              echo "ERROR: The platform option has been removed.  Please specify"
1349              echo "  the build options using the \"optfile\" mechanism."              echo "  the build options using the \"optfile\" mechanism."
1350              echo              echo
1351              usage              usage
1352              ;;              ;;
1353            
1354          -rootdir | --rootdir | -rd | --rd)          -rootdir | --rootdir | -rd | --rd)
1355              ac_prev=ROOTDIR ;;              ac_prev=ROOTDIR ;;
1356          -rootdir=* | --rootdir=* | -rd=* | --rd=*)          -rootdir=* | --rootdir=* | -rd=* | --rd=*)
1357              ROOTDIR=$ac_optarg ;;              ROOTDIR=$ac_optarg ;;
1358            
1359          -mods | --mods | -mo | --mo)          -mods | --mods | -mo | --mo)
1360              ac_prev=MODS ;;              ac_prev=MODS ;;
1361          -mods=* | --mods=* | -mo=* | --mo=*)          -mods=* | --mods=* | -mo=* | --mo=*)
1362              MODS=$ac_optarg ;;              MODS=$ac_optarg ;;
1363            
1364          -disable | --disable)          -disable | --disable)
1365              ac_prev=DISABLE ;;              ac_prev=DISABLE ;;
1366          -disable=* | --disable=*)          -disable=* | --disable=*)
1367              DISABLE=$ac_optarg ;;              DISABLE=$ac_optarg ;;
1368            
1369          -enable | --enable)          -enable | --enable)
1370              ac_prev=ENABLE ;;              ac_prev=ENABLE ;;
1371          -enable=* | --enable=*)          -enable=* | --enable=*)
1372              ENABLE=$ac_optarg ;;              ENABLE=$ac_optarg ;;
1373            
1374          -standarddirs | --standarddirs)          -standarddirs | --standarddirs)
1375              ac_prev=STANDARDDIRS ;;              ac_prev=STANDARDDIRS ;;
1376          -standarddirs=* | --standarddirs=*)          -standarddirs=* | --standarddirs=*)
# Line 1290  for ac_option in "$@" ; do Line 1380  for ac_option in "$@" ; do
1380  #               ac_prev=cpp ;;  #               ac_prev=cpp ;;
1381  #           -cpp=* | --cpp=*)  #           -cpp=* | --cpp=*)
1382  #               CPP=$ac_optarg ;;  #               CPP=$ac_optarg ;;
1383            
1384          -cc | --cc)          -cc | --cc)
1385              ac_prev=CC ;;              ac_prev=CC ;;
1386          -cc=* | --cc=*)          -cc=* | --cc=*)
1387              CC=$ac_optarg ;;              CC=$ac_optarg ;;
1388            
1389          -fortran | --fortran | -fc | --fc)          -fortran | --fortran | -fc | --fc)
1390              ac_prev=FC ;;              ac_prev=FC ;;
1391          -fc=* | --fc=*)          -fc=* | --fc=*)
1392              FC=$ac_optarg ;;              FC=$ac_optarg ;;
1393            
1394          -fs | --fs)          -fs | --fs)
1395              ac_prev=FS ;;              ac_prev=FS ;;
1396          -fs=* | --fs=*)          -fs=* | --fs=*)
1397              FS=$ac_optarg ;;              FS=$ac_optarg ;;
1398            
1399          -fs90 | --fs90)          -fs90 | --fs90)
1400              ac_prev=FS90 ;;              ac_prev=FS90 ;;
1401          -fs90=* | --fs90=*)          -fs90=* | --fs90=*)
1402              FS90=$ac_optarg ;;              FS90=$ac_optarg ;;
           
         -ieee | --ieee)  
             IEEE=true ;;  
         -noieee | --noieee)  
             IEEE= ;;  
1403    
1404          -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 )          -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 )
1405              USE_R4=true ;;              USE_R4=true ;;
1406    
1407            -ieee | --ieee)
1408                IEEE=true ;;
1409            -noieee | --noieee)
1410                echo "Warning: ignore option '$ac_option' (default is already without '-ieee')" ;;
1411            -devel | --devel)
1412                IEEE=true ; DEVEL=true ;;
1413            -gsl | --gsl)
1414                GSL=true ;;
1415    
1416          -ts | --ts)          -ts | --ts)
1417              TS=true ;;              TS=true ;;
1418          -papis | --papis)          -papis | --papis)
# Line 1334  for ac_option in "$@" ; do Line 1428  for ac_option in "$@" ; do
1428          -hpmt | --hpmt)          -hpmt | --hpmt)
1429              HPMT=true ;;              HPMT=true ;;
1430    
         -gsl | --gsl)  
             GSL=true ;;  
   
         -devel | --devel)  
             DEVEL=true ;;  
   
1431          -mpi | --mpi)          -mpi | --mpi)
1432              MPI=true ;;              MPI=true ;;
1433          -mpi=* | --mpi=*)          -mpi=* | --mpi=*)
1434              MPIPATH=$ac_optarg              MPIPATH=$ac_optarg
1435              MPI=true ;;              MPI=true ;;
1436            
1437          -omp | --omp)          -omp | --omp)
1438              OMP=true ;;              OMP=true ;;
1439          -omp=* | --omp=*)          -omp=* | --omp=*)
1440              OMPFLAG=$ac_optarg              OMPFLAG=$ac_optarg
1441              OMP=true ;;              OMP=true ;;
1442            
1443          -ds | --ds)          -ds | --ds)
1444              DUMPSTATE=t ;;              DUMPSTATE=t ;;
1445            
1446            -extra_flag | --extra_flag)
1447                ac_prev=FEXTRAFLAGS ;;
1448            -extra_flag=* | --extra_flag=*)
1449                FEXTRAFLAGS=$ac_optarg ;;
1450    
1451          -taf_extra | --taf_extra)          -taf_extra | --taf_extra)
1452              ac_prev=TAF_EXTRA ;;              ac_prev=TAF_EXTRA ;;
1453          -taf_extra=* | --taf_extra=*)          -taf_extra=* | --taf_extra=*)
# Line 1364  for ac_option in "$@" ; do Line 1457  for ac_option in "$@" ; do
1457              ac_prev=TAMC_EXTRA ;;              ac_prev=TAMC_EXTRA ;;
1458          -tamc_extra=* | --tamc_extra=*)          -tamc_extra=* | --tamc_extra=*)
1459              TAMC_EXTRA=$ac_optarg ;;              TAMC_EXTRA=$ac_optarg ;;
1460            
1461          -ignoretime | -ignore_time | --ignoretime | --ignore_time)          -ignoretime | -ignore_time | --ignoretime | --ignore_time)
1462              IGNORE_TIME="-DIGNORE_TIME" ;;              IGNORE_TIME="-DIGNORE_TIME" ;;
1463    
# Line 1375  for ac_option in "$@" ; do Line 1468  for ac_option in "$@" ; do
1468              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
1469              usage              usage
1470              ;;              ;;
1471            
1472          *)          *)
1473              echo "Error: unrecognized argument: "$ac_option              echo "Error: unrecognized argument: "$ac_option
1474              usage              usage
1475              ;;              ;;
1476            
1477      esac      esac
1478    
1479  done  done
1480    
1481    printf "  getting local config information:  "
1482    if test -f $gm_local ; then
1483        echo "using $gm_local"
1484        . $gm_local
1485    else
1486        echo "none found"
1487    fi
1488    
1489  if test -f ./.genmakerc ; then  if test -f ./.genmakerc ; then
1490      echo      echo
1491      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
1492      echo "  file.  This file format is no longer supported.  For directions on"      echo "  file.  This file format is no longer supported.  For directions on"
1493      echo "  how to setup and use the new \"genmake2\" script, please see:"      echo "  how to setup and use the new \"genmake2\" script, please see:"
1494      echo "    http://mitgcm.org/devel_HOWTO/"      echo "    http://mitgcm.org/public/devel_HOWTO/"
1495      echo "  and send an email to MITgcm-support@mitgcm.org if you need help."      echo "  and send an email to MITgcm-support@mitgcm.org if you need help."
1496      echo "WARNING: ignore \"./.genmakerc\" and continue."      echo "WARNING: ignore \"./.genmakerc\" and continue."
1497      echo      echo
# Line 1406  if test "x${ROOTDIR}" = x ; then Line 1506  if test "x${ROOTDIR}" = x ; then
1506          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do
1507              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
1508                  ROOTDIR=$d                  ROOTDIR=$d
1509                  printf "Warning:  ROOTDIR was not specified but there appears to be"                  printf "Warning: ROOTDIR was not specified ;"
1510                  echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it."                  echo " try using a local copy of MITgcm found at \"$ROOTDIR\""
1511                  break                  break
1512              fi              fi
1513          done          done
# Line 1439  if test "x$MAKEFILE" = x ; then Line 1539  if test "x$MAKEFILE" = x ; then
1539      MAKEFILE="Makefile"      MAKEFILE="Makefile"
1540  fi  fi
1541    
1542  echo "  getting OPTFILE information:  "  echo "  getting OPTFILE information:"
1543  if test "x${OPTFILE}" = x ; then  if test "x${OPTFILE}" = x ; then
1544      if test "x$MITGCM_OF" = x ; then      if test "x$MITGCM_OF" = x ; then
1545          echo "Warning: no OPTFILE specified so we'll look for possible settings"          echo "Warning: no OPTFILE specified so we'll look for possible settings"
1546          printf "\n===  Searching for possible settings for OPTFILE  ===\n"          printf "\n===  Searching for possible settings for OPTFILE  ===\n"
1547          find_possible_configs          find_possible_optfile
1548      else      else
1549          OPTFILE=$MITGCM_OF          OPTFILE=$MITGCM_OF
1550      fi      fi
# Line 1468  if test "x$OPTFILE" != xNONE ; then Line 1568  if test "x$OPTFILE" != xNONE ; then
1568      fi      fi
1569  fi  fi
1570    
1571  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:"
1572  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1573      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" = x ; then
1574          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default          AD_OPTFILE=$ROOTDIR/tools/adjoint_options/adjoint_default
# Line 1514  Error: no Fortran compiler: please speci Line 1614  Error: no Fortran compiler: please speci
1614  EOF  EOF
1615      exit 1      exit 1
1616  fi  fi
1617    if test "x$GET_FC_VERSION" != x ; then
1618      echo "Get compiler version using: $FC $GET_FC_VERSION" >> $LOGFILE
1619      ff=`echo $FC | sed 's/ .*//'` ; xx=`echo $ff | sed 's/^./& /' | sed 's/ .*//'`
1620      if test $xx != '/' ; then which $ff >> $LOGFILE ; fi
1621      $FC $GET_FC_VERSION > genmake_fc_vers1 2> genmake_fc_vers2
1622      if test -s genmake_fc_vers1 ; then
1623        cat genmake_fc_vers1 >> $LOGFILE
1624      else
1625        cat genmake_fc_vers2 >> $LOGFILE
1626      fi
1627      echo "<-- compiler version ----" >> $LOGFILE
1628      rm -f genmake_fc_vers1 genmake_fc_vers2
1629    fi
1630    
1631  if test "x$CC" = x ; then  if test "x$CC" = x ; then
1632      CC=cc      look_for_C_compilers
 #     cat <<EOF 1>&2  
 # Error: no C compiler: please specify using one of the following:  
 #   1) within the options file ("CC=...") as specified by "-of=OPTFILE"  
 #   2) the "-cc=XXX" command-line option  
 #   3) the "./genmake_local" file  
 # EOF  
 #     exit 1  
1633  fi  fi
1634    
1635  if test "x$LINK" = x ; then  if test "x$LINK" = x ; then
1636      LINK=$FC      LINK=$FC
1637  fi  fi
# Line 1531  if test "x$MAKE" = x ; then Line 1639  if test "x$MAKE" = x ; then
1639      MAKE="make"      MAKE="make"
1640  fi  fi
1641  if test "x$CPP" = x ; then  if test "x$CPP" = x ; then
1642      CPP=cpp      CPP="cpp -traditional -P"
1643  fi  fi
1644  #EH3 === UGLY ===  #EH3 === UGLY ===
1645  #  The following is an ugly little hack to check for $CPP in /lib/ and  #  The following is an ugly little hack to check for $CPP in /lib/ and
# Line 1558  EOF Line 1666  EOF
1666  else  else
1667      rm -f test_cpp      rm -f test_cpp
1668  fi  fi
1669    
1670  look_for_makedepend  look_for_makedepend
1671    
1672    #  Check that soft-link command is set and usable
1673  if test "x$LN" = x ; then  if test "x$LN" = x ; then
1674      LN="ln -s"      LN="ln -s"
1675  fi  fi
# Line 1568  RETVAL=$? Line 1679  RETVAL=$?
1679  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
1680      cat <<EOF 1>&2      cat <<EOF 1>&2
1681    
1682  Error: The command "ln -s" failed -- please specify a working soft-link  Error: The command "$LN" failed -- please specify a working soft-link
1683    command in the optfile.    command in the optfile.
1684    
1685  EOF  EOF
# Line 1603  fi Line 1714  fi
1714  if test ! "x$TS" = x ; then  if test ! "x$TS" = x ; then
1715        echo "  Turning on timing per timestep"        echo "  Turning on timing per timestep"
1716        if test ! "x$FOOLAD" = x ; then        if test ! "x$FOOLAD" = x ; then
1717              DEFINES="$DEFINES -DTIME_PER_TIMESTEP_SFP"              DEFINES="$DEFINES -DTIME_PER_TIMESTEP_SFP"
1718        else        else
1719              DEFINES="$DEFINES -DTIME_PER_TIMESTEP"              DEFINES="$DEFINES -DTIME_PER_TIMESTEP"
1720        fi        fi
# Line 1639  if test ! "x$PAPI" = x ; then Line 1750  if test ! "x$PAPI" = x ; then
1750            echo "  Sticking with PAPI flop summary per timestep!"            echo "  Sticking with PAPI flop summary per timestep!"
1751        else        else
1752            echo "  Turning on performance analysis with PAPI"            echo "  Turning on performance analysis with PAPI"
1753            echo "  Please make sure PAPIINC, PAPILIB are defined"            echo "  Please make sure PAPIINC, PAPILIB are defined"
1754            DEFINES="$DEFINES -DUSE_PAPI"            DEFINES="$DEFINES -DUSE_PAPI"
1755            INCLUDES="$INCLUDES $PAPIINC"            INCLUDES="$INCLUDES $PAPIINC"
1756            LIBS="$LIBS $PAPILIB"            LIBS="$LIBS $PAPILIB"
# Line 1651  if test ! "x$PCL" = x ; then Line 1762  if test ! "x$PCL" = x ; then
1762            echo "  Sticking with PCL flop summary per timestep!"            echo "  Sticking with PCL flop summary per timestep!"
1763        else        else
1764            echo "  Turning on performance analysis with PCL"            echo "  Turning on performance analysis with PCL"
1765            echo "  Please make sure PCLINC, PCLLIB are defined"            echo "  Please make sure PCLINC, PCLLIB are defined"
1766            DEFINES="$DEFINES -DUSE_PCL"            DEFINES="$DEFINES -DUSE_PCL"
1767            INCLUDES="$INCLUDES $PCLINC"            INCLUDES="$INCLUDES $PCLINC"
1768            LIBS="$LIBS $PCLLIB"            LIBS="$LIBS $PCLLIB"
# Line 1661  if test ! "x$HPMT" = x ; then Line 1772  if test ! "x$HPMT" = x ; then
1772        if test ! "x$PAPI" = x ; then        if test ! "x$PAPI" = x ; then
1773            echo "  PAPI and the HPM Toolkit cannot co-exist!"            echo "  PAPI and the HPM Toolkit cannot co-exist!"
1774            echo "  Sticking with PAPI!"            echo "  Sticking with PAPI!"
1775        else if test ! "x$PCL" = x ; then        else
1776            if test ! "x$PCL" = x ; then
1777            echo "  PCL and the HPM Toolkit cannot co-exist!"            echo "  PCL and the HPM Toolkit cannot co-exist!"
1778            echo "  Sticking with PCL!"            echo "  Sticking with PCL!"
1779        else          else
1780            echo "  Turning on performance analysis with the HPM Toolkit"            echo "  Turning on performance analysis with the HPM Toolkit"
1781            echo "  Please make sure HPMTINC, HPMTLIB are defined"            echo "  Please make sure HPMTINC, HPMTLIB are defined"
1782            DEFINES="$DEFINES -DUSE_LIBHPM"            DEFINES="$DEFINES -DUSE_LIBHPM"
1783            INCLUDES="$INCLUDES $HPMTINC"            INCLUDES="$INCLUDES $HPMTINC"
1784            LIBS="$LIBS $HPMTLIB"            LIBS="$LIBS $HPMTLIB"
1785        fi          fi
1786        fi        fi
1787  fi  fi
1788  if test ! "x$GSL" = x ; then  if test ! "x$GSL" = x ; then
# Line 1751  rm -f genmake_tcomp* Line 1863  rm -f genmake_tcomp*
1863  printf "  Can we call simple C routines (here, \"cloc()\") using $FC...  "  printf "  Can we call simple C routines (here, \"cloc()\") using $FC...  "
1864  check_HAVE_CLOC  check_HAVE_CLOC
1865  if test "x$HAVE_CLOC" != x ; then  if test "x$HAVE_CLOC" != x ; then
1866        DEFINES="$DEFINES -DHAVE_CLOC"
1867      echo "yes"      echo "yes"
1868  else  else
1869      echo "no"      echo "no"
# Line 1765  rm -f genmake_t* Line 1878  rm -f genmake_t*
1878  printf "  Can we unlimit the stack size using $FC...  "  printf "  Can we unlimit the stack size using $FC...  "
1879  check_HAVE_SETRLSTK  check_HAVE_SETRLSTK
1880  if test "x$HAVE_SETRLSTK" = xt ; then  if test "x$HAVE_SETRLSTK" = xt ; then
1881        DEFINES="$DEFINES -DHAVE_SETRLSTK"
1882      echo "yes"      echo "yes"
1883  else  else
1884      echo "no"      echo "no"
# Line 1774  rm -f genmake_t* Line 1888  rm -f genmake_t*
1888  printf "  Can we register a signal handler using $FC...  "  printf "  Can we register a signal handler using $FC...  "
1889  check_HAVE_SIGREG  check_HAVE_SIGREG
1890  if test "x$HAVE_SIGREG" = xt ; then  if test "x$HAVE_SIGREG" = xt ; then
1891        DEFINES="$DEFINES -DHAVE_SIGREG"
1892      echo "yes"      echo "yes"
1893  else  else
1894      echo "no"      echo "no"
# Line 1783  rm -f genmake_t* Line 1898  rm -f genmake_t*
1898  printf "  Can we use stat() through C calls...  "  printf "  Can we use stat() through C calls...  "
1899  check_HAVE_STAT  check_HAVE_STAT
1900  if test "x$HAVE_STAT" != x ; then  if test "x$HAVE_STAT" != x ; then
1901        DEFINES="$DEFINES -DHAVE_STAT"
1902      echo "yes"      echo "yes"
1903  else  else
1904      echo "no"      echo "no"
# Line 1792  rm -f genmake_t* Line 1908  rm -f genmake_t*
1908  printf "  Can we create NetCDF-enabled binaries...  "  printf "  Can we create NetCDF-enabled binaries...  "
1909  check_netcdf_libs  check_netcdf_libs
1910  if test "x$HAVE_NETCDF" != x ; then  if test "x$HAVE_NETCDF" != x ; then
1911        DEFINES="$DEFINES -DHAVE_NETCDF"
1912        echo "yes"
1913    else
1914        echo "no"
1915    fi
1916    
1917    printf "  Can we create LAPACK-enabled binaries...  "
1918    check_lapack_libs
1919    if test "x$HAVE_LAPACK" != x ; then
1920        DEFINES="$DEFINES -DHAVE_LAPACK"
1921      echo "yes"      echo "yes"
1922  else  else
1923      echo "no"      echo "no"
# Line 1803  if test "x$EMBED_SRC" = xt ; then Line 1929  if test "x$EMBED_SRC" = xt ; then
1929  fi  fi
1930  if test "x$EMBED_SRC" = xt ; then  if test "x$EMBED_SRC" = xt ; then
1931      ENABLE="$ENABLE embed_files"      ENABLE="$ENABLE embed_files"
1932    #   DEFINES="$DEFINES -DHAVE_EMBED_SRC"
1933  fi  fi
1934    
   
1935  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
1936  printf "  Adding MODS directories: "  printf "  Adding MODS directories: "
1937  for d in $MODS ; do  for d in $MODS ; do
# Line 1821  for d in $MODS ; do Line 1947  for d in $MODS ; do
1947  done  done
1948  echo  echo
1949    
1950  if test "x${PLATFORM}" = x ; then  #if test "x${PLATFORM}" = x ; then
1951      PLATFORM=$p_PLATFORM  #    PLATFORM=$p_PLATFORM
1952  fi  #fi
1953    
1954  if test "x${EXEDIR}" = x ; then  if test "x${EXEDIR}" = x ; then
1955      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`
# Line 1981  else Line 2107  else
2107          exit 1          exit 1
2108      else      else
2109          echo "    using PKG_LIST=\"$PKG_LIST\""          echo "    using PKG_LIST=\"$PKG_LIST\""
2110          #  Strip the comments and add all the names          #  Strip the comments and add all the names
2111          pkg_list=`cat $PKG_LIST | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`          pkg_list=`cat $PKG_LIST | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`
2112          RETVAL=$?          RETVAL=$?
2113          if test "x${RETVAL}" != x0 ; then          if test "x${RETVAL}" != x0 ; then
# Line 2031  for i in $PACKAGES ; do Line 2157  for i in $PACKAGES ; do
2157      j=`echo $i | sed 's/[-+]//'`      j=`echo $i | sed 's/[-+]//'`
2158      if test ! -d "$ROOTDIR/pkg/$j" ; then      if test ! -d "$ROOTDIR/pkg/$j" ; then
2159          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"
2160          exit 1          exit 1
2161      fi      fi
2162      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
2163  done  done
# Line 2076  else Line 2202  else
2202          echo "Error: problem encountered while building source files in pkg/mnc:"          echo "Error: problem encountered while building source files in pkg/mnc:"
2203          cat make_mnc.errors 1>&2          cat make_mnc.errors 1>&2
2204          if test "x$mnc_in" = x0 ; then          if test "x$mnc_in" = x0 ; then
2205              exit 1              exit 1
2206          else          else
2207              DISABLE="$DISABLE mnc"              DISABLE="$DISABLE mnc"
2208          fi          fi
# Line 2109  EOF Line 2235  EOF
2235      fi      fi
2236  fi  fi
2237    
2238    #  Check for package RADTRANS: if LAPACK is not available,
2239    #  then issue a warning that the direct radtrans solver is not available.
2240    if test "x$HAVE_LAPACK" != xt ; then
2241        echo " $PACKAGES " | grep ' radtrans ' > /dev/null 2>&1
2242        RETVAL=$?
2243        if test "x$RETVAL" = x0 ; then
2244            cat <<EOF
2245    *********************************************************************
2246    WARNING: the "radtrans" package was enabled but tests failed to
2247      compile LAPACK applications.  This means that the direct radtrans
2248      solver is not available and compilation will fail if it is enabled.
2249      If you want to use the direct solver, please check that:
2250    
2251      1) LAPACK is correctly installed for this compiler and
2252      2) the LIBS variable (within the "optfile") specifies the correct
2253         LAPACK library to link against.
2254    *********************************************************************
2255    EOF
2256        fi
2257    fi
2258    
2259  if  test "x${PKG_DEPEND}" != x ; then  if  test "x${PKG_DEPEND}" != x ; then
2260    echo "  applying package dependency rules"    echo "  applying package dependency rules"
2261    ck=    ck=
# Line 2154  if  test "x${PKG_DEPEND}" != x ; then Line 2301  if  test "x${PKG_DEPEND}" != x ; then
2301    
2302          #  Do we need to add $dname according to the dependency rules?          #  Do we need to add $dname according to the dependency rules?
2303          if test "x$pin" = xt -a "x$plus" = "x+" -a "x$din" = xf ; then          if test "x$pin" = xt -a "x$plus" = "x+" -a "x$din" = xf ; then
2304              #echo "   " $pname ": need to add :" $dname              #echo "   " $pname ": need to add :" $dname
2305              in_dis="f"              in_dis="f"
2306              for dis in $DISABLE ; do              for dis in $DISABLE ; do
2307                  if test "x$dis" = "x$dname" ; then                  if test "x$dis" = "x$dname" ; then
# Line 2179  if  test "x${PKG_DEPEND}" != x ; then Line 2326  if  test "x${PKG_DEPEND}" != x ; then
2326              echo "  the dependency rules for \"$dname\""              echo "  the dependency rules for \"$dname\""
2327              exit 1              exit 1
2328          fi          fi
2329          i=`echo "$i + 1" | bc -l`          i=`echo "$i + 1" | bc -l`
2330          #i=$(( $i + 1 ))          #i=$(( $i + 1 ))
2331      done      done
2332      ck=$ck"t"      ck=$ck"t"
# Line 2220  for n in $names ; do Line 2367  for n in $names ; do
2367          done          done
2368          if test "x$has_pack" = xf ; then          if test "x$has_pack" = xf ; then
2369              undef=`echo "ALLOW_$n" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`              undef=`echo "ALLOW_$n" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
2370              DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef"              DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef"
2371          fi          fi
2372      fi      fi
2373  done  done
# Line 2233  for i in $PACKAGES ; do Line 2380  for i in $PACKAGES ; do
2380  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
2381      case $i in      case $i in
2382          aim_v23)          aim_v23)
2383              ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM"              ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM"
2384              echo "Warning: ALLOW_AIM is set to enable aim_v23."              echo "Warning: ALLOW_AIM is set to enable aim_v23."
2385              ;;              ;;
2386      esac      esac
# Line 2275  for i in $spaths ; do Line 2422  for i in $spaths ; do
2422      if test -f $try -a -r $try -a "x$CPP_OPTIONS" = x ; then      if test -f $try -a -r $try -a "x$CPP_OPTIONS" = x ; then
2423          echo "    found CPP_OPTIONS=\"$try\""          echo "    found CPP_OPTIONS=\"$try\""
2424          CPP_OPTIONS="$try"          CPP_OPTIONS="$try"
2425          # New safety test: make sure packages are not mentioned in CPP_OPTIONS.h          # New safety test: make sure packages are not mentioned in CPP_OPTIONS.h
2426          for n in $names ; do          for n in $names ; do
2427              test_for_package_in_cpp_options $CPP_OPTIONS $n              test_for_package_in_cpp_options $CPP_OPTIONS $n
2428          done          done
2429      fi      fi
2430      try="$i/CPP_EEOPTIONS.h"      try="$i/CPP_EEOPTIONS.h"
2431      if test -f $try -a -r $try -a "x$CPP_EEOPTIONS" = x ; then      if test -f $try -a -r $try -a "x$CPP_EEOPTIONS" = x ; then
2432          echo "    found CPP_EEOPTIONS=\"$try\""          echo "    found CPP_EEOPTIONS=\"$try\""
2433          # New safety test: make sure MPI is not determined by CPP_EEOPTIONS.h          # New safety test: make sure MPI is not determined by CPP_EEOPTIONS.h
2434  #**** not yet enabled ****  #**** not yet enabled ****
2435  #        test_for_mpi_in_cpp_eeoptions $try  #        test_for_mpi_in_cpp_eeoptions $try
2436  #**** not yet enabled ****  #**** not yet enabled ****
# Line 2429  for d in $alldirs ; do Line 2576  for d in $alldirs ; do
2576          if test ! -r ".links.tmp/$sf" ; then          if test ! -r ".links.tmp/$sf" ; then
2577              if test -f "$d/$sf" ; then              if test -f "$d/$sf" ; then
2578                  ignore_f=f                  ignore_f=f
2579                  case $d/$sf in                  case $d/$sf in
2580                    ./$PACKAGES_DOT_H)                    ./$PACKAGES_DOT_H)
2581                          ignore_f=t                          ignore_f=t
2582                          ;;                          ;;
2583                    ./AD_CONFIG.h)                    ./AD_CONFIG.h)
2584                          ignore_f=t                          ignore_f=t
2585                          ;;                          ;;
2586                    ./FC_NAMEMANGLE.h)                    ./FC_NAMEMANGLE.h)
2587                          ignore_f=t                          ignore_f=t
2588                          ;;                          ;;
2589                    ./BUILD_INFO.h)                    ./BUILD_INFO.h)
2590                          ignore_f=t                          ignore_f=t
2591                          ;;                          ;;
2592                    ./EMBEDDED_FILES.h)                    ./EMBEDDED_FILES.h)
2593                          ignore_f=t                          ignore_f=t
2594                          ;;                          ;;
2595                    *)                    *)
2596                          #  For the local directory *ONLY*,                          #  For the local directory *ONLY*,
2597                          #  ignore all soft-links                          #  ignore all soft-links
2598                          if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then                          if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then
# Line 2455  for d in $alldirs ; do Line 2602  for d in $alldirs ; do
2602                              deplist="$deplist $sf"                              deplist="$deplist $sf"
2603                          fi                          fi
2604                          ;;                          ;;
2605                  esac                  esac
2606                  if test "x$ignore_f" = xf ; then                  if test "x$ignore_f" = xf ; then
2607                      extn=`echo $sf | $AWK -F. '{print $NF}'`                      extn=`echo $sf | $AWK -F. '{print $NF}'`
2608                      case $extn in                      case $extn in
# Line 2502  for d in $alldirs ; do Line 2649  for d in $alldirs ; do
2649                          echo    " \\"  >> hsrclist.tmp                          echo    " \\"  >> hsrclist.tmp
2650                          printf " $sf" >> hsrclist.tmp                          printf " $sf" >> hsrclist.tmp
2651                          ;;                          ;;
2652                      flow)                      flow)
2653                          echo    " \\"  >> ad_flow_files.tmp                          echo    " \\"  >> ad_flow_files.tmp
2654                          printf " $sf" >> ad_flow_files.tmp                          printf " $sf" >> ad_flow_files.tmp
2655                          ;;                          ;;
# Line 2513  for d in $alldirs ; do Line 2660  for d in $alldirs ; do
2660      done      done
2661      if test "x$deplist" != x ; then      if test "x$deplist" != x ; then
2662        if test "$d" != "." ; then        if test "$d" != "." ; then
2663          echo "" >> srclinks.tmp          echo "" >> srclinks.tmp
2664          echo "#  These files are linked from $d" >> srclinks.tmp          echo "#  These files are linked from $d" >> srclinks.tmp
2665          echo "$deplist :" >> srclinks.tmp          echo "$deplist :" >> srclinks.tmp
2666  # We need to make sure that the link isn't already there.  # We need to make sure that the link isn't already there.
# Line 2534  echo "" >> ad_flow_files.tmp Line 2681  echo "" >> ad_flow_files.tmp
2681  CMDLINE=$0  CMDLINE=$0
2682  for xx in "$@" ; do nw=`echo $xx | wc -w`  for xx in "$@" ; do nw=`echo $xx | wc -w`
2683      if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"      if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"
2684                          else CMDLINE="$CMDLINE '$xx'" ; fi                          else CMDLINE="$CMDLINE '$xx'" ; fi
2685  done  done
2686    
2687  if test -f $MAKEFILE ; then  if test -f $MAKEFILE ; then
# Line 2642  NOOPTFILES = ${NOOPTFILES} Line 2789  NOOPTFILES = ${NOOPTFILES}
2789  NOOPTFLAGS = ${NOOPTFLAGS}  NOOPTFLAGS = ${NOOPTFLAGS}
2790  # Flags and libraries needed for linking  # Flags and libraries needed for linking
2791  LIBS = ${LIBS}  LIBS = ${LIBS}
2792  # Name of the Mekfile  # Name of the makefile
2793  MAKEFILE=${MAKEFILE}  MAKEFILE=${MAKEFILE}
2794    
2795  EOF  EOF
# Line 2667  echo >> $MAKEFILE Line 2814  echo >> $MAKEFILE
2814  echo 'F77_PP_SRC_FILES = $(F77_SRC_FILES:.F=.'$FS')'      >> $MAKEFILE  echo 'F77_PP_SRC_FILES = $(F77_SRC_FILES:.F=.'$FS')'      >> $MAKEFILE
2815  echo 'F90_PP_SRC_FILES = $(F90_SRC_FILES:.F90=.'$FS90')' >> $MAKEFILE  echo 'F90_PP_SRC_FILES = $(F90_SRC_FILES:.F90=.'$FS90')' >> $MAKEFILE
2816  echo 'OBJFILES= $(F77_SRC_FILES:.F=.o) $(C_SRC_FILES:.c=.o) $(F90_SRC_FILES:.F90=.o)' >> $MAKEFILE  echo 'OBJFILES= $(F77_SRC_FILES:.F=.o) $(C_SRC_FILES:.c=.o) $(F90_SRC_FILES:.F90=.o)' >> $MAKEFILE
2817  echo 'FLOFILES =  $(AD_FLOW_FILES:.flow=.flowdir)' >> $MAKEFILE  echo 'FLOWFILES =  $(AD_FLOW_FILES:.flow=.flowdir)' >> $MAKEFILE
2818  echo >> $MAKEFILE  echo >> $MAKEFILE
2819  echo '.SUFFIXES:' >> $MAKEFILE  echo '.SUFFIXES:' >> $MAKEFILE
2820  echo '.SUFFIXES: .o .'$FS' .p .F .c .f'$FS90' .'$FS90' .FF90 .F90 .flowdir .flow' >> $MAKEFILE  echo '.SUFFIXES: .o .'$FS' .p .F .c .f'$FS90' .'$FS90' .FF90 .F90 .flowdir .flow' >> $MAKEFILE
# Line 2678  all: \$(EXECUTABLE) Line 2825  all: \$(EXECUTABLE)
2825  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(OBJFILES) \$(EMBEDDED_FILES)  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(OBJFILES) \$(EMBEDDED_FILES)
2826          @echo Creating \$@ ...          @echo Creating \$@ ...
2827          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
2828    
2829  depend:  depend:
2830          @make links          @make -f \$(MAKEFILE) links
2831          \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES)          \$(MAKEDEPEND) -f \$(MAKEFILE) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES)
2832          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
2833          -rm -f makedepend.out          -rm -f makedepend.out
2834    
# Line 2690  libmitgcmuv.a: \$(OBJFILES) Line 2838  libmitgcmuv.a: \$(OBJFILES)
2838          ar rcv libmitgcmuv.a \$(OBJFILES)          ar rcv libmitgcmuv.a \$(OBJFILES)
2839          ar d   libmitgcmuv.a main.o          ar d   libmitgcmuv.a main.o
2840    
2841    obj: \$(OBJFILES)
2842    
2843  links: \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(SPECIAL_FILES)  links: \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(SPECIAL_FILES)
2844    
2845  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)  small_f: \$(F77_PP_SRC_FILES) \$(F90_PP_SRC_FILES)
# Line 2707  clean: Line 2857  clean:
2857    
2858  # remove most of the files that "make" and "make depend" generate  # remove most of the files that "make" and "make depend" generate
2859  Clean:  Clean:
2860          @make clean          @make -f \$(MAKEFILE) clean
2861          @make cleanlinks          @make -f \$(MAKEFILE) cleanlinks
2862          -rm -f \$(SPECIAL_FILES) f90mkdepend.log          -rm -f \$(SPECIAL_FILES) f90mkdepend.log $MAKEFILE.old
2863          -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log          -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log taf_ftl.log
2864          -rm -f genmake_warnings genmake_errors make.log          -rm -f genmake_warnings genmake_errors make.log
2865    
2866  # remove also the executable, files that "genmake2" generates (except Makefile)  # remove also the executable, files that "genmake2" generates (except Makefile)
2867  #         and output from a run (plus log files from testreport)  #         and output from a run (plus log files from testreport)
2868  CLEAN:  CLEAN:
2869          @make Clean          @make -f \$(MAKEFILE) Clean
2870          -rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak $MAKEFILE.old          -rm -f \$(EXECUTABLE) \$(EXE_AD) \$(EXE_FTL) *.bak
2871          -rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log          -rm -f $LOGFILE genmake_state genmake_*optfile
2872            -rm -f SIZE.h.mpi genmake.tr_log make.tr_log
2873          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
2874          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
2875          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
# Line 2737  ${PACKAGES_DOT_H}: Line 2888  ${PACKAGES_DOT_H}:
2888          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@
2889  AD_CONFIG.h:  AD_CONFIG.h:
2890          @echo Creating \$@ ...          @echo Creating \$@ ...
2891          @$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 > \$@          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > \$@
2892  FC_NAMEMANGLE.h:  FC_NAMEMANGLE.h:
2893          @echo Creating \$@ ...          @echo Creating \$@ ...
2894          echo "$FC_NAMEMANGLE" > \$@          echo "$FC_NAMEMANGLE" > \$@
# Line 2781  cat >>$MAKEFILE <<EOF Line 2932  cat >>$MAKEFILE <<EOF
2932          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
2933  .$FS.o:  .$FS.o:
2934          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
2935    .F.o:
2936            \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
2937  .F90.$FS90:  .F90.$FS90:
2938          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
2939  .FF90.f$FS90:  .FF90.f$FS90:
# Line 2849  adtaf: ad_taf_output.$FS Line 3002  adtaf: ad_taf_output.$FS
3002  adtamc: ad_tamc_output.$FS  adtamc: ad_tamc_output.$FS
3003    
3004  ad_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES) \$(AD_FLOW_FILES)  ad_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES) \$(AD_FLOW_FILES)
3005          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > ad_config.template
3006          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
3007          -rm -f ad_config.template          -rm -f ad_config.template
3008          @make \$(F77_PP_SRC_FILES)          @make -f \$(MAKEFILE) \$(F77_PP_SRC_FILES)
3009          @make \$(FLOFILES)          @make -f \$(MAKEFILE) \$(FLOWFILES)
3010          cat \$(FLOFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS          cat \$(FLOWFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS
3011    
3012  ad_taf_output.$FS: ad_input_code.$FS  ad_taf_output.$FS: ad_input_code.$FS
3013          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
# Line 2882  adonlyfwd: Line 3035  adonlyfwd:
3035  adtrick:  adtrick:
3036          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff
3037    
3038    adobj: ad_taf_output.o \$(OBJFILES)
3039    
3040  # ... FTL ...  # ... FTL ...
3041  ftlall: ftl_taf  ftlall: \$(EXE_FTL)
3042  ftltaf: ftl_taf_output.$FS  ftltaf: ftl_taf_output.$FS
3043  ftltamc: ftl_tamc_output.$FS  ftltamc: ftl_tamc_output.$FS
3044    
3045  ftl_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES)  ftl_input_code.$FS: \$(AD_FILES) \$(H_SRC_FILES)
3046          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN > ftl_config.template
3047          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
3048          -rm -f ftl_config.template          -rm -f ftl_config.template
3049          @make \$(F77_PP_SRC_FILES)          @make -f \$(MAKEFILE) \$(F77_PP_SRC_FILES)
3050          @make \$(AD_FLOW_FILES)          @make -f \$(MAKEFILE) \$(AD_FLOW_FILES)
3051          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS          cat \$(AD_FLOW_FILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ftl_input_code.$FS
3052    
3053  ftl_taf_output.$FS: ftl_input_code.$FS  ftl_taf_output.$FS: ftl_input_code.$FS
3054          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
# Line 2905  ftltafonly: Line 3060  ftltafonly:
3060          ls -l ftl_input_code_ftl.$FS          ls -l ftl_input_code_ftl.$FS
3061          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS
3062    
3063  ftl_taf: ftl_taf_output.o \$(OBJFILES)  \${EXE_FTL}: ftl_taf_output.o \$(OBJFILES)
3064          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o \${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
3065    
3066  ftl_tamc_output.$FS: ftl_input_code.$FS  ftl_tamc_output.$FS: ftl_input_code.$FS
3067          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS
# Line 2915  ftl_tamc_output.$FS: ftl_input_code.$FS Line 3070  ftl_tamc_output.$FS: ftl_input_code.$FS
3070  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
3071          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
3072    
   
3073  # ... SVD ...  # ... SVD ...
3074  svdtaf: ad_taf_output.$FS ftl_taf_output.$FS  svdtaf: ad_taf_output.$FS ftl_taf_output.$FS
3075          @echo "--->>> Only ran TAF to generate SVD code!    <<<---"          @echo "--->>> Only ran TAF to generate SVD code!    <<<---"
# Line 2936  svd_touch: Line 3090  svd_touch:
3090          touch ad_taf_output.$FS ftl_taf_output.$FS          touch ad_taf_output.$FS ftl_taf_output.$FS
3091          \$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS          \$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS
3092          \$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS          \$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS
3093          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN > ftl_config.template
3094          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
3095          -rm -f ftl_config.template          -rm -f ftl_config.template
3096    
# Line 3013  CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod. Line 3167  CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod.
3167    
3168  .PHONY: adDepend  .PHONY: adDepend
3169  adDepend: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(addsuffix _mod.FF90, \$(CB2M_F90_SRC_NAMES)) \$(F77_SRC_FILES:.F=_cb2m.FF90)  adDepend: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) \$(addsuffix _mod.FF90, \$(CB2M_F90_SRC_NAMES)) \$(F77_SRC_FILES:.F=_cb2m.FF90)
3170          \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES)          \$(MAKEDEPEND) -f \$(MAKEFILE) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES)
3171          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
3172          -rm -f makedepend.out          -rm -f makedepend.out
3173    
# Line 3038  f95_test.out: f95_test_mods.f90 f95_test Line 3192  f95_test.out: f95_test_mods.f90 f95_test
3192          f95 -fixed -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1          f95 -fixed -w=unused -maxcontin=132 -c f95_test_mods.f90 > \$@ 2>&1
3193          f95 -fixed -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1          f95 -fixed -w=unused -maxcontin=132 -c -fixed f95_test.f90 >> \$@ 2>&1
3194    
3195  # the file included below is created by the  CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90)
 # postProcessor and its inclusion sets the  
 # variable POSTPROCESSEDFILES  
 # used below. Because the file is made during  
 # make it won't be read until the second (recursive)  
 # invocation in the rule below  
 -include postProcess.make  
3196    
3197  AD_OBJ_FILES_S1=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o) \$(POSTPROCESSEDFILES:.f$FS90=.o)  AD_OBJ_FILES_S1=\$(OPENAD_SUPPORT_F90_SRC_FILES:.F90=.o) \$(OPENAD_SUPPORT_C_SRC_FILES:.c=.o)  OAD_intrinsics_oad.o \$(CB2M_AD_FILES:.f$FS90=_oad.o)
3198    
3199  AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o)  AD_OBJ_FILES_S2=\$(AD_OBJ_FILES_S1) \$(NON_AD_F77_SRC_FILES:.F=_cb2m.o) \$(C_SRC_FILES:.c=.o) \$(F90_SRC_FILES:.F90=.o)
3200    
3201  postProcess.comp: \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.tag \$(AD_OBJ_FILES_S1)  \$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.tag \$(AD_OBJ_FILES_S2)
 ifeq (\$(MAKELEVEL),0)  
         \$(MAKE) adAll  
 else  
         touch \$@  
 endif  
   
 \$(EXE_AD): \$(ALL_LINKED_FILES) \$(addsuffix _mod.h, \$(CB2M_F90_SRC_NAMES)) postProcess.comp \$(AD_OBJ_FILES_S2)  
 ifeq (\$(MAKELEVEL),1)  
3202          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(AD_OBJ_FILES_S2) \$(LIBS)
 else  
         touch \$@  
 endif  
   
 # makefile debug rule  
 openad: ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90  
 .PHONY: openad  
3203    
3204  # create the module files  # create sources files modules from header files containing common blocks
3205  %_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk  %_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk
3206          ../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk          ../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk
3207    
3208  # create the header files  # create new header files with USE statements for the new modules made above
3209  %_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk  %_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk
3210          ../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES)          ../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES)
3211    
3212  # change everybody else to use the new module files:  # change the include directives of everybody to refer to  the new header files with the USE statements
3213  %_cb2m.FF90 : %.F ../OAD_support/cb2mUseModules.bash  %_cb2m.FF90 : %.F ../OAD_support/cb2mUseModules.bash
3214          ../OAD_support/cb2mUseModules.bash $< ${MPI}          ../OAD_support/cb2mUseModules.bash $< ${MPI}
3215    
# Line 3091  ad_output.txt: \$(EXE_AD) Line 3224  ad_output.txt: \$(EXE_AD)
3224          @printf 'running ... '          @printf 'running ... '
3225          @./\$(EXE_AD) > \$@          @./\$(EXE_AD) > \$@
3226    
 CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS90)  
3227  ad_input_code.f$FS90:  \$(CB2M_AD_FILES)  ad_input_code.f$FS90:  \$(CB2M_AD_FILES)
3228          cat \$^ > \$@          cat \$^ > \$@
3229    
 # strip all comments and blanks to reduce  
 # the file size in order to reduce perl's memory requirements  
 ad_input_code_sf.f$FS90 : ad_input_code.f$FS90  
         cat \$^ | sed -f ../OAD_support/strip.sed | sed -f ../OAD_support/stop2print.sed > \$@  
   
 # mfef90 preprocessing  
 # expand statement functions  
 # expose mfef90 specific substring handling  
 # add the w2f__types module  
 ad_input_code_sf.w2f.f$FS90: ad_input_code_sf.f$FS90 mfef90 whirl2f whirl2f_be w2f__types.f90  
         ./mfef90 -r8 -z -F -N132 \$<  
         mv \$<.B \$(basename \$<).B  
         ./whirl2f -openad \$(basename \$<).B  
         cat w2f__types.f90 \$(basename \$<).w2f.f > \$@  
   
3230  # canonicalizer  # canonicalizer
3231  ad_input_code_sf.w2f.pre.f$FS90: ad_input_code_sf.w2f.f$FS90 preProcess.py  ad_input_code_sf.pre.f90 : \$(CB2M_AD_FILES)
3232          ./preProcess.py --timing --r8 -H -S \$< -o \$@          \${OPENADFORTTK_BASE}/tools/SourceProcessing/preProcess.py --timing --r8 -H -S  -o \$@ \$^
3233    
3234    # replace stop statements (to avoid the implied unstructured control flow)  with print statements
3235    ad_input_code_sf.pre.s2p.f90 : ad_input_code_sf.pre.f90
3236            cat \$< | sed -f ../OAD_support/stop2print.sed > ad_input_code_sf.pre.s2p.f90
3237    
3238  # F -> WHIRL  # F -> WHIRL
3239  # note that the canonicalized version cuts off at col 72  ad_input_code_sf.pre.s2p.B: ad_input_code_sf.pre.s2p.f90
3240  # doing this also for string constants which is ok as long          \${OPEN64ROOT}/crayf90/sgi/mfef90 -r8 -z -F ad_input_code_sf.pre.s2p.f90
 # as we are in fixed mode and cut of exactly there.  
 # Otherwise mfef90 patches in spaces to fill up to 72 (or 132)  
 # characters respectively.  
 ad_input_code_sf.w2f.pre.B: ad_input_code_sf.w2f.pre.f$FS90 mfef90  
         ./mfef90 -r8 -z -F \$<  
         mv \$<.B \$@  
3241    
3242  # WHIRL -> XAIF  # WHIRL -> XAIF
3243  ad_input_code_sf.w2f.pre.xaif : ad_input_code_sf.w2f.pre.B whirl2xaif  ad_input_code_sf.pre.s2p.xaif : ad_input_code_sf.pre.s2p.B
3244          ./whirl2xaif -s -n --debug 1 -o \$@ \$<          \${OPENADFORTTK}/bin/whirl2xaif -s -n --debug 1 -o \$@ \$<
3245    
3246  # XAIF -> XAIF'  # XAIF -> XAIF'
3247  ad_input_code_sf.w2f.pre.xb.xaif : ad_input_code_sf.w2f.pre.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd oadDriver  ad_input_code_sf.pre.s2p.xb.xaif : ad_input_code_sf.pre.s2p.xaif xaif.xsd xaif_base.xsd xaif_inlinable_intrinsics.xsd xaif_derivative_propagator.xsd xaif_output.xsd
3248          ./oadDriver -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r          \${XAIFBOOSTERROOT}/xaifBooster/algorithms/BasicBlockPreaccumulationReverse/driver/oadDriver -f -t forward_step -i \$< -c \${XAIFSCHEMAROOT}/schema/examples/inlinable_intrinsics.xaif -o \$@ -I -r
3249    
3250  # XAIF' -> WHIRL'  # XAIF' -> WHIRL'
3251  ad_input_code_sf.w2f.pre.xb.x2w.B : ad_input_code_sf.w2f.pre.xb.xaif xaif2whirl  ad_input_code_sf.pre.s2p.xb.x2w.B : ad_input_code_sf.pre.s2p.xb.xaif
3252          ./xaif2whirl --debug 1 ad_input_code_sf.w2f.pre.B \$<          \${OPENADFORTTK}/bin/xaif2whirl --debug 1 ad_input_code_sf.pre.s2p.B \$<
3253    
3254  # WHIRL' -> F'  # WHIRL' -> F'
3255  ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.B whirl2f whirl2f_be  ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.B
3256          ./whirl2f -FLIST:ftn_file=\$@ -openad \$<          \${OPEN64ROOT}/whirl2f/whirl2f -FLIST:ftn_file=\$@ -openad \$<
3257    
3258  # insert template directives  # insert template directives
3259  ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash  ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.pre.s2p.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash
3260          ../OAD_support/insertTemplateDir.bash \$< \$@          ../OAD_support/insertTemplateDir.bash \$< \$@
3261    
3262  PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F  PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F
3263  # postprocess F'  # postprocess F'
3264  postProcess.tag: ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f$FS90 postProcess.py \$(PPEXTRAS:.F=.f)  postProcess.tag: ad_input_code_sf.pre.s2p.xb.x2w.w2f.td.f$FS90 \$(PPEXTRAS:.F=.f) | w2f__types.f90
3265          # the target is a placeholder to signal execution of the rule          \${OPENADFORTTK_BASE}/tools/SourceProcessing/postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed --separateOutput --pathSuffix "" --filenameSuffix "_oad" -m r -i ../OAD_support/ad_inline.f \$<
3266            # the target is a placeholder to trigger a single execution of the rule
3267          touch \$@          touch \$@
3268          # this step also creates the file postProcess.make but we cannot  # put this so make knows about the postprocessing output
3269          # name it as the target or else make will try to remake it for  OAD_intrinsics_oad.f \$(CB2M_AD_FILES:.f$FS90=_oad.f): postProcess.tag
         # the include directive above for any rule, e.g. make clean  
         ./postProcess.py --progress --timing --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$<  
3270    
3271  # setup some links  # link the XAIF schema files
3272  %.xsd:  %.xsd:
3273          \$(LN) \${XAIFSCHEMAROOT}/schema/\$@ .          \$(LN) \${XAIFSCHEMAROOT}/schema/\$@ .
3274    
 mfef90:  
         \$(LN) \${OPEN64ROOT}/crayf90/sgi/mfef90 .  
   
3275  # link the support files:  # link the support files:
3276  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES):  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES):
3277          \$(LN) ../OAD_support/\$@ .          \$(LN) ../OAD_support/\$@ .
3278    
3279  whirl2xaif xaif2whirl:  AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.tag \$(PPEXTRAS:.F=.f)
         \$(LN) \${OPENADFORTTK}/bin/\$@ .  
   
 preProcess.py postProcess.py:  
         \$(LN) \${OPENADFORTTK_BASE}/tools/SourceProcessing/\$@ .  
   
 whirl2f whirl2f_be:  
         \$(LN) \${OPEN64ROOT}/whirl2f/\$@ .  
   
 oadDriver:  
         \$(LN) \${XAIFBOOSTERROOT}/xaifBooster/algorithms/BasicBlockPreaccumulationReverse/driver/oadDriver \$@  
   
 AD_CLEAN += *_mod.h *_mod.F90 *.FF90 *.mod-whirl temp.sed oad_cp.* postProcess.make postProcess.tag postProcess.comp \$(PPEXTRAS:.F=.f)  
3280    
3281  # ============ end OpenAD specific section ==============  # ============ end OpenAD specific section ==============
3282    
# Line 3236  else Line 3335  else
3335      fi      fi
3336  fi  fi
3337  if test ! -f AD_CONFIG.h ; then  if test ! -f AD_CONFIG.h ; then
3338      $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      $BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN > AD_CONFIG.h
3339  fi  fi
3340    
   
3341  #  Write the "state" for future records  #  Write the "state" for future records
3342  if test "x$DUMPSTATE" = xt ; then  if test "x$DUMPSTATE" = xt ; then
3343      printf "" > genmake_state      printf "" > genmake_state
3344      for i in $gm_state ; do      for i in $gm_state ; do
3345          t1="t2=\$$i"          t1="t2=\$$i"
3346          eval $t1          eval $t1
3347          echo "$i='$t2'" >> genmake_state          echo "$i='$t2'" | sed -e 's/  */ /g' >> genmake_state
3348      done      done
3349  fi  fi

Legend:
Removed from v.1.211  
changed lines
  Added in v.1.237

  ViewVC Help
Powered by ViewVC 1.1.22