/[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.202 by jmc, Wed Mar 3 19:19:39 2010 UTC revision 1.212 by jmc, Thu Nov 4 18:01:22 2010 UTC
# Line 56  test_for_string_in_file() { Line 56  test_for_string_in_file() {
56  # the package list.  # the package list.
57  expand_pkg_groups() {  expand_pkg_groups() {
58      new_packages=      new_packages=
     PKG_GROUPS=$ROOTDIR"/pkg/pkg_groups"  
59      if test -r $PKG_GROUPS ; then      if test -r $PKG_GROUPS ; then
60          cat $PKG_GROUPS | sed -e 's/#.*$//g' | sed -e 's/:/ : /g' > ./p1.tmp          cat $PKG_GROUPS | sed -e 's/#.*$//g' | sed -e 's/:/ : /g' > ./p1.tmp
61          cat ./p1.tmp | $AWK '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp          cat ./p1.tmp | $AWK '(NF>2 && $2==":"){ print $0 }' > ./p2.tmp
# Line 67  expand_pkg_groups() { Line 66  expand_pkg_groups() {
66              if test "x$RETVAL" = x0 ; then              if test "x$RETVAL" = x0 ; then
67                  matched=1                  matched=1
68                  replace=`echo $line | $AWK '{ $1=""; $2=""; print $0 }'`                  replace=`echo $line | $AWK '{ $1=""; $2=""; print $0 }'`
69                  echo "    replacing \"$i\" with: $replace"                  echo "    replacing \"$i\" with:$replace"
70                  new_packages="$new_packages $replace"                  new_packages="$new_packages $replace"
71              else              else
72                  new_packages="$new_packages $i"                  new_packages="$new_packages $i"
# Line 110  EOF Line 109  EOF
109              check_for_broken_Ff              check_for_broken_Ff
110          else          else
111              cat <<EOF 2>&1              cat <<EOF 2>&1
112  ERROR: Your file system cannot distinguish between *.F and *.f files  ERROR: Your file system cannot distinguish between *.F and *.f files
113    (fails the "cp" test) and this program cannot find a suitable    (fails the "cp" test) and this program cannot find a suitable
114    replacement extension.  Please try a different build environment or    replacement extension.  Please try a different build environment or
115    contact the <MITgcm-support@mitgcm.org> list for help.    contact the <MITgcm-support@mitgcm.org> list for help.
116    
117  EOF  EOF
# Line 146  EOF Line 145  EOF
145              check_for_broken_Ff              check_for_broken_Ff
146          else          else
147              cat <<EOF 2>&1              cat <<EOF 2>&1
148  ERROR: Your file system cannot distinguish between *.F and *.f files  ERROR: Your file system cannot distinguish between *.F and *.f files
149    (fails the "make/ln" test) and this program cannot find a suitable    (fails the "make/ln" test) and this program cannot find a suitable
150    replacement extension.  Please try a different build environment or    replacement extension.  Please try a different build environment or
151    contact the <MITgcm-support@mitgcm.org> list for help.    contact the <MITgcm-support@mitgcm.org> list for help.
152    
153  EOF  EOF
# Line 194  look_for_makedepend()  { Line 193  look_for_makedepend()  {
193          cat <<EOF >> $MAKEFILE          cat <<EOF >> $MAKEFILE
194  #   THIS IS A TEST MAKEFILE GENERATED BY "genmake2"  #   THIS IS A TEST MAKEFILE GENERATED BY "genmake2"
195  #  #
196  #   Some "makedepend" implementations will die if they cannot  #   Some "makedepend" implementations will die if they cannot
197  #   find a Makefile -- so this file is here to gives them an  #   find a Makefile -- so this file is here to gives them an
198  #   empty one to find and parse.  #   empty one to find and parse.
199  EOF  EOF
200          cat <<EOF >> genmake_tc.f          cat <<EOF >> genmake_tc.f
# Line 212  EOF Line 211  EOF
211              MAKEDEPEND=makedepend              MAKEDEPEND=makedepend
212          else          else
213              echo "    a system-default makedepend was not found."              echo "    a system-default makedepend was not found."
214                
215              #  Try to build the cyrus implementation              #  Try to build the cyrus implementation
216              build_cyrus_makedepend              build_cyrus_makedepend
217              RETVAL=$?              RETVAL=$?
# Line 269  build_embed_encode() Line 268  build_embed_encode()
268              return 1              return 1
269          fi          fi
270          clist="cc gcc c89 $CC"          clist="cc gcc c89 $CC"
271          for ic in $clist ; do          for ic in $clist ; do
272              comm="$ic -o encode_files encode_files.c"              comm="$ic -o encode_files encode_files.c"
273              ( cd $ROOTDIR/tools/embed_encode && $comm ) > /dev/null 2>&1              ( cd $ROOTDIR/tools/embed_encode && $comm ) > /dev/null 2>&1
274              RETVAL=$?              RETVAL=$?
# Line 291  build_embed_encode() Line 290  build_embed_encode()
290  }  }
291    
292    
293  # Guess possible config options for this host  #  look for possible C compilers
294  find_possible_configs()  {  look_for_C_compilers() {
   
     tmp1=`uname`"_"`uname -m`  
     tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`  
     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  
295      tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc"      tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc"
296      p_CC=      p_CC=
297      for c in $tmp ; do      for c in $tmp ; do
# Line 361  EOF Line 328  EOF
328              echo "  Setting C compiler to: "$CC              echo "  Setting C compiler to: "$CC
329          fi          fi
330      fi      fi
331    }
332    
333    # Guess possible config options for this host
334    find_possible_optfile()  {
335    
336        tmp1=`uname`"_"`uname -m`
337        tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
338        tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
339        tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`
340        tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
341        tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`
342        PLATFORM=$tmp3
343        echo $PLATFORM | grep cygwin > /dev/null 2>&1  &&  PLATFORM=cygwin_ia32
344        OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
345        echo "  The platform appears to be:  $PLATFORM"
346    
347    #    echo "test" > test
348    #    ln -s ./test link
349    #    RETVAL=$?
350    #    if test "x${RETVAL}" = x0 ; then
351    #       LN="ln -s"
352    #    else
353    #       echo "Error: \"ln -s\" does not appear to work on this system!"
354    #       echo "  For help, please contact <MITgcm-support@mitgcm.org>."
355    #       exit 1
356    #    fi
357    #    rm -f test link
358    #
359    #    if test "x$CPP" = x ; then
360    #       CPP="cpp -traditional -P"
361    #    fi
362    #
363    #    look_for_makedepend
364    #
365    #    look_for_C_compilers
366    
367      #================================================================      #================================================================
368      #  look for possible FORTRAN compilers      #  look for possible FORTRAN compilers
# Line 416  EOF Line 418  EOF
418               echo "  I looked for the file "$OPTFILE" but did not find it"               echo "  I looked for the file "$OPTFILE" but did not find it"
419          fi          fi
420      fi      fi
421  #    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  
422      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
423          cat 1>&2 <<EOF          cat 1>&2 <<EOF
424    
# Line 442  Error: No options file was found in:  $R Line 434  Error: No options file was found in:  $R
434  EOF  EOF
435          exit 1          exit 1
436      fi      fi
437        
438  #     # look for possible MPI libraries  #     # look for possible MPI libraries
439  #     mpi_libs=  #     mpi_libs=
440  #     mpi_fort=`which mpif77 2>/dev/null`  #     mpi_fort=`which mpif77 2>/dev/null`
# Line 461  EOF Line 453  EOF
453  #       if test "x${RETVAL}" = x0 ; then  #       if test "x${RETVAL}" = x0 ; then
454  #           a=`cat out`  #           a=`cat out`
455  #           for i in $a ; do  #           for i in $a ; do
456  #               case $i in  #               case $i in
457  #                   -*)  #                   -*)
458  #                       mpi_libs="$mpi_libs $i" ;;  #                       mpi_libs="$mpi_libs $i" ;;
459  #               esac  #               esac
# Line 480  get_pdepend_list()  { Line 472  get_pdepend_list()  {
472      #  strip the comments and then convert the dependency file into      #  strip the comments and then convert the dependency file into
473      #  two arrays: PNAME, DNAME      #  two arrays: PNAME, DNAME
474      cat $1 | sed -e 's/#.*$//g' \      cat $1 | sed -e 's/#.*$//g' \
475          | $AWK 'BEGIN{nn=0;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME["nn"]="$1"\nDNAME["nn"]="$i} }' \          | $AWK 'BEGIN{nn=-1;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME_"nn"="$1"\nDNAME_"nn"="$i}} END{print "nname="nn}' \
476          > ./.pd_tmp          > ./.pd_tmp
477        RETVAL=$?
478        if test ! "x${RETVAL}" = x0 ; then
479          echo "Error: unable to parse package dependencies -- please check PKG_DEPEND=\"$1\""
480          exit 1
481        fi
482      . ./.pd_tmp      . ./.pd_tmp
483      rm -f ./.pd_tmp      rm -f ./.pd_tmp
484    
     printf "PNAME = "${}  
485  }  }
486    
487    
# Line 508  Usage: "$0" [OPTIONS] Line 504  Usage: "$0" [OPTIONS]
504        -optfile NAME | --optfile NAME | -of NAME | --of NAME        -optfile NAME | --optfile NAME | -of NAME | --of NAME
505        -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME        -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME
506            Use "NAME" as the optfile.  By default, an attempt will be            Use "NAME" as the optfile.  By default, an attempt will be
507            made to find an appropriate "standard" optfile in the            made to find an appropriate "standard" optfile in the
508            tools/build_options/ directory.            tools/build_options/ directory.
509    
510      -pdepend NAME | --pdepend NAME      -pdepend NAME | --pdepend NAME
511        -pdepend=NAME | --pdepend=NAME        -pdepend=NAME | --pdepend=NAME
512            Get package dependency information from "NAME".            Get package dependency information from "NAME".
513    
514      -pdefault NAME | --pdefault NAME      -pgroups NAME | --pgroups NAME
515        -pdefault=NAME | --pdefault=NAME        -pgroups=NAME | --pgroups=NAME
516            Get the default package list from "NAME".            Get the package groups information from "NAME".
517    
518        -bash NAME
519              Explicitly specify the Bourne or BASH shell to use
520    
521      -make NAME | -m NAME      -make NAME | -m NAME
522        --make=NAME | -m=NAME        --make=NAME | -m=NAME
523            Use "NAME" for the MAKE program. The default is "make" but            Use "NAME" for the MAKE program. The default is "make" but
524            many platforms, "gmake" is the preferred choice.            many platforms, "gmake" is the preferred choice.
525    
526      -makefile NAME | -mf NAME      -makefile NAME | -mf NAME
# Line 535  Usage: "$0" [OPTIONS] Line 534  Usage: "$0" [OPTIONS]
534      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME
535        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME
536            Specify the location of the MITgcm ROOTDIR as "NAME".            Specify the location of the MITgcm ROOTDIR as "NAME".
537            By default, genamke will try to find the location by            By default, genamke will try to find the location by
538            looking in parent directories (up to the 5th parent).            looking in parent directories (up to the 5th parent).
539    
540      -mods NAME | --mods NAME | -mo NAME | --mo NAME      -mods NAME | --mods NAME | -mo NAME | --mo NAME
541        -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME        -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME
542            Here, "NAME" specifies a list of directories that are            Here, "NAME" specifies a list of directories that are
543            used for additional source code.  Files found in the            used for additional source code.  Files found in the
544            "mods list" are given preference over files of the same            "mods list" are given preference over files of the same
545            name found elsewhere.            name found elsewhere.
546    
547      -disable NAME | --disable NAME      -disable NAME | --disable NAME
548        -disable=NAME | --disable=NAME        -disable=NAME | --disable=NAME
549            Here "NAME" specifies a list of packages that we don't            Here "NAME" specifies a list of packages that we don't
550            want to use.  If this violates package dependencies,            want to use.  If this violates package dependencies,
551            genamke will exit with an error message.            genamke will exit with an error message.
552    
553      -enable NAME | --enable NAME      -enable NAME | --enable NAME
554        -enable=NAME | --enable=NAME        -enable=NAME | --enable=NAME
555            Here "NAME" specifies a list of packages that we wish            Here "NAME" specifies a list of packages that we wish
556            to specifically enable.  If this violates package            to specifically enable.  If this violates package
557            dependencies, genamke will exit with an error message.            dependencies, genamke will exit with an error message.
558    
559      -standarddirs NAME | --standarddirs NAME      -standarddirs NAME | --standarddirs NAME
560        -standarddirs=NAME | --standarddirs=NAME        -standarddirs=NAME | --standarddirs=NAME
561            Here, "NAME" specifies a list of directories to be            Here, "NAME" specifies a list of directories to be
562            used as the "standard" code.            used as the "standard" code.
563    
564      -fortran NAME | --fortran NAME | -fc NAME | --fc NAME      -fortran NAME | --fortran NAME | -fc NAME | --fc NAME
565        -fc=NAME | --fc=NAME        -fc=NAME | --fc=NAME
566            Use "NAME" as the fortran compiler.  By default, genmake            Use "NAME" as the fortran compiler.  By default, genmake
567            will search for a working compiler by trying a list of            will search for a working compiler by trying a list of
568            "usual suspects" such as g77, f77, etc.            "usual suspects" such as g77, f77, etc.
569    
570      -cc NAME | --cc NAME | -cc=NAME | --cc=NAME      -cc NAME | --cc NAME | -cc=NAME | --cc=NAME
571            Use "NAME" as the C compiler.  By default, genmake            Use "NAME" as the C compiler.  By default, genmake
572            will search for a working compiler by trying a list of            will search for a working compiler by trying a list of
573            "usual suspects" such as gcc, c89, cc, etc.            "usual suspects" such as gcc, c89, cc, etc.
574    
575      -[no]ieee | --[no]ieee      -[no]ieee | --[no]ieee
576            Do or don't use IEEE numerics.  Note that this option            Do or don't use IEEE numerics.  Note that this option
577            *only* works if it is supported by the OPTFILE that            *only* works if it is supported by the OPTFILE that
578            is being used.            is being used.
579    
580        -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4
581              Use "real*4" type for _RS variable (#undef REAL4_IS_SLOW)
582              *only* works if CPP_EEOPTIONS.h allows this.
583    
584      -ignoretime | -ignore_time | --ignoretime | --ignore_time      -ignoretime | -ignore_time | --ignoretime | --ignore_time
585            Ignore all the "wall clock" routines entirely.  This will            Ignore all the "wall clock" routines entirely.  This will
586            not in any way hurt the model results -- it simply means            not in any way hurt the model results -- it simply means
587            that the code that checks how long the model spends in            that the code that checks how long the model spends in
588            various routines will give junk values.            various routines will give junk values.
589    
590      -ts | --ts      -ts | --ts
# Line 617  Usage: "$0" [OPTIONS] Line 620  Usage: "$0" [OPTIONS]
620            Activate OpenMP code + use Compiler option OMPFLAG            Activate OpenMP code + use Compiler option OMPFLAG
621    
622      -es | --es | -embed-source | --embed-source      -es | --es | -embed-source | --embed-source
623            Embed a tarball containing the full source code            Embed a tarball containing the full source code
624            (including the Makefile, etc.) used to build the            (including the Makefile, etc.) used to build the
625            executable [off by default]            executable [off by default]
626    
627      -bash NAME    While it is most often a single word, the "NAME" variables specified
           Explicitly specify the Bourne or BASH shell to use  
   
   While it is most often a single word, the "NAME" variables specified  
628    above can in many cases be a space-delimited string such as:    above can in many cases be a space-delimited string such as:
629    
630      --enable pkg1   --enable 'pkg1 pkg2'   --enable 'pkg1 pkg2 pkg3'      --enable pkg1   --enable 'pkg1 pkg2'   --enable 'pkg1 pkg2 pkg3'
# Line 649  get_fortran_c_namemangling()  { Line 649  get_fortran_c_namemangling()  {
649      if test ! "x$FC_NAMEMANGLE" = x ; then      if test ! "x$FC_NAMEMANGLE" = x ; then
650          return 0          return 0
651      fi      fi
652        echo " running: get_fortran_c_namemangling()" >> $LOGFILE
653    
654      default_nm="#define FC_NAMEMANGLE(X) X ## _"      default_nm="#define FC_NAMEMANGLE(X) X ## _"
655        
656      cat > genmake_test.c <<EOF      cat > genmake_test.c <<EOF
657  void tcall( char * string ) { tsub( string ); }  void tcall( char * string ) { tsub( string ); }
658  EOF  EOF
659      $MAKE genmake_test.o >> genmake_warnings 2>&1  #   $MAKE genmake_test.o >> $LOGFILE 2>&1
660        COMM="$CC $CFLAGS -c genmake_test.c"
661        echo ' '$COMM >> $LOGFILE
662        $COMM >> $LOGFILE 2>&1
663      RETVAL=$?      RETVAL=$?
664      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
665          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
666          cat <<EOF>> genmake_errors          cat <<EOF>> $LOGFILE
667    
668  WARNING: C test compile fails   WARNING: C test compile fails
669  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
670  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
671  EOF  EOF
672          return 1          return 1
673      fi      fi
# Line 671  EOF Line 675  EOF
675      RETVAL=$?      RETVAL=$?
676      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
677          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
678          cat <<EOF>> genmake_warnings          cat <<EOF>> $LOGFILE
679    
680  WARNING: The "nm" command failed.   WARNING: The "nm" command failed.
681  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
682  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
683  EOF  EOF
684          return 1          return 1
685      fi      fi
# Line 685  EOF Line 689  EOF
689        call tsub( string )        call tsub( string )
690        end        end
691  EOF  EOF
692      $FC $FFLAGS -c genmake_tcomp.$FS >> genmake_warnings 2>&1      COMM="$FC $FFLAGS -c genmake_tcomp.$FS"
693        echo ' '$COMM >> $LOGFILE
694        $COMM >> $LOGFILE 2>&1
695      RETVAL=$?      RETVAL=$?
696      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
697          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
698          cat <<EOF>> genmake_warnings          cat <<EOF>> $LOGFILE
699    
700  WARNING: FORTRAN test compile fails -- please see "genmake_errors"   WARNING: FORTRAN test compile fails -- please see '$LOGFILE'
701  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
702  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
703  EOF  EOF
704          return 1          return 1
705      fi      fi
# Line 701  EOF Line 707  EOF
707      RETVAL=$?      RETVAL=$?
708      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
709          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
710          cat <<EOF>> genmake_warnings          cat <<EOF>> $LOGFILE
711    
712  WARNING: The "nm" command failed.   WARNING: The "nm" command failed.
713  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
714  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
715  EOF  EOF
716          return 1          return 1
717      fi      fi
# Line 731  EOF Line 737  EOF
737    
738      #  cleanup the testing files      #  cleanup the testing files
739      rm -f genmake_tcomp.* genmake_test.*      rm -f genmake_tcomp.* genmake_test.*
740    
741        echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE
742  }  }
743    
744    
745  check_HAVE_CLOC()  {  check_HAVE_CLOC()  {
746        echo >> $LOGFILE
747        echo "running: check_HAVE_CLOC()" >> $LOGFILE
748      get_fortran_c_namemangling      get_fortran_c_namemangling
749      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
750  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 752  void FC_NAMEMANGLE(cloc) ( double *curti Line 762  void FC_NAMEMANGLE(cloc) ( double *curti
762  }  }
763  EOF  EOF
764      COMM="$CC $CFLAGS -c genmake_tc_1.c"      COMM="$CC $CFLAGS -c genmake_tc_1.c"
765      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
766      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
767      RET_C=$?      RET_C=$?
768      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
769        program hello        program hello
# Line 764  EOF Line 774  EOF
774        end        end
775  EOF  EOF
776      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
777      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
778      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
779      RET_F=$?      RET_F=$?
780      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1      test -x ./genmake_tc  &&  ./genmake_tc >> $LOGFILE 2>&1
781      RETVAL=$?      RETVAL=$?
782      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
783          HAVE_CLOC=t          HAVE_CLOC=t
784          DEFINES="$DEFINES -DHAVE_CLOC"          DEFINES="$DEFINES -DHAVE_CLOC"
785      fi      fi
786      rm -f genmake_tc*      rm -f genmake_tc*
787        echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE
788  }  }
789    
790    
# Line 781  check_HAVE_SIGREG()  { Line 792  check_HAVE_SIGREG()  {
792      if test ! "x$HAVE_SIGREG" = x ; then      if test ! "x$HAVE_SIGREG" = x ; then
793          return          return
794      fi      fi
795        echo >> $LOGFILE
796        echo "running: check_HAVE_SIGREG()" >> $LOGFILE
797      get_fortran_c_namemangling      get_fortran_c_namemangling
798      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
799  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 813  void FC_NAMEMANGLE(sigreg) (int * aip) Line 826  void FC_NAMEMANGLE(sigreg) (int * aip)
826  }  }
827  EOF  EOF
828      COMM="$CC $CFLAGS -c genmake_tc_1.c"      COMM="$CC $CFLAGS -c genmake_tc_1.c"
829      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
830      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
831      RET_C=$?      RET_C=$?
832      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
833        program hello        program hello
# Line 824  EOF Line 837  EOF
837        call sigreg(anint)        call sigreg(anint)
838        end        end
839  EOF  EOF
840      echo >> genmake_warnings      cat genmake_tc_2.$FS >> $LOGFILE
     echo "running: check_HAVE_SIGREG()" >> genmake_warnings  
     cat genmake_tc_2.$FS >> genmake_warnings  
841      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
842      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
843      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
844      RETVAL=$?      RETVAL=$?
845      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
846          HAVE_SIGREG=t          HAVE_SIGREG=t
847          DEFINES="$DEFINES -DHAVE_SIGREG"          DEFINES="$DEFINES -DHAVE_SIGREG"
848      fi      fi
849      rm -f genmake_tc*      rm -f genmake_tc*
850        echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE
851  }  }
852    
853    
# Line 847  check_HAVE_SETRLSTK()  { Line 859  check_HAVE_SETRLSTK()  {
859      if test ! "x$HAVE_SETRLSTK" = x ; then      if test ! "x$HAVE_SETRLSTK" = x ; then
860          return          return
861      fi      fi
862        echo >> $LOGFILE
863        echo "running: check_HAVE_SETRLSTK()" >> $LOGFILE
864      get_fortran_c_namemangling      get_fortran_c_namemangling
865      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
866  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 863  void FC_NAMEMANGLE(setrlstk) () Line 877  void FC_NAMEMANGLE(setrlstk) ()
877  }  }
878  EOF  EOF
879      COMM="$CC $CFLAGS -c genmake_tc_1.c"      COMM="$CC $CFLAGS -c genmake_tc_1.c"
880      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
881      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
882      RET_C=$?      RET_C=$?
883      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
884        program hello        program hello
# Line 872  EOF Line 886  EOF
886        call setrlstk()        call setrlstk()
887        end        end
888  EOF  EOF
889      echo >> genmake_warnings      cat genmake_tc_2.$FS >> $LOGFILE
     echo "running: check_HAVE_SETRLSTK()" >> genmake_warnings  
     cat genmake_tc_2.$FS >> genmake_warnings  
890      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
891      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
892      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
893      RETVAL=$?      RETVAL=$?
894      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
895          HAVE_SETRLSTK=t          HAVE_SETRLSTK=t
896          DEFINES="$DEFINES -DHAVE_SETRLSTK"          DEFINES="$DEFINES -DHAVE_SETRLSTK"
897      fi      fi
898      rm -f genmake_tc*      rm -f genmake_tc*
899        echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE
900  }  }
901    
902    
903  check_HAVE_STAT()  {  check_HAVE_STAT()  {
904        echo >> $LOGFILE
905        echo "running: check_HAVE_STAT()" >> $LOGFILE
906      get_fortran_c_namemangling      get_fortran_c_namemangling
907      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
908  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 909  void FC_NAMEMANGLE(tfsize) ( int *nbyte Line 924  void FC_NAMEMANGLE(tfsize) ( int *nbyte
924  }  }
925  EOF  EOF
926      COMM="$CC $CFLAGS -c genmake_tc_1.c"      COMM="$CC $CFLAGS -c genmake_tc_1.c"
927      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
928      $COMM >> genmake_tc.log 2>&1      $COMM >> genmake_tc.log 2>&1
929      RET_C=$?      RET_C=$?
930      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
# Line 919  EOF Line 934  EOF
934        print *," HELLO WORLD", nbyte        print *," HELLO WORLD", nbyte
935        end        end
936  EOF  EOF
937      echo >> genmake_warnings      cat genmake_tc_2.$FS >> $LOGFILE
     echo "running: check_HAVE_STAT()" >> genmake_warnings  
     cat genmake_tc_2.$FS >> genmake_warnings  
938      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
939      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
940      $COMM >> genmake_tc.log 2>&1      $COMM >> genmake_tc.log 2>&1
941      RETVAL=$?      RETVAL=$?
942      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
# Line 931  EOF Line 944  EOF
944          DEFINES="$DEFINES -DHAVE_STAT"          DEFINES="$DEFINES -DHAVE_STAT"
945      fi      fi
946      rm -f genmake_tc*      rm -f genmake_tc*
947        echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE
948  }  }
949    
950    
# Line 938  check_netcdf_libs()  { Line 952  check_netcdf_libs()  {
952      if test ! "x$SKIP_NETCDF_CHECK" = x ; then      if test ! "x$SKIP_NETCDF_CHECK" = x ; then
953          return          return
954      fi      fi
955      echo >> genmake_warnings      echo >> $LOGFILE
956      echo "running: check_netcdf_libs()" >> genmake_warnings      echo "running: check_netcdf_libs()" >> $LOGFILE
957      cat <<EOF > genmake_tnc.F      cat <<EOF > genmake_tnc.F
958        program fgennc        program fgennc
959  #include "netcdf.inc"  #include "netcdf.inc"
# Line 957  EOF Line 971  EOF
971        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
972        end        end
973  EOF  EOF
974      echo "===  genmake_tnc.F  ===" > genmake_tnc.log      echo "===  genmake_tnc.F  >>>" > genmake_tnc.log
975      cat genmake_tnc.F >> genmake_tnc.log      cat genmake_tnc.F >> genmake_tnc.log
976      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log      echo "<<<  genmake_tnc.F  ===" >> genmake_tnc.log
977      RET_CPP=f      RET_CPP=f
978      COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES"      COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES"
979      echo "$COMM" >> genmake_tnc.log      echo "$COMM" >> genmake_tnc.log
# Line 975  EOF Line 989  EOF
989      $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \      $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
990          &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1          &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1
991      RET_COMPILE=$?      RET_COMPILE=$?
992      cat genmake_tnc.log >> genmake_warnings      cat genmake_tnc.log >> $LOGFILE
993    
994      #EH3  Remove test program execution for machines that either disallow      #EH3  Remove test program execution for machines that either disallow
995      #EH3  execution or cannot support it (eg. cross-compilers)      #EH3  execution or cannot support it (eg. cross-compilers)
# Line 986  EOF Line 1000  EOF
1000    
1001      if test "x$RET_COMPILE" = x0 ; then      if test "x$RET_COMPILE" = x0 ; then
1002          HAVE_NETCDF=t          HAVE_NETCDF=t
1003            echo "check_netcdf: successful" >> $LOGFILE
1004      else      else
1005          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
1006          echo "try again with added '-lnetcdf'" > genmake_tnc.log          echo "==> try again with added '-lnetcdf'" > genmake_tnc.log
1007          echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log          echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log
1008          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
1009          echo " &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log          echo " &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log
# Line 996  EOF Line 1011  EOF
1011              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
1012              &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1              &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1
1013          RET_COMPILE=$?          RET_COMPILE=$?
1014          cat genmake_tnc.log >> genmake_warnings          echo >> $LOGFILE
1015            cat genmake_tnc.log >> $LOGFILE
1016          if test "x$RET_COMPILE" = x0 ; then          if test "x$RET_COMPILE" = x0 ; then
1017              LIBS="$LIBS -lnetcdf"              LIBS="$LIBS -lnetcdf"
1018              HAVE_NETCDF=t              HAVE_NETCDF=t
1019                echo "check_netcdf: successful" >> $LOGFILE
1020          else          else
1021          # try again with "-lnetcdff" added to the libs          # try again with "-lnetcdff" added to the libs
1022              echo "try again with added '-lnetcdff -lnetcdf'" > genmake_tnc.log              echo "==> try again with added '-lnetcdff -lnetcdf'" > genmake_tnc.log
1023              echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log              echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log
1024              echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log              echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
1025              echo " &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log              echo " &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log
# Line 1010  EOF Line 1027  EOF
1027                  &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \                  &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
1028                  &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdff -lnetcdf >> genmake_tnc.log 2>&1                  &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdff -lnetcdf >> genmake_tnc.log 2>&1
1029              RET_COMPILE=$?              RET_COMPILE=$?
1030              cat genmake_tnc.log >> genmake_warnings              echo >> $LOGFILE
1031                cat genmake_tnc.log >> $LOGFILE
1032              if test "x$RET_COMPILE" = x0 ; then              if test "x$RET_COMPILE" = x0 ; then
1033                  LIBS="$LIBS -lnetcdff -lnetcdf"                  LIBS="$LIBS -lnetcdff -lnetcdf"
1034                  HAVE_NETCDF=t                  HAVE_NETCDF=t
1035                    echo "check_netcdf: successful" >> $LOGFILE
1036              fi              fi
1037          fi          fi
1038      fi      fi
1039      rm -f genmake_tnc*      rm -f genmake_tnc*
1040        echo " --> set HAVE_NETCDF='$HAVE_NETCDF'" >> $LOGFILE
1041  }  }
1042    
1043    
# Line 1043  ENABLE= Line 1063  ENABLE=
1063  DISABLE=  DISABLE=
1064  # MAKEFILE=  # MAKEFILE=
1065  # MAKEDEPEND=  # MAKEDEPEND=
1066  PDEPEND=  PKG_DEPEND=
1067  DUMPSTATE=t  PKG_GROUPS=
1068  PDEFAULT=  DUMPSTATE=f
1069  OPTFILE=  OPTFILE=
1070  INCLUDES="-I. $INCLUDES"  INCLUDES="-I. $INCLUDES"
1071  FFLAGS=  FFLAGS=
# Line 1065  MPI= Line 1085  MPI=
1085  MPIPATH=  MPIPATH=
1086  OMP=  OMP=
1087  OMPFLAG=  OMPFLAG=
1088    USE_R4=
1089  TS=  TS=
1090  PAPIS=  PAPIS=
1091  PCLS=  PCLS=
# Line 1129  FTL_TAF_FLAGS= Line 1150  FTL_TAF_FLAGS=
1150  SVD_TAMC_FLAGS=  SVD_TAMC_FLAGS=
1151  TAMC_EXTRA=  TAMC_EXTRA=
1152    
   
1153  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1154  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PKG_DEPEND PKG_GROUPS MAKEFILE MAKEDEPEND PLATFORM ROOTDIR MODS DISABLE ENABLE"
1155  gm_s2="FC CPP IEEE TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS"  gm_s2="FC IEEE USE_R4 TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI OMP DUMPSTATE STANDARDDIRS"
1156    
1157  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1158  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM FEXTRAFLAGS"  gm_s3="LN S64 LINK MAKE PACKAGES INCLUDES FFLAGS FOPTIM FEXTRAFLAGS"
1159  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"
1160  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD THISHOST THISUSER THISDATE THISVER MACHINE"
1161  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
1162  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME"  gm_s7="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME"
1163    
1164  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1165  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"  gm_s10="AUTODIFF_PKG_USED AD_OPTFILE TAMC TAF AD_TAMC_FLAGS AD_TAF_FLAGS"
# Line 1153  cat <<EOF Line 1173  cat <<EOF
1173    
1174  GENMAKE :  GENMAKE :
1175    
1176  A program for GENerating MAKEfiles for the MITgcm project.  For a  A program for GENerating MAKEfiles for the MITgcm project.
1177  quick list of options, use "genmake -h" or for more detail see:     For a quick list of options, use "genmake2 -h"
1178    or for more detail see the Developer's HOWTO manual at:
1179    http://mitgcm.org/devel_HOWTO/     http://mitgcm.org/public/docs.html
1180    
1181  EOF  EOF
1182    
1183    LOGFILE="genmake.log"
1184    #- clean-up previous genmake logfiles:
1185    rm -f genmake_state genmake_*optfile $LOGFILE
1186    
1187  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
1188  gm_local="genmake_local"  gm_local="genmake_local"
1189  printf "  getting local config information:  "  printf "  getting local config information:  "
# Line 1185  for ac_option in "$@" ; do Line 1209  for ac_option in "$@" ; do
1209          ac_prev=          ac_prev=
1210          continue          continue
1211      fi      fi
1212        
1213      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
1214        
1215      case $ac_option in      case $ac_option in
1216                    
1217          -help | --help | -h | --h)          -help | --help | -h | --h)
# Line 1206  for ac_option in "$@" ; do Line 1230  for ac_option in "$@" ; do
1230              AD_OPTFILE=$ac_optarg ;;              AD_OPTFILE=$ac_optarg ;;
1231                    
1232          -pdepend | --pdepend)          -pdepend | --pdepend)
1233              ac_prev=PDEPEND ;;              ac_prev=PKG_DEPEND ;;
1234          -pdepend=* | --pdepend=*)          -pdepend=* | --pdepend=*)
1235              PDEPEND=$ac_optarg ;;              PKG_DEPEND=$ac_optarg ;;
1236                    
1237          -pdefault | --pdefault)          -pgroups | --pgroups)
1238              ac_prev=PDEFAULT ;;              ac_prev=PKG_GROUPS ;;
1239          -pdefault=* | --pdefault=*)          -pgroups=* | --pgroups=*)
1240              PDEFAULT=$ac_optarg ;;              PKG_GROUPS=$ac_optarg ;;
1241                    
1242          -make | --make | -m | --m)          -make | --make | -m | --m)
1243              ac_prev=MAKE ;;              ac_prev=MAKE ;;
# Line 1297  for ac_option in "$@" ; do Line 1321  for ac_option in "$@" ; do
1321          -noieee | --noieee)          -noieee | --noieee)
1322              IEEE= ;;              IEEE= ;;
1323    
1324            -use_real4 | -use_r4 | -ur4 | --use_real4 | --use_r4 | --ur4 )
1325                USE_R4=true ;;
1326    
1327          -ts | --ts)          -ts | --ts)
1328              TS=true ;;              TS=true ;;
1329          -papis | --papis)          -papis | --papis)
# Line 1360  for ac_option in "$@" ; do Line 1387  for ac_option in "$@" ; do
1387              ;;              ;;
1388                    
1389      esac      esac
1390        
1391  done  done
1392    
1393    
# Line 1372  if test -f ./.genmakerc ; then Line 1399  if test -f ./.genmakerc ; then
1399      echo "    http://mitgcm.org/devel_HOWTO/"      echo "    http://mitgcm.org/devel_HOWTO/"
1400      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."
1401      echo "WARNING: ignore \"./.genmakerc\" and continue."      echo "WARNING: ignore \"./.genmakerc\" and continue."
1402      echo      echo
1403  fi  fi
1404    
1405  #  Find the MITgcm ${ROOTDIR}  #  Find the MITgcm ${ROOTDIR}
# Line 1422  if test "x${OPTFILE}" = x ; then Line 1449  if test "x${OPTFILE}" = x ; then
1449      if test "x$MITGCM_OF" = x ; then      if test "x$MITGCM_OF" = x ; then
1450          echo "Warning: no OPTFILE specified so we'll look for possible settings"          echo "Warning: no OPTFILE specified so we'll look for possible settings"
1451          printf "\n===  Searching for possible settings for OPTFILE  ===\n"          printf "\n===  Searching for possible settings for OPTFILE  ===\n"
1452          find_possible_configs          find_possible_optfile
1453      else      else
1454          OPTFILE=$MITGCM_OF          OPTFILE=$MITGCM_OF
1455      fi      fi
# Line 1437  if test "x$OPTFILE" != xNONE ; then Line 1464  if test "x$OPTFILE" != xNONE ; then
1464              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
1465              exit 1              exit 1
1466          fi          fi
1467          if test "x$DUMPSTATE" != xf ; then          if test "x$DUMPSTATE" = xt ; then
1468              cp -f $OPTFILE "genmake_optfile"              cp -f $OPTFILE "genmake_optfile"
1469          fi          fi
1470      else      else
# Line 1464  if test "x${AD_OPTFILE}" != xNONE ; then Line 1491  if test "x${AD_OPTFILE}" != xNONE ; then
1491              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
1492              exit 1              exit 1
1493          fi          fi
1494          if test "x$DUMPSTATE" != xf ; then          if test "x$DUMPSTATE" = xt ; then
1495              cp -f $AD_OPTFILE "genmake_ad_optfile"              cp -f $AD_OPTFILE "genmake_ad_optfile"
1496          fi          fi
1497      else      else
# Line 1492  Error: no Fortran compiler: please speci Line 1519  Error: no Fortran compiler: please speci
1519  EOF  EOF
1520      exit 1      exit 1
1521  fi  fi
1522    
1523  if test "x$CC" = x ; then  if test "x$CC" = x ; then
1524      CC=cc      look_for_C_compilers
1525    #   CC=cc
1526  #     cat <<EOF 1>&2  #     cat <<EOF 1>&2
1527  # Error: no C compiler: please specify using one of the following:  # Error: no C compiler: please specify using one of the following:
1528  #   1) within the options file ("CC=...") as specified by "-of=OPTFILE"  #   1) within the options file ("CC=...") as specified by "-of=OPTFILE"
# Line 1502  if test "x$CC" = x ; then Line 1531  if test "x$CC" = x ; then
1531  # EOF  # EOF
1532  #     exit 1  #     exit 1
1533  fi  fi
1534    
1535  if test "x$LINK" = x ; then  if test "x$LINK" = x ; then
1536      LINK=$FC      LINK=$FC
1537  fi  fi
# Line 1509  if test "x$MAKE" = x ; then Line 1539  if test "x$MAKE" = x ; then
1539      MAKE="make"      MAKE="make"
1540  fi  fi
1541  if test "x$CPP" = x ; then  if test "x$CPP" = x ; then
1542      CPP=cpp      CPP="cpp -traditional -P"
1543  fi  fi
1544  #EH3 === UGLY ===  #EH3 === UGLY ===
1545  #  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 1536  EOF Line 1566  EOF
1566  else  else
1567      rm -f test_cpp      rm -f test_cpp
1568  fi  fi
1569    
1570  look_for_makedepend  look_for_makedepend
1571    
1572    #  Check that soft-link command is set and usable
1573  if test "x$LN" = x ; then  if test "x$LN" = x ; then
1574      LN="ln -s"      LN="ln -s"
1575  fi  fi
# Line 1546  RETVAL=$? Line 1579  RETVAL=$?
1579  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
1580      cat <<EOF 1>&2      cat <<EOF 1>&2
1581    
1582  Error: The command "ln -s" failed -- please specify a working soft-link  Error: The command "$LN" failed -- please specify a working soft-link
1583    command in the optfile.    command in the optfile.
1584    
1585  EOF  EOF
# Line 1573  if test ! "x$OMP" = x ; then Line 1606  if test ! "x$OMP" = x ; then
1606        DEFINES="$DEFINES -DUSE_OMP_THREADING"        DEFINES="$DEFINES -DUSE_OMP_THREADING"
1607  fi  fi
1608    
1609    if test ! "x$USE_R4" = x ; then
1610          echo "  Turning on LET_RS_BE_REAL4 cpp flag"
1611          DEFINES="$DEFINES -DLET_RS_BE_REAL4"
1612    fi
1613    
1614  if test ! "x$TS" = x ; then  if test ! "x$TS" = x ; then
1615        echo "  Turning on timing per timestep"        echo "  Turning on timing per timestep"
1616        if test ! "x$FOOLAD" = x ; then        if test ! "x$FOOLAD" = x ; then
# Line 1794  for d in $MODS ; do Line 1832  for d in $MODS ; do
1832  done  done
1833  echo  echo
1834    
1835  if test "x${PLATFORM}" = x ; then  #if test "x${PLATFORM}" = x ; then
1836      PLATFORM=$p_PLATFORM  #    PLATFORM=$p_PLATFORM
1837  fi  #fi
1838    
1839  if test "x${EXEDIR}" = x ; then  if test "x${EXEDIR}" = x ; then
1840      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`
# Line 1836  ERROR: neither of the two default script Line 1874  ERROR: neither of the two default script
1874      ${TOOLSDIR}/set64bitConst.sh      ${TOOLSDIR}/set64bitConst.sh
1875      ${TOOLSDIR}/set64bitConst.csh      ${TOOLSDIR}/set64bitConst.csh
1876    
1877    are working so please check paths or specify (with \$S64) a    are working so please check paths or specify (with \$S64) a
1878    working version of this script.    working version of this script.
1879    
1880  EOF  EOF
# Line 1848  THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSD Line 1886  THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSD
1886    
1887  EXECUTABLE=${EXECUTABLE:-mitgcmuv}  EXECUTABLE=${EXECUTABLE:-mitgcmuv}
1888    
1889    #  Set Standard Code Directories:
1890    if test "x$STANDARDDIRS" = xUSE_THE_DEFAULT ; then
1891        STANDARDDIRS="eesupp model"
1892    fi
1893    #  if model in Standard-Code-Dir, add eesupp (needed to compile model)
1894    echo " $STANDARDDIRS " | grep ' model ' > /dev/null 2>&1
1895    ckM=$?
1896    echo " $STANDARDDIRS " | grep ' eesupp ' > /dev/null 2>&1
1897    ckE=$?
1898    if test $ckM = 0 -a $ckE = 1 ; then
1899        STANDARDDIRS="$STANDARDDIRS eesupp"
1900    fi
1901    
1902  #  We have a special set of source files in eesupp/src which are  #  We have a special set of source files in eesupp/src which are
1903  #  generated from some template source files. We'll make them first so  #  generated from some template source files. We'll make them first so
1904  #  they appear as regular source code  #  they appear as regular source code
1905  if test -r $ROOTDIR"/eesupp/src/Makefile" ; then  if test -r $ROOTDIR"/eesupp/src/Makefile" ; then
1906      echo "  Making source files in eesupp from templates"      echo "  Making source files in eesupp from templates"
1907      ( cd $ROOTDIR"/eesupp/src/" && $MAKE ) > make_eesupp.errors 2>&1      ( cd $ROOTDIR"/eesupp/src/" && $MAKE clean_old && $MAKE \
1908        ) > make_eesupp.errors 2>&1
1909      RETVAL=$?      RETVAL=$?
1910      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
1911          rm -f make_eesupp.errors          rm -f make_eesupp.errors
# Line 1868  fi Line 1920  fi
1920  for pdir in exch2 regrid ; do  for pdir in exch2 regrid ; do
1921      if test -r $ROOTDIR"/pkg/${pdir}/Makefile" ; then      if test -r $ROOTDIR"/pkg/${pdir}/Makefile" ; then
1922          echo "  Making source files in pkg/${pdir} from templates"          echo "  Making source files in pkg/${pdir} from templates"
1923          ( cd $ROOTDIR"/pkg/"${pdir} && $MAKE ) > make_${pdir}.errors 2>&1          ( cd $ROOTDIR"/pkg/"${pdir} && $MAKE clean_old && $MAKE \
1924            ) > make_${pdir}.errors 2>&1
1925          RETVAL=$?          RETVAL=$?
1926          if test "x${RETVAL}" = x0 ; then          if test "x${RETVAL}" = x0 ; then
1927              rm -f make_${pdir}.errors              rm -f make_${pdir}.errors
# Line 1881  for pdir in exch2 regrid ; do Line 1934  for pdir in exch2 regrid ; do
1934  done  done
1935    
1936  printf "\n===  Determining package settings  ===\n"  printf "\n===  Determining package settings  ===\n"
1937  if  test "x${PDEPEND}" = x ; then  if  test "x${PKG_DEPEND}" = x ; then
1938      tmp=$ROOTDIR"/pkg/pkg_depend"      tmp=$ROOTDIR"/pkg/pkg_depend"
1939      if test -r $tmp ; then      if test -r $tmp ; then PKG_DEPEND=$tmp ; fi
1940          PDEPEND=$tmp  fi
1941      else  if  test "x${PKG_DEPEND}" = x ; then
1942          echo "Warning:  No package dependency information was specified."          echo "Warning:  No package dependency information was specified."
1943          echo "  Please check that ROOTDIR/pkg/pkg_depend exists."          echo "  Please check that ROOTDIR/pkg/pkg_depend exists."
     fi  
1944  else  else
1945      if test ! -r ${PDEPEND} ; then      if test ! -r ${PKG_DEPEND} ; then
1946          echo "Error:  can't read package dependency info from PDEPEND=\"$PDEPEND\""          echo "Error:  can't read package dependency info from PKG_DEPEND=\"$PKG_DEPEND\""
1947          exit 1          exit 1
1948      fi      fi
1949        echo "  getting package dependency info from  $PKG_DEPEND"
1950    #  Strip the comments and then convert the dependency file into arrays: PNAME, DNAME
1951        get_pdepend_list $PKG_DEPEND
1952  fi  fi
1953  echo "  getting package dependency info from  $PDEPEND"  
1954  #  Strip the comments and then convert the dependency file into  # A default package groups file "$ROOTDIR/pkg/pkg_groups" is provided
1955  #  two arrays: PNAME, DNAME  #  to define the "default_pkg_list" and package groups (for convenience, one
1956  cat $PDEPEND | sed -e 's/#.*$//g' \  #  can specify a group of packages using names like "ocean" and "atmosphere").
1957      | $AWK 'BEGIN{nn=-1;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME_"nn"="$1"\nDNAME_"nn"="$i}} END{print "nname="nn}' \  if test "x${PKG_GROUPS}" = x ; then
1958      > ./.pd_tmp      tmp=$ROOTDIR"/pkg/pkg_groups"
1959  RETVAL=$?      if test -r $tmp ; then PKG_GROUPS=$tmp ; fi
1960  if test ! "x${RETVAL}" = x0 ; then  fi
1961      echo "Error: unable to parse package dependencies -- please check PDEPEND=\"$PDEPEND\""  if test "x${PKG_GROUPS}" = x ; then
1962      exit 1          echo "Warning:  No package groups information was specified."
1963            echo "  Please check that ROOTDIR/pkg/pkg_groups exists."
1964    else
1965        if test ! -r ${PKG_GROUPS} ; then
1966            echo "Error:  can't read package groups info from PKG_GROUPS=\"$PKG_GROUPS\""
1967            exit 1
1968        fi
1969        echo "  getting package groups info from      $PKG_GROUPS"
1970  fi  fi
 . ./.pd_tmp  
 rm -f ./.pd_tmp  
1971    
1972  #  Search for default packages.  Note that a "$ROOTDIR/pkg/pkg_groups"  #  Search for packages to compile.
1973  #  file should eventually be added so that, for convenience, one can  echo "  checking list of packages to compile:"
1974  #  specify groups of packages using names like "ocean" and "atmosphere".  PKG_LIST=
1975  echo "  checking default package list:  "  if test "x${PKG_LIST}" = x ; then
 if test "x${PDEFAULT}" = x ; then  
1976      for i in "." $MODS ; do      for i in "." $MODS ; do
1977          if test -r $i"/packages.conf" ; then          if test -r $i"/packages.conf" ; then
1978                  PDEFAULT=$i"/packages.conf"                  PKG_LIST=$i"/packages.conf"
1979                  break                  break
1980          fi          fi
1981      done      done
1982  fi  fi
1983  if test "x${PDEFAULT}" = x ; then  if test "x${PKG_LIST}" = x ; then
1984      PDEFAULT="$ROOTDIR/pkg/pkg_default"      pkg_list='default_pkg_list'
1985  fi      if test "x${PKG_GROUPS}" = x ; then
1986  if test "x${PDEFAULT}" = xNONE ; then          echo "Error:  need package groups info to expand pkg_list=\"$pkg_list\""
1987      echo "    default packages file disabled"          exit 1
1988        fi
1989  else  else
1990      if test ! -r $PDEFAULT ; then      if test ! -r $PKG_LIST ; then
1991          echo "Warning:  can't read default packages from PDEFAULT=\"$PDEFAULT\""          echo "Error:  can't read package list from PKG_LIST=\"$PKG_LIST\""
1992            exit 1
1993      else      else
1994          echo "    using PDEFAULT=\"$PDEFAULT\""          echo "    using PKG_LIST=\"$PKG_LIST\""
1995          #  Strip the comments and add all the names          #  Strip the comments and add all the names
1996          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`          pkg_list=`cat $PKG_LIST | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`
1997          RETVAL=$?          RETVAL=$?
1998          if test "x${RETVAL}" != x0 ; then          if test "x${RETVAL}" != x0 ; then
1999              printf "Error: can't parse default package list "              printf "Error: can't parse package list "
2000              echo "-- please check PDEFAULT=\"$PDEFAULT\""              echo "-- please check PKG_LIST=\"$PKG_LIST\""
2001              exit 1              exit 1
2002          fi          fi
         for i in $def ; do  
             PACKAGES="$PACKAGES $i"  
         done  
         echo "    before group expansion packages are: $PACKAGES"  
         RET=1  
         while test $RET = 1 ; do expand_pkg_groups; RET=$?; done  
         echo "    after group expansion packages are:  $PACKAGES"  
2003      fi      fi
2004  fi  fi
2005    for i in $pkg_list ; do
2006        PACKAGES="$PACKAGES $i"
2007    done
2008    echo     "    before group expansion packages are:$PACKAGES"
2009    if test "x${PKG_GROUPS}" != x ; then
2010        RET=1
2011        while test $RET = 1 ; do expand_pkg_groups; RET=$?; done
2012        echo "    after group expansion packages are: $PACKAGES"
2013    fi
2014    
2015  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
2016    echo "" > ./.tmp_pack
2017  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2018      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
2019  done  done
# Line 1977  PACKAGES="$PACKAGES $ENABLE" Line 2041  PACKAGES="$PACKAGES $ENABLE"
2041  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2042      j=`echo $i | sed 's/[-+]//'`      j=`echo $i | sed 's/[-+]//'`
2043      if test ! -d "$ROOTDIR/pkg/$j" ; then      if test ! -d "$ROOTDIR/pkg/$j" ; then
2044          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"
2045          exit 1          exit 1
2046      fi      fi
2047      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
# Line 1987  for i in `grep -v "-" ./.tmp_pack | sort Line 2051  for i in `grep -v "-" ./.tmp_pack | sort
2051      PACKAGES="$PACKAGES $i"      PACKAGES="$PACKAGES $i"
2052  done  done
2053  rm -f ./.tmp_pack  rm -f ./.tmp_pack
2054  echo "    packages are:  $PACKAGES"  echo "    packages are: $PACKAGES"
2055    
2056  #  Check for package MNC: if NetCDF is available, then build the MNC  #  Check for package MNC: if NetCDF is available, then build the MNC
2057  #  template files ; otherwise, delete mnc from the list of packages.  #  template files ; otherwise, delete mnc from the list of packages.
2058  echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1  echo " $PACKAGES " | grep ' mnc ' > /dev/null 2>&1
2059  RETVAL=$?  mnc_in=$?
2060  if test "x$RETVAL" = x0 ; then  if test "x$HAVE_NETCDF" != xt ; then
2061      if test "x$HAVE_NETCDF" != xt ; then      if test "x$mnc_in" = x0 ; then
2062          cat <<EOF          cat <<EOF
   
2063  *********************************************************************  *********************************************************************
2064  WARNING: the "mnc" package was enabled but tests failed to compile  WARNING: the "mnc" package was enabled but tests failed to compile
2065    NetCDF applications.  Please check that:    NetCDF applications.  Please check that:
2066    
2067    1) NetCDF is correctly installed for this compiler and    1) NetCDF is correctly installed for this compiler and
2068    2) the LIBS variable (within the "optfile") specifies the correct    2) the LIBS variable (within the "optfile") specifies the correct
2069         NetCDF library to link against.         NetCDF library to link against.
2070    
2071    Due to this failure, the "mnc" package is now DISABLED.    Due to this failure, the "mnc" package is now DISABLED.
2072  *********************************************************************  *********************************************************************
   
2073  EOF  EOF
2074          PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`          PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`
2075          DISABLE="$DISABLE mnc"          DISABLE="$DISABLE mnc"
2076      else      else
2077          ( cd $ROOTDIR"/pkg/mnc" && $MAKE testclean && $MAKE templates ) > make_mnc.errors 2>&1      #  this prevent to add mnc (due to pdepend rules) if not available
2078          RETVAL=$?          DISABLE="$DISABLE mnc"
2079          if test "x${RETVAL}" = x0 ; then      fi
2080              rm -f make_mnc.errors  else
2081        # we have NetCDF, we try to build MNC template files
2082        ( cd $ROOTDIR"/pkg/mnc" && $MAKE testclean && $MAKE templates ) > make_mnc.errors 2>&1
2083        RETVAL=$?
2084        if test "x${RETVAL}" = x0 ; then
2085            rm -f make_mnc.errors
2086        else
2087            echo "Error: problem encountered while building source files in pkg/mnc:"
2088            cat make_mnc.errors 1>&2
2089            if test "x$mnc_in" = x0 ; then
2090                exit 1
2091          else          else
2092              echo "Error: problem encountered while building source files in pkg/mnc:"              DISABLE="$DISABLE mnc"
             cat make_mnc.errors 1>&2  
             exit 1  
2093          fi          fi
2094      fi      fi
2095  fi  fi
2096    
2097  #  Check for package PROFILES: if NetCDF is not available,  #  Check for package PROFILES: if NetCDF is not available,
2098  #  then delete profiles from the list of available packages.  #  then delete profiles from the list of available packages.
2099  echo $PACKAGES | grep ' profiles ' > /dev/null 2>&1  if test "x$HAVE_NETCDF" != xt ; then
2100  RETVAL=$?      echo " $PACKAGES " | grep ' profiles ' > /dev/null 2>&1
2101  if test "x$RETVAL" = x0 ; then      RETVAL=$?
2102      if test "x$HAVE_NETCDF" != xt ; then      if test "x$RETVAL" = x0 ; then
2103          cat <<EOF          cat <<EOF
   
2104  *********************************************************************  *********************************************************************
2105  WARNING: the "profiles" package was enabled but tests failed to  WARNING: the "profiles" package was enabled but tests failed to
2106    compile NetCDF applications.  Please check that:    compile NetCDF applications.  Please check that:
2107    
2108    1) NetCDF is correctly installed for this compiler and    1) NetCDF is correctly installed for this compiler and
2109    2) the LIBS variable (within the "optfile") specifies the correct    2) the LIBS variable (within the "optfile") specifies the correct
2110         NetCDF library to link against.         NetCDF library to link against.
2111    
2112    Due to this failure, the "profiles" package is now DISABLED.    Due to this failure, the "profiles" package is now DISABLED.
2113  *********************************************************************  *********************************************************************
   
2114  EOF  EOF
2115          PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`          PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`
2116          DISABLE="$DISABLE profiles"          DISABLE="$DISABLE profiles"
2117        else
2118        #  this prevent to add profiles (due to pdepend rules) if not available
2119            DISABLE="$DISABLE profiles"
2120      fi      fi
2121  fi  fi
2122    
2123  echo "  applying package dependency rules"  if  test "x${PKG_DEPEND}" != x ; then
2124  ck=    echo "  applying package dependency rules"
2125  while test "x$ck" != xtt ; do    ck=
2126      while test "x$ck" != xtt ; do
2127      i=0      i=0
2128      # rtot=${#PNAME[@]}      # rtot=${#PNAME[@]}
2129      rtot=$nname      rtot=$nname
# Line 2067  while test "x$ck" != xtt ; do Line 2139  while test "x$ck" != xtt ; do
2139                  pin="t"                  pin="t"
2140              fi              fi
2141          done          done
2142            #  or in the current $STANDARDDIRS list?
2143            for p in $STANDARDDIRS ; do
2144                if test "x$p" = "x$pname" ; then pin="t" ; fi
2145            done
2146    
2147          #  Is the DNAME entry a (+) or (-) rule ?          #  Is the DNAME entry a (+) or (-) rule ?
2148          tmp="dname=\"\$DNAME_$i\""          tmp="dname=\"\$DNAME_$i\""
# Line 2110  while test "x$ck" != xtt ; do Line 2186  while test "x$ck" != xtt ; do
2186          #  Do we need to get rid of $dname according to the dependency rules?          #  Do we need to get rid of $dname according to the dependency rules?
2187          if test "x$pin" = xt -a "x$plus" = "x-" -a "x$din" = xt; then          if test "x$pin" = xt -a "x$plus" = "x-" -a "x$din" = xt; then
2188              echo "Error: can't satisfy package dependencies:"              echo "Error: can't satisfy package dependencies:"
2189              echo "  \"$pname\" was requested but is disallowed by"              echo "  \"$pname\" was requested but is disallowed by"
2190              echo "  the dependency rules for \"$dname\""              echo "  the dependency rules for \"$dname\""
2191              exit 1              exit 1
2192          fi          fi
# Line 2118  while test "x$ck" != xtt ; do Line 2194  while test "x$ck" != xtt ; do
2194          #i=$(( $i + 1 ))          #i=$(( $i + 1 ))
2195      done      done
2196      ck=$ck"t"      ck=$ck"t"
2197  done    done
2198  echo "    packages are:  $PACKAGES"    echo "    packages are: $PACKAGES"
2199    fi
2200  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2201      adr="$ROOTDIR/pkg/$i"      adr="$ROOTDIR/pkg/$i"
2202      if test -d $adr ; then      if test -d $adr ; then
# Line 2136  done Line 2213  done
2213    
2214  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
2215  PACKAGES_DOT_H=PACKAGES_CONFIG.h  PACKAGES_DOT_H=PACKAGES_CONFIG.h
2216  #  The following UGLY HACK sets multiple "#undef"s and it needs to go  #  The following UGLY HACK sets multiple "#undef"s and it needs to go
2217  #  away.  On 2003-08-12, CNH, JMC, and EH3 agreed that the CPP_OPTIONS.h  #  away.  On 2003-08-12, CNH, JMC, and EH3 agreed that the CPP_OPTIONS.h
2218  #  file would eventually be split up so that all package-related #define  #  file would eventually be split up so that all package-related #define
2219  #  statements could be separated and handled only by genmake.  #  statements could be separated and handled only by genmake.
2220  names=`ls -1 "$ROOTDIR/pkg"`  names=`ls -1 "$ROOTDIR/pkg"`
# Line 2165  for i in $PACKAGES ; do Line 2242  for i in $PACKAGES ; do
2242  #eh3 DEFINES="$DEFINES -D$def"  #eh3 DEFINES="$DEFINES -D$def"
2243    
2244  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
2245      case $i in      case $i in
2246          aim_v23)          aim_v23)
2247              ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM"              ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM"
2248              echo "Warning: ALLOW_AIM is set to enable aim_v23."              echo "Warning: ALLOW_AIM is set to enable aim_v23."
# Line 2175  for i in $PACKAGES ; do Line 2252  for i in $PACKAGES ; do
2252    
2253  done  done
2254    
2255  echo "  Adding STANDARDDIRS"  echo "  Adding STANDARDDIRS='$STANDARDDIRS'"
2256  BUILDDIR=${BUILDDIR:-.}  BUILDDIR=${BUILDDIR:-.}
 if test "x$STANDARDDIRS" = xUSE_THE_DEFAULT ; then  
     STANDARDDIRS="eesupp model"  
 fi  
2257  if test "x$STANDARDDIRS" != x ; then  if test "x$STANDARDDIRS" != x ; then
2258      for d in $STANDARDDIRS ; do      for d in $STANDARDDIRS ; do
2259          adr="$ROOTDIR/$d/src"          adr="$ROOTDIR/$d/src"
# Line 2238  if test -f ./adSrcFiles.tmp ; then Line 2312  if test -f ./adSrcFiles.tmp ; then
2312      rm -f ./adSrcFiles.tmp      rm -f ./adSrcFiles.tmp
2313  fi  fi
2314  echo "  Creating the list of files for the adjoint compiler."  echo "  Creating the list of files for the adjoint compiler."
2315    touch adSrcFiles.tmp
2316  for i in $SOURCEDIRS ; do  for i in $SOURCEDIRS ; do
2317      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`
2318      for j in $list_files ; do      for j in $list_files ; do
# Line 2270  if test ! "x$DIVA" = x ; then Line 2345  if test ! "x$DIVA" = x ; then
2345          fi          fi
2346          MPIINCLUDEDIR='$MPIHOME/include'          MPIINCLUDEDIR='$MPIHOME/include'
2347      fi      fi
2348        
2349      if test -r $MPIINCLUDEDIR/mpif.h ; then      if test -r $MPIINCLUDEDIR/mpif.h ; then
2350          for i in $MPI_HEADER_FILES; do          for i in $MPI_HEADER_FILES; do
2351              cp -p $MPIINCLUDEDIR/$i ./mpi_headers              cp -p $MPIINCLUDEDIR/$i ./mpi_headers
# Line 2305  if test ! -r ".links.tmp/foo" ; then Line 2380  if test ! -r ".links.tmp/foo" ; then
2380  fi  fi
2381  rm -f .links.tmp/foo  rm -f .links.tmp/foo
2382    
2383  if test "x$OPENAD" != x ; then  if test "x$OPENAD" != x ; then
2384      OAD_DONT_COMPILE="/dev/null"      OAD_DONT_COMPILE="/dev/null"
2385      OAD_DONT_TRANSFORM="/dev/null"      OAD_DONT_TRANSFORM="/dev/null"
2386      OAD_KEEP_ORIGINAL="/dev/null"      OAD_KEEP_ORIGINAL="/dev/null"
# Line 2358  for d in $alldirs ; do Line 2433  for d in $alldirs ; do
2433      deplist=      deplist=
2434      sfiles=`( cd $d; echo *.[h,c,F] *.flow )`      sfiles=`( cd $d; echo *.[h,c,F] *.flow )`
2435      sfiles=`( echo $sfiles; cd $d; echo *.F90 )`      sfiles=`( echo $sfiles; cd $d; echo *.F90 )`
2436      if test "x$OPENAD" != x ; then      if test "x$OPENAD" != x ; then
2437          sfiles=`( echo $sfiles | grep -v _cb2m\. )`          sfiles=`( echo $sfiles | grep -v _cb2m\. )`
2438      fi      fi
2439      for sf in $sfiles ; do      for sf in $sfiles ; do
# Line 2398  for d in $alldirs ; do Line 2473  for d in $alldirs ; do
2473                        F)                        F)
2474                          echo    " \\"  >> F77srclist.tmp                          echo    " \\"  >> F77srclist.tmp
2475                          printf " $sf" >> F77srclist.tmp                          printf " $sf" >> F77srclist.tmp
2476                          if test "x$OPENAD" != x ; then                          if test "x$OPENAD" != x ; then
2477                              basename=${sf%%.F}                              basename=${sf%%.F}
2478                              isAD=`egrep ^$basename.f'[  ]*' adSrcFiles.tmp`                              isAD=`egrep ^$basename.f'[  ]*' adSrcFiles.tmp`
2479                              if test -z "$isAD" ; then                              if test -z "$isAD" ; then
2480                                  toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE}`                                  toBeIgnored=`egrep ^$basename'[      ]*' ${OAD_DONT_COMPILE}`
2481                                  if test -z "$toBeIgnored" ; then                                  if test -z "$toBeIgnored" ; then
2482                                      echo    " \\"  >> nonADF77srclist.tmp                                      echo    " \\"  >> nonADF77srclist.tmp
2483                                      printf " $sf" >> nonADF77srclist.tmp                                      printf " $sf" >> nonADF77srclist.tmp
2484                                  else                                  else
2485                                      echo "    not to be compiled   :  $sf"                                      echo "    not to be compiled   :  $sf"
2486                                  fi                                  fi
2487                              else # file is initially listed as an AD file we want to exclude it                              else # file is initially listed as an AD file we want to exclude it
2488                                   # or we want to retain the untransformed version                                   # or we want to retain the untransformed version
2489                                  notToBeTransformed=`egrep ^$basename'[      ]*' ${OAD_DONT_TRANSFORM}`                                  notToBeTransformed=`egrep ^$basename'[      ]*' ${OAD_DONT_TRANSFORM}`
2490                                  untransformedVersionToBeKept=`egrep ^$basename'[      ]*' ${OAD_KEEP_ORIGINAL}`                                  untransformedVersionToBeKept=`egrep ^$basename'[      ]*' ${OAD_KEEP_ORIGINAL}`
2491                                  if test -n "$notToBeTransformed"; then                                  if test -n "$notToBeTransformed"; then
2492                                      echo "    not to be transformed:  $sf"                                      echo "    not to be transformed:  $sf"
2493                                  fi                                  fi
2494                                  if test -n "$untransformedVersionToBeKept" ; then                                  if test -n "$untransformedVersionToBeKept" ; then
2495                                      echo "    original to be kept  :  $sf"                                      echo "    original to be kept  :  $sf"
2496                                  fi                                      fi
2497                                  if test -n "$notToBeTransformed" -o -n "$untransformedVersionToBeKept" ; then                                  if test -n "$notToBeTransformed" -o -n "$untransformedVersionToBeKept" ; then
2498                                      echo    " \\"  >> nonADF77srclist.tmp                                      echo    " \\"  >> nonADF77srclist.tmp
2499                                      printf " $sf" >> nonADF77srclist.tmp                                      printf " $sf" >> nonADF77srclist.tmp
# Line 2474  for xx in "$@" ; do nw=`echo $xx | wc -w Line 2549  for xx in "$@" ; do nw=`echo $xx | wc -w
2549  done  done
2550    
2551  if test -f $MAKEFILE ; then  if test -f $MAKEFILE ; then
2552      mv -f $MAKEFILE "$MAKEFILE.bak"      mv -f $MAKEFILE "$MAKEFILE.old"
2553  fi  fi
2554  echo "  Writing makefile: $MAKEFILE"  echo "  Writing makefile: $MAKEFILE"
2555  echo "# Multithreaded + multi-processing makefile for:" > $MAKEFILE  echo "# Multithreaded + multi-processing makefile for:" > $MAKEFILE
# Line 2493  EXE_SVD=$EXECUTABLE"_svd" Line 2568  EXE_SVD=$EXECUTABLE"_svd"
2568  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
2569  #  #
2570  # OPTFILE="$OPTFILE"  # OPTFILE="$OPTFILE"
2571  #  #
2572  # BUILDDIR     : Directory where object files are written  # BUILDDIR     : Directory where object files are written
2573  # SOURCEDIRS   : Directories containing the source (.F) files  # SOURCEDIRS   : Directories containing the source (.F) files
2574  # INCLUDEDIRS  : Directories containing the header-source (.h) files  # INCLUDEDIRS  : Directories containing the header-source (.h) files
# Line 2513  cat >>$MAKEFILE <<EOF Line 2588  cat >>$MAKEFILE <<EOF
2588  # LIBS         : Library flags /or/ additional optimization/debugging flags  # LIBS         : Library flags /or/ additional optimization/debugging flags
2589    
2590  ROOTDIR     = ${ROOTDIR}  ROOTDIR     = ${ROOTDIR}
2591  BUILDDIR    = ${BUILDDIR}    BUILDDIR    = ${BUILDDIR}
2592  SOURCEDIRS  = ${SOURCEDIRS}  SOURCEDIRS  = ${SOURCEDIRS}
2593  INCLUDEDIRS = ${INCLUDEDIRS}  INCLUDEDIRS = ${INCLUDEDIRS}
2594  EXEDIR      = ${EXEDIR}  EXEDIR      = ${EXEDIR}
# Line 2594  rm -f F77srclist.tmp nonADF77srclist.tmp Line 2669  rm -f F77srclist.tmp nonADF77srclist.tmp
2669    
2670  echo >> $MAKEFILE  echo >> $MAKEFILE
2671    
2672  # add definitions for preprocessed sources  # add definitions for preprocessed sources
2673  # and note that not all systems allow case sensitive extensions  # and note that not all systems allow case sensitive extensions
2674  # hence the $FS and $FS90 here.  # hence the $FS and $FS90 here.
2675  # for fixed format f90 files we use ff90 or FF90 resp  # for fixed format f90 files we use ff90 or FF90 resp
2676  # but these are not expected to be the original source files  # but these are not expected to be the original source files
2677    
2678  echo 'F77_PP_SRC_FILES = $(F77_SRC_FILES:.F=.'$FS')'      >> $MAKEFILE  echo 'F77_PP_SRC_FILES = $(F77_SRC_FILES:.F=.'$FS')'      >> $MAKEFILE
# Line 2634  output.txt: \$(EXECUTABLE) Line 2709  output.txt: \$(EXECUTABLE)
2709          @printf 'running ... '          @printf 'running ... '
2710          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
2711    
2712    # remove most of the files that "make" generates
2713  clean:  clean:
2714          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template
2715          -rm -rf *.o          -rm -rf *.o
2716          -rm -rf *.$FS *.flowdir          -rm -rf *.$FS *.flowdir
2717          -rm -rf *.f$FS90 \$(AD_CLEAN) ad_input*          -rm -rf *.f$FS90 \$(AD_CLEAN) ad_input*
2718    
2719    # remove most of the files that "make" and "make depend" generate
2720  Clean:  Clean:
2721          @make clean          @make clean
2722          @make cleanlinks          @make cleanlinks
2723          -rm -f \$(SPECIAL_FILES)          -rm -f \$(SPECIAL_FILES) f90mkdepend.log
         -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log f90mkdepend.log *.bak  
2724          -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
2725            -rm -f genmake_warnings genmake_errors make.log
2726    
2727    # remove also the executable, files that "genmake2" generates (except Makefile)
2728    #         and output from a run (plus log files from testreport)
2729  CLEAN:  CLEAN:
2730          @make Clean          @make Clean
2731            -rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak $MAKEFILE.old
2732            -rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log
2733          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
2734          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
2735          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
2736          -rm -f \$(EXECUTABLE) \$(EXE_AD) *.txt STD* *diagnostics.log datetime          -rm -f *.txt STD* *diagnostics.log datetime
2737          -rm -f *_MIT_CE_000.opt0000 costfunction*0000          -rm -f *_MIT_CE_000.opt0000 costfunction*0000
2738          -rm -rf mnc_test_*          -rm -rf mnc_test_*
2739    
 #eh3 Makefile: makefile  
2740  makefile:  makefile:
2741          $THIS_SCRIPT $G2ARGS          $THIS_SCRIPT $G2ARGS
2742  cleanlinks:  cleanlinks:
# Line 2685  if test "x$EMBED_SRC" = xt ; then Line 2767  if test "x$EMBED_SRC" = xt ; then
2767    
2768  decode_files.o : EMBEDDED_FILES.h  decode_files.o : EMBEDDED_FILES.h
2769    
2770  ##  \$(F77_PP_SRC_FILES)  ##  \$(F77_PP_SRC_FILES)
2771  all_fF.tar.gz : \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile  all_fF.tar.gz : \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile
2772          @echo Creating \$@ ...          @echo Creating \$@ ...
2773          -tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile          -tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(F77_SRC_FILES) \$(C_SRC_FILES) \$(H_SRC_FILES) \$(F90_SRC_FILES) \$(F77_PP_SRC_FILES) Makefile
# Line 2736  EOF Line 2818  EOF
2818  #===  Automatic Differentiation Rules  ===  #===  Automatic Differentiation Rules  ===
2819  #===  for TAMC/TAF  ======================  #===  for TAMC/TAF  ======================
2820    
2821  if test "x$OPENAD" = x ; then  if test "x$OPENAD" = x ; then
2822    
2823  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
2824    
# Line 2796  adtafonly: Line 2878  adtafonly:
2878          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS
2879    
2880  \${EXE_AD}: ad_taf_output.o \$(OBJFILES)  \${EXE_AD}: ad_taf_output.o \$(OBJFILES)
2881          \$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
2882    
2883  ad_tamc_output.$FS: ad_input_code.$FS  ad_tamc_output.$FS: ad_input_code.$FS
2884          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS
2885          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.$FS          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.$FS
2886    
2887  ad_tamc: ad_tamc_output.o \$(OBJFILES)  ad_tamc: ad_tamc_output.o \$(OBJFILES)
2888          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
2889    
2890  adonlyfwd:  adonlyfwd:
2891          patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff          patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff
2892    
2893  adtrick:  adtrick:
2894          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff          patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff
2895    
# Line 2835  ftltafonly: Line 2917  ftltafonly:
2917          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
2918    
2919  ftl_taf: ftl_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
2920          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
2921    
2922  ftl_tamc_output.$FS: ftl_input_code.$FS  ftl_tamc_output.$FS: ftl_input_code.$FS
2923          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS
2924          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.$FS          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.$FS
2925    
2926  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
2927          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
2928    
2929    
2930  # ... SVD ...  # ... SVD ...
# Line 2871  svd_touch: Line 2953  svd_touch:
2953    
2954  EOF  EOF
2955    
2956  fi  fi
2957    
2958  #===  for OpenAD  ========================  #===  for OpenAD  ========================
2959    
2960  if test "x$OPENAD" != x ; then  if test "x$OPENAD" != x ; then
2961    
2962  # ============ begin OpenAD specific section ==============  # ============ begin OpenAD specific section ==============
2963    
2964  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
2965    
2966  # all the source files linked from the various locations:  # all the source files linked from the various locations:
2967  ALL_LINKED_FILES= \  ALL_LINKED_FILES= \
2968  \$(F77_SRC_FILES) \  \$(F77_SRC_FILES) \
2969  \$(C_SRC_FILES) \  \$(C_SRC_FILES) \
# Line 2933  rm -f adSrcFiles.tmp Line 3015  rm -f adSrcFiles.tmp
3015    
3016  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
3017    
3018  adAll: \$(EXE_AD)  adAll: \$(EXE_AD)
3019  .PHONY: adAll  .PHONY: adAll
3020    
3021  CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod.f$FS90, \$(CB2M_F90_SRC_NAMES))  CB2M_F90_PP_SRC_FILES=\$(addsuffix _mod.f$FS90, \$(CB2M_F90_SRC_NAMES))
# Line 2951  w2f__types.F90 \ Line 3033  w2f__types.F90 \
3033  OAD_active.F90 \  OAD_active.F90 \
3034  OAD_cp.F90 \  OAD_cp.F90 \
3035  OAD_rev.F90 \  OAD_rev.F90 \
3036  OAD_tape.F90          OAD_tape.F90
3037    
3038  OPENAD_SUPPORT_C_SRC_FILES = \  OPENAD_SUPPORT_C_SRC_FILES = \
3039  iaddr.c \  iaddr.c \
# Line 2960  timeRatio.c Line 3042  timeRatio.c
3042  f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES:F90=$FS90)  f95_test_mods.f90: \$(OPENAD_SUPPORT_F90_SRC_FILES:F90=$FS90)
3043          cat \$^ > \$@          cat \$^ > \$@
3044    
3045  f95_test.f90: all_mods.xb.x2w.w2f.pp.f$FS90 \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90) ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90  f95_test.f90: all_mods.xb.x2w.w2f.pp.f$FS90 \$(NON_AD_F77_SRC_FILES:.F=_cb2m.f$FS90) ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90
3046          cat \$^ > \$@          cat \$^ > \$@
3047    
3048  f95_test.out: f95_test_mods.f90 f95_test.f90  f95_test.out: f95_test_mods.f90 f95_test.f90
3049          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
3050          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
3051    
3052  # the file included below is created by the  # the file included below is created by the
3053  # postProcessor and its inclusion sets the  # postProcessor and its inclusion sets the
3054  # variable POSTPROCESSEDFILES  # variable POSTPROCESSEDFILES
3055  # used below. Because the file is made during  # used below. Because the file is made during
3056  # make it won't be read until the second (recursive)  # make it won't be read until the second (recursive)
3057  # invocation in the rule below  # invocation in the rule below
3058  -include postProcess.make  -include postProcess.make
3059    
# Line 2997  endif Line 3079  endif
3079  openad: ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90  openad: ad_input_code.w2f.pre.xb.x2w.w2f.td.pp.f$FS90
3080  .PHONY: openad  .PHONY: openad
3081    
3082  # create the module files  # create the module files
3083  %_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk  %_mod.FF90 : %.h ../OAD_support/cb2mGetModules.csh ../OAD_support/cb2mGetModules.awk
3084          ../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk          ../OAD_support/cb2mGetModules.csh $< ../OAD_support/cb2mGetModules.awk
3085    
3086  # create the header files  # create the header files
3087  %_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk  %_mod.h : %.h ../OAD_support/cb2mGetHeaders.csh ../OAD_support/cb2mGetHeaders.awk
3088          ../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES)          ../OAD_support/cb2mGetHeaders.csh $< ../OAD_support/cb2mGetHeaders.awk \$(CB2M_F90_SRC_NAMES)
3089    
3090  # change everybody else to use the new module files:  # change everybody else to use the new module files:
# Line 3024  CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS9 Line 3106  CB2M_AD_FILES=\$(AD_FILES:.f=_cb2m.f$FS9
3106  ad_input_code.f$FS90:  \$(CB2M_AD_FILES)  ad_input_code.f$FS90:  \$(CB2M_AD_FILES)
3107          cat \$^ > \$@          cat \$^ > \$@
3108    
3109  # strip all comments and blanks to reduce  # strip all comments and blanks to reduce
3110  # the file size in order to reduce perl's memory requirements  # the file size in order to reduce perl's memory requirements
3111  ad_input_code_sf.f$FS90 : ad_input_code.f$FS90  ad_input_code_sf.f$FS90 : ad_input_code.f$FS90
3112          cat \$^ | sed -f ../OAD_support/strip.sed | sed -f ../OAD_support/stop2print.sed > \$@          cat \$^ | sed -f ../OAD_support/strip.sed | sed -f ../OAD_support/stop2print.sed > \$@
3113    
3114  # mfef90 preprocessing  # mfef90 preprocessing
3115  # expand statement functions  # expand statement functions
3116  # expose mfef90 specific substring handling  # expose mfef90 specific substring handling
3117  # add the w2f__types module  # add the w2f__types module
3118  ad_input_code_sf.w2f.f$FS90: ad_input_code_sf.f$FS90 mfef90 whirl2f whirl2f_be w2f__types.f90  ad_input_code_sf.w2f.f$FS90: ad_input_code_sf.f$FS90 mfef90 whirl2f whirl2f_be w2f__types.f90
3119          ./mfef90 -r8 -z -F -N132 \$<          ./mfef90 -r8 -z -F -N132 \$<
3120          mv \$<.B \$(basename \$<).B          mv \$<.B \$(basename \$<).B
3121          ./whirl2f -openad \$(basename \$<).B          ./whirl2f -openad \$(basename \$<).B
3122          cat w2f__types.f90 \$(basename \$<).w2f.f > \$@          cat w2f__types.f90 \$(basename \$<).w2f.f > \$@
3123    
# Line 3044  ad_input_code_sf.w2f.pre.f$FS90: ad_inpu Line 3126  ad_input_code_sf.w2f.pre.f$FS90: ad_inpu
3126          ./preProcess.py --timing --r8 -H -S \$< -o \$@          ./preProcess.py --timing --r8 -H -S \$< -o \$@
3127    
3128  # F -> WHIRL  # F -> WHIRL
3129  # note that the canonicalized version cuts off at col 72  # note that the canonicalized version cuts off at col 72
3130  # doing this also for string constants which is ok as long  # doing this also for string constants which is ok as long
3131  # as we are in fixed mode and cut of exactly there.  # as we are in fixed mode and cut of exactly there.
3132  # Otherwise mfef90 patches in spaces to fill up to 72 (or 132)  # Otherwise mfef90 patches in spaces to fill up to 72 (or 132)
3133  # characters respectively.  # characters respectively.
3134  ad_input_code_sf.w2f.pre.B: ad_input_code_sf.w2f.pre.f$FS90 mfef90  ad_input_code_sf.w2f.pre.B: ad_input_code_sf.w2f.pre.f$FS90 mfef90
3135          ./mfef90 -r8 -z -F \$<          ./mfef90 -r8 -z -F \$<
# Line 3067  ad_input_code_sf.w2f.pre.xb.x2w.B : ad_i Line 3149  ad_input_code_sf.w2f.pre.xb.x2w.B : ad_i
3149    
3150  # WHIRL' -> F'  # WHIRL' -> F'
3151  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.w2f.pre.xb.x2w.w2f.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.B whirl2f whirl2f_be
3152          ./whirl2f -FLIST:ftn_file=\$@ -openad \$<          ./whirl2f -FLIST:ftn_file=\$@ -openad \$<
3153    
3154  # insert template directives  # insert template directives
3155  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.w2f.pre.xb.x2w.w2f.td.f$FS90: ad_input_code_sf.w2f.pre.xb.x2w.w2f.f$FS90 ../OAD_support/insertTemplateDir.bash
# Line 3076  ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f Line 3158  ad_input_code_sf.w2f.pre.xb.x2w.w2f.td.f
3158  PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F  PPEXTRAS=\$(wildcard ../OAD_support/ad_template.*.F) ../OAD_support/ad_inline.F
3159  # postprocess F'  # postprocess F'
3160  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.w2f.pre.xb.x2w.w2f.td.f$FS90 postProcess.py \$(PPEXTRAS:.F=.f)
3161          # the target is a placeholder to signal execution of the rule          # the target is a placeholder to signal execution of the rule
3162          touch \$@          touch \$@
3163          # this step also creates the file postProcess.make but we cannot          # this step also creates the file postProcess.make but we cannot
3164          # name it as the target or else make will try to remake it for          # name it as the target or else make will try to remake it for
3165          # the include directive above for any rule, e.g. make clean          # the include directive above for any rule, e.g. make clean
3166          ./postProcess.py --progress --timing --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$<          ./postProcess.py --progress --timing --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$<
3167    
# Line 3087  postProcess.tag: ad_input_code_sf.w2f.pr Line 3169  postProcess.tag: ad_input_code_sf.w2f.pr
3169  %.xsd:  %.xsd:
3170          \$(LN) \${XAIFSCHEMAROOT}/schema/\$@ .          \$(LN) \${XAIFSCHEMAROOT}/schema/\$@ .
3171    
3172  mfef90:  mfef90:
3173          \$(LN) \${OPEN64ROOT}/crayf90/sgi/mfef90 .          \$(LN) \${OPEN64ROOT}/crayf90/sgi/mfef90 .
3174    
3175  # link the support files:  # link the support files:
3176  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES):  \$(OPENAD_SUPPORT_F90_SRC_FILES) \$(OPENAD_SUPPORT_C_SRC_FILES):
3177          \$(LN) ../OAD_support/\$@ .          \$(LN) ../OAD_support/\$@ .
3178    
3179  whirl2xaif xaif2whirl:  whirl2xaif xaif2whirl:
3180          \$(LN) \${OPENADFORTTK}/bin/\$@ .          \$(LN) \${OPENADFORTTK}/bin/\$@ .
3181    
3182  preProcess.py postProcess.py:  preProcess.py postProcess.py:
3183          \$(LN) \${OPENADFORTTK_BASE}/tools/SourceProcessing/\$@ .          \$(LN) \${OPENADFORTTK_BASE}/tools/SourceProcessing/\$@ .
3184    
3185  whirl2f whirl2f_be:  whirl2f whirl2f_be:
# Line 3151  printf "\n\n# DO NOT DELETE\n" >> $MAKEF Line 3233  printf "\n\n# DO NOT DELETE\n" >> $MAKEF
3233  printf "\n===  Done  ===\n"  printf "\n===  Done  ===\n"
3234    
3235  # Create special header files  # Create special header files
3236  $BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" $DISABLED_PACKAGES " " "Enabled packages:" $ENABLED_PACKAGES > $PACKAGES_DOT_H".tmp"  $BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" $DISABLED_PACKAGES " " "Enabled packages:" $ENABLED_PACKAGES > $PACKAGES_DOT_H".tmp"
3237  if test ! -f $PACKAGES_DOT_H ; then  if test ! -f $PACKAGES_DOT_H ; then
3238      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
3239  else  else
# Line 3170  fi Line 3252  fi
3252    
3253    
3254  #  Write the "state" for future records  #  Write the "state" for future records
3255  if test "x$DUMPSTATE" != xf ; then  if test "x$DUMPSTATE" = xt ; then
3256      printf "" > genmake_state      printf "" > genmake_state
3257      for i in $gm_state ; do      for i in $gm_state ; do
3258          t1="t2=\$$i"          t1="t2=\$$i"

Legend:
Removed from v.1.202  
changed lines
  Added in v.1.212

  ViewVC Help
Powered by ViewVC 1.1.22