/[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.206 by jmc, Sun May 23 18:34:43 2010 UTC revision 1.213 by jmc, Fri Nov 5 16:28:59 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 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() {
295        echo >> $LOGFILE
296      tmp1=`uname`"_"`uname -m`      echo "running: look_for_C_compilers()" >> $LOGFILE
297      tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`      rm -f ./genmake_hello.c  ./genmake_hello
298      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`      cat >> genmake_hello.c << EOF
     tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`  
     tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`  
     tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`  
     PLATFORM=$tmp3  
     echo $PLATFORM | grep cygwin > /dev/null 2>&1  &&  PLATFORM=cygwin_ia32  
     OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`  
     echo "  The platform appears to be:  $PLATFORM"  
   
     echo "test" > test  
     ln -s ./test link  
     RETVAL=$?  
     if test "x${RETVAL}" = x0 ; then  
         LN="ln -s"  
     else  
         echo "Error: \"ln -s\" does not appear to work on this system!"  
         echo "  For help, please contact <MITgcm-support@mitgcm.org>."  
         exit 1  
     fi  
     rm -f test link  
   
     if test "x$CPP" = x ; then  
         CPP="cpp -traditional -P"  
     fi  
   
     look_for_makedepend  
   
     #================================================================  
     #  look for possible C compilers  
     tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc"  
     p_CC=  
     for c in $tmp ; do  
         rm -f ./genmake_hello.c  ./genmake_hello  
         cat >> genmake_hello.c << EOF  
299  #include <stdio.h>  #include <stdio.h>
300  int main(int argc, char **argv) {  int main(int argc, char **argv) {
301    printf("Hello!\n");    printf("Hello!\n");
302    return 0;    return 0;
303  }  }
304  EOF  EOF
305          $c -o genmake_hello genmake_hello.c > /dev/null 2>&1      tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc"
306        p_CC=
307        for c in $tmp ; do
308            COMM="$c $CFLAGS -o genmake_hello genmake_hello.c"
309            echo $COMM >> $LOGFILE
310            $COMM >> $LOGFILE 2>&1
311          RETVAL=$?          RETVAL=$?
312          if test "x${RETVAL}" = x0 ; then          if test "x${RETVAL}" = x0 ; then
313                echo " $c test successful" >> $LOGFILE
314              p_CC="$p_CC $c"              p_CC="$p_CC $c"
315          fi          fi
316      done      done
# Line 354  Error: No C compilers were found in your Line 326  Error: No C compilers were found in your
326  EOF  EOF
327          exit 1          exit 1
328      else      else
329          echo "  The possible C compilers found in your path are:"          echo "  The possible C compilers found in your path are: $p_CC" | tee -a $LOGFILE
         echo "   "$p_CC  
330          if test "x$CC" = x ; then          if test "x$CC" = x ; then
331              CC=`echo $p_CC | $AWK '{print $1}'`              CC=`echo $p_CC | $AWK '{print $1}'`
332              echo "  Setting C compiler to: "$CC              echo "  Setting C compiler to: "$CC
333          fi          fi
334      fi      fi
335        echo " --> set CC='$CC'" >> $LOGFILE
336    }
337    
338    # Guess possible config options for this host
339    find_possible_optfile()  {
340    
341        tmp1=`uname`"_"`uname -m`
342        tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
343        tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
344        tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`
345        tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
346        tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`
347        PLATFORM=$tmp3
348        echo $PLATFORM | grep cygwin > /dev/null 2>&1  &&  PLATFORM=cygwin_ia32
349        OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
350        echo "  The platform appears to be:  $PLATFORM"
351    
352    #    echo "test" > test
353    #    ln -s ./test link
354    #    RETVAL=$?
355    #    if test "x${RETVAL}" = x0 ; then
356    #       LN="ln -s"
357    #    else
358    #       echo "Error: \"ln -s\" does not appear to work on this system!"
359    #       echo "  For help, please contact <MITgcm-support@mitgcm.org>."
360    #       exit 1
361    #    fi
362    #    rm -f test link
363    #
364    #    if test "x$CPP" = x ; then
365    #       CPP="cpp -traditional -P"
366    #    fi
367    #
368    #    look_for_makedepend
369    #
370    #    look_for_C_compilers
371    
372      #================================================================      #================================================================
373      #  look for possible FORTRAN compilers      #  look for possible FORTRAN compilers
# Line 416  EOF Line 423  EOF
423               echo "  I looked for the file "$OPTFILE" but did not find it"               echo "  I looked for the file "$OPTFILE" but did not find it"
424          fi          fi
425      fi      fi
426  #    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  
427      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
428          cat 1>&2 <<EOF          cat 1>&2 <<EOF
429    
# Line 484  get_pdepend_list()  { Line 481  get_pdepend_list()  {
481          > ./.pd_tmp          > ./.pd_tmp
482      RETVAL=$?      RETVAL=$?
483      if test ! "x${RETVAL}" = x0 ; then      if test ! "x${RETVAL}" = x0 ; then
484        echo "Error: unable to parse package dependencies -- please check PDEPEND=\"$1\""        echo "Error: unable to parse package dependencies -- please check PKG_DEPEND=\"$1\""
485        exit 1        exit 1
486      fi      fi
487      . ./.pd_tmp      . ./.pd_tmp
# Line 519  Usage: "$0" [OPTIONS] Line 516  Usage: "$0" [OPTIONS]
516        -pdepend=NAME | --pdepend=NAME        -pdepend=NAME | --pdepend=NAME
517            Get package dependency information from "NAME".            Get package dependency information from "NAME".
518    
519      -pdefault NAME | --pdefault NAME      -pgroups NAME | --pgroups NAME
520        -pdefault=NAME | --pdefault=NAME        -pgroups=NAME | --pgroups=NAME
521            Get the default package list from "NAME".            Get the package groups information from "NAME".
522    
523      -bash NAME      -bash NAME
524            Explicitly specify the Bourne or BASH shell to use            Explicitly specify the Bourne or BASH shell to use
# Line 657  get_fortran_c_namemangling()  { Line 654  get_fortran_c_namemangling()  {
654      if test ! "x$FC_NAMEMANGLE" = x ; then      if test ! "x$FC_NAMEMANGLE" = x ; then
655          return 0          return 0
656      fi      fi
657        echo " running: get_fortran_c_namemangling()" >> $LOGFILE
658    
659      default_nm="#define FC_NAMEMANGLE(X) X ## _"      default_nm="#define FC_NAMEMANGLE(X) X ## _"
660    
661      cat > genmake_test.c <<EOF      cat > genmake_test.c <<EOF
662  void tcall( char * string ) { tsub( string ); }  void tcall( char * string ) { tsub( string ); }
663  EOF  EOF
664      $MAKE genmake_test.o >> genmake_warnings 2>&1  #   $MAKE genmake_test.o >> $LOGFILE 2>&1
665        COMM="$CC $CFLAGS -c genmake_test.c"
666        echo ' '$COMM >> $LOGFILE
667        $COMM >> $LOGFILE 2>&1
668      RETVAL=$?      RETVAL=$?
669      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
670          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
671          cat <<EOF>> genmake_errors          cat <<EOF>> $LOGFILE
672    
673  WARNING: C test compile fails   WARNING: C test compile fails
674  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
675  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
676  EOF  EOF
677          return 1          return 1
678      fi      fi
# Line 679  EOF Line 680  EOF
680      RETVAL=$?      RETVAL=$?
681      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
682          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
683          cat <<EOF>> genmake_warnings          cat <<EOF>> $LOGFILE
684    
685  WARNING: The "nm" command failed.   WARNING: The "nm" command failed.
686  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
687  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
688  EOF  EOF
689          return 1          return 1
690      fi      fi
# Line 693  EOF Line 694  EOF
694        call tsub( string )        call tsub( string )
695        end        end
696  EOF  EOF
697      $FC $FFLAGS -c genmake_tcomp.$FS >> genmake_warnings 2>&1      COMM="$FC $FFLAGS -c genmake_tcomp.$FS"
698        echo ' '$COMM >> $LOGFILE
699        $COMM >> $LOGFILE 2>&1
700      RETVAL=$?      RETVAL=$?
701      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
702          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
703          cat <<EOF>> genmake_warnings          cat <<EOF>> $LOGFILE
704    
705  WARNING: FORTRAN test compile fails -- please see "genmake_errors"   WARNING: FORTRAN test compile fails -- please see '$LOGFILE'
706  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
707  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
708  EOF  EOF
709          return 1          return 1
710      fi      fi
# Line 709  EOF Line 712  EOF
712      RETVAL=$?      RETVAL=$?
713      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
714          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
715          cat <<EOF>> genmake_warnings          cat <<EOF>> $LOGFILE
716    
717  WARNING: The "nm" command failed.   WARNING: The "nm" command failed.
718  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'   WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
719  WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.   WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
720  EOF  EOF
721          return 1          return 1
722      fi      fi
# Line 739  EOF Line 742  EOF
742    
743      #  cleanup the testing files      #  cleanup the testing files
744      rm -f genmake_tcomp.* genmake_test.*      rm -f genmake_tcomp.* genmake_test.*
745    
746        echo " --> set FC_NAMEMANGLE='$FC_NAMEMANGLE'" >> $LOGFILE
747  }  }
748    
749    
750  check_HAVE_CLOC()  {  check_HAVE_CLOC()  {
751        echo >> $LOGFILE
752        echo "running: check_HAVE_CLOC()" >> $LOGFILE
753      get_fortran_c_namemangling      get_fortran_c_namemangling
754      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
755  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 760  void FC_NAMEMANGLE(cloc) ( double *curti Line 767  void FC_NAMEMANGLE(cloc) ( double *curti
767  }  }
768  EOF  EOF
769      COMM="$CC $CFLAGS -c genmake_tc_1.c"      COMM="$CC $CFLAGS -c genmake_tc_1.c"
770      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
771      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
772      RET_C=$?      RET_C=$?
773      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
774        program hello        program hello
# Line 772  EOF Line 779  EOF
779        end        end
780  EOF  EOF
781      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"
782      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
783      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
784      RET_F=$?      RET_F=$?
785      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1      test -x ./genmake_tc  &&  ./genmake_tc >> $LOGFILE 2>&1
786      RETVAL=$?      RETVAL=$?
787      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
788          HAVE_CLOC=t          HAVE_CLOC=t
789          DEFINES="$DEFINES -DHAVE_CLOC"          DEFINES="$DEFINES -DHAVE_CLOC"
790      fi      fi
791      rm -f genmake_tc*      rm -f genmake_tc*
792        echo " --> set HAVE_CLOC='$HAVE_CLOC'" >> $LOGFILE
793  }  }
794    
795    
# Line 789  check_HAVE_SIGREG()  { Line 797  check_HAVE_SIGREG()  {
797      if test ! "x$HAVE_SIGREG" = x ; then      if test ! "x$HAVE_SIGREG" = x ; then
798          return          return
799      fi      fi
800        echo >> $LOGFILE
801        echo "running: check_HAVE_SIGREG()" >> $LOGFILE
802      get_fortran_c_namemangling      get_fortran_c_namemangling
803      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
804  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 821  void FC_NAMEMANGLE(sigreg) (int * aip) Line 831  void FC_NAMEMANGLE(sigreg) (int * aip)
831  }  }
832  EOF  EOF
833      COMM="$CC $CFLAGS -c genmake_tc_1.c"      COMM="$CC $CFLAGS -c genmake_tc_1.c"
834      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
835      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
836      RET_C=$?      RET_C=$?
837      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
838        program hello        program hello
# Line 832  EOF Line 842  EOF
842        call sigreg(anint)        call sigreg(anint)
843        end        end
844  EOF  EOF
845      echo >> genmake_warnings      cat genmake_tc_2.$FS >> $LOGFILE
     echo "running: check_HAVE_SIGREG()" >> genmake_warnings  
     cat genmake_tc_2.$FS >> genmake_warnings  
846      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"
847      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
848      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
849      RETVAL=$?      RETVAL=$?
850      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
851          HAVE_SIGREG=t          HAVE_SIGREG=t
852          DEFINES="$DEFINES -DHAVE_SIGREG"          DEFINES="$DEFINES -DHAVE_SIGREG"
853      fi      fi
854      rm -f genmake_tc*      rm -f genmake_tc*
855        echo " --> set HAVE_SIGREG='$HAVE_SIGREG'" >> $LOGFILE
856  }  }
857    
858    
# Line 855  check_HAVE_SETRLSTK()  { Line 864  check_HAVE_SETRLSTK()  {
864      if test ! "x$HAVE_SETRLSTK" = x ; then      if test ! "x$HAVE_SETRLSTK" = x ; then
865          return          return
866      fi      fi
867        echo >> $LOGFILE
868        echo "running: check_HAVE_SETRLSTK()" >> $LOGFILE
869      get_fortran_c_namemangling      get_fortran_c_namemangling
870      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
871  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 871  void FC_NAMEMANGLE(setrlstk) () Line 882  void FC_NAMEMANGLE(setrlstk) ()
882  }  }
883  EOF  EOF
884      COMM="$CC $CFLAGS -c genmake_tc_1.c"      COMM="$CC $CFLAGS -c genmake_tc_1.c"
885      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
886      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
887      RET_C=$?      RET_C=$?
888      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
889        program hello        program hello
# Line 880  EOF Line 891  EOF
891        call setrlstk()        call setrlstk()
892        end        end
893  EOF  EOF
894      echo >> genmake_warnings      cat genmake_tc_2.$FS >> $LOGFILE
     echo "running: check_HAVE_SETRLSTK()" >> genmake_warnings  
     cat genmake_tc_2.$FS >> genmake_warnings  
895      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"
896      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
897      $COMM >> genmake_warnings 2>&1      $COMM >> $LOGFILE 2>&1
898      RETVAL=$?      RETVAL=$?
899      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
900          HAVE_SETRLSTK=t          HAVE_SETRLSTK=t
901          DEFINES="$DEFINES -DHAVE_SETRLSTK"          DEFINES="$DEFINES -DHAVE_SETRLSTK"
902      fi      fi
903      rm -f genmake_tc*      rm -f genmake_tc*
904        echo " --> set HAVE_SETRLSTK='$HAVE_SETRLSTK'" >> $LOGFILE
905  }  }
906    
907    
908  check_HAVE_STAT()  {  check_HAVE_STAT()  {
909        echo >> $LOGFILE
910        echo "running: check_HAVE_STAT()" >> $LOGFILE
911      get_fortran_c_namemangling      get_fortran_c_namemangling
912      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
913  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 917  void FC_NAMEMANGLE(tfsize) ( int *nbyte Line 929  void FC_NAMEMANGLE(tfsize) ( int *nbyte
929  }  }
930  EOF  EOF
931      COMM="$CC $CFLAGS -c genmake_tc_1.c"      COMM="$CC $CFLAGS -c genmake_tc_1.c"
932      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
933      $COMM >> genmake_tc.log 2>&1      $COMM >> genmake_tc.log 2>&1
934      RET_C=$?      RET_C=$?
935      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
# Line 927  EOF Line 939  EOF
939        print *," HELLO WORLD", nbyte        print *," HELLO WORLD", nbyte
940        end        end
941  EOF  EOF
942      echo >> genmake_warnings      cat genmake_tc_2.$FS >> $LOGFILE
     echo "running: check_HAVE_STAT()" >> genmake_warnings  
     cat genmake_tc_2.$FS >> genmake_warnings  
943      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"
944      echo $COMM >> genmake_warnings      echo $COMM >> $LOGFILE
945      $COMM >> genmake_tc.log 2>&1      $COMM >> genmake_tc.log 2>&1
946      RETVAL=$?      RETVAL=$?
947      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
# Line 939  EOF Line 949  EOF
949          DEFINES="$DEFINES -DHAVE_STAT"          DEFINES="$DEFINES -DHAVE_STAT"
950      fi      fi
951      rm -f genmake_tc*      rm -f genmake_tc*
952        echo " --> set HAVE_STAT='$HAVE_STAT'" >> $LOGFILE
953  }  }
954    
955    
# Line 946  check_netcdf_libs()  { Line 957  check_netcdf_libs()  {
957      if test ! "x$SKIP_NETCDF_CHECK" = x ; then      if test ! "x$SKIP_NETCDF_CHECK" = x ; then
958          return          return
959      fi      fi
960      echo >> genmake_warnings      echo >> $LOGFILE
961      echo "running: check_netcdf_libs()" >> genmake_warnings      echo "running: check_netcdf_libs()" >> $LOGFILE
962      cat <<EOF > genmake_tnc.F      cat <<EOF > genmake_tnc.F
963        program fgennc        program fgennc
964  #include "netcdf.inc"  #include "netcdf.inc"
# Line 965  EOF Line 976  EOF
976        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
977        end        end
978  EOF  EOF
979      echo "===  genmake_tnc.F  ===" > genmake_tnc.log      echo "===  genmake_tnc.F  >>>" > genmake_tnc.log
980      cat genmake_tnc.F >> genmake_tnc.log      cat genmake_tnc.F >> genmake_tnc.log
981      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log      echo "<<<  genmake_tnc.F  ===" >> genmake_tnc.log
982      RET_CPP=f      RET_CPP=f
983      COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES"      COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES"
984      echo "$COMM" >> genmake_tnc.log      echo "$COMM" >> genmake_tnc.log
# Line 983  EOF Line 994  EOF
994      $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \      $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
995          &&  $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
996      RET_COMPILE=$?      RET_COMPILE=$?
997      cat genmake_tnc.log >> genmake_warnings      cat genmake_tnc.log >> $LOGFILE
998    
999      #EH3  Remove test program execution for machines that either disallow      #EH3  Remove test program execution for machines that either disallow
1000      #EH3  execution or cannot support it (eg. cross-compilers)      #EH3  execution or cannot support it (eg. cross-compilers)
# Line 994  EOF Line 1005  EOF
1005    
1006      if test "x$RET_COMPILE" = x0 ; then      if test "x$RET_COMPILE" = x0 ; then
1007          HAVE_NETCDF=t          HAVE_NETCDF=t
1008            echo "check_netcdf: successful" >> $LOGFILE
1009      else      else
1010          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
1011          echo "try again with added '-lnetcdf'" > genmake_tnc.log          echo "==> try again with added '-lnetcdf'" > genmake_tnc.log
1012          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
1013          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
1014          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 1004  EOF Line 1016  EOF
1016              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
1017              &&  $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
1018          RET_COMPILE=$?          RET_COMPILE=$?
1019          cat genmake_tnc.log >> genmake_warnings          echo >> $LOGFILE
1020            cat genmake_tnc.log >> $LOGFILE
1021          if test "x$RET_COMPILE" = x0 ; then          if test "x$RET_COMPILE" = x0 ; then
1022              LIBS="$LIBS -lnetcdf"              LIBS="$LIBS -lnetcdf"
1023              HAVE_NETCDF=t              HAVE_NETCDF=t
1024                echo "check_netcdf: successful" >> $LOGFILE
1025          else          else
1026          # try again with "-lnetcdff" added to the libs          # try again with "-lnetcdff" added to the libs
1027              echo "try again with added '-lnetcdff -lnetcdf'" > genmake_tnc.log              echo "==> try again with added '-lnetcdff -lnetcdf'" > genmake_tnc.log
1028              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
1029              echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log              echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
1030              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 1018  EOF Line 1032  EOF
1032                  &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \                  &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
1033                  &&  $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
1034              RET_COMPILE=$?              RET_COMPILE=$?
1035              cat genmake_tnc.log >> genmake_warnings              echo >> $LOGFILE
1036                cat genmake_tnc.log >> $LOGFILE
1037              if test "x$RET_COMPILE" = x0 ; then              if test "x$RET_COMPILE" = x0 ; then
1038                  LIBS="$LIBS -lnetcdff -lnetcdf"                  LIBS="$LIBS -lnetcdff -lnetcdf"
1039                  HAVE_NETCDF=t                  HAVE_NETCDF=t
1040                    echo "check_netcdf: successful" >> $LOGFILE
1041              fi              fi
1042          fi          fi
1043      fi      fi
1044      rm -f genmake_tnc*      rm -f genmake_tnc*
1045        echo " --> set HAVE_NETCDF='$HAVE_NETCDF'" >> $LOGFILE
1046  }  }
1047    
1048    
# Line 1051  ENABLE= Line 1068  ENABLE=
1068  DISABLE=  DISABLE=
1069  # MAKEFILE=  # MAKEFILE=
1070  # MAKEDEPEND=  # MAKEDEPEND=
1071  PDEPEND=  PKG_DEPEND=
1072  DUMPSTATE=t  PKG_GROUPS=
1073  PDEFAULT=  DUMPSTATE=f
1074  OPTFILE=  OPTFILE=
1075  INCLUDES="-I. $INCLUDES"  INCLUDES="-I. $INCLUDES"
1076  FFLAGS=  FFLAGS=
# Line 1138  FTL_TAF_FLAGS= Line 1155  FTL_TAF_FLAGS=
1155  SVD_TAMC_FLAGS=  SVD_TAMC_FLAGS=
1156  TAMC_EXTRA=  TAMC_EXTRA=
1157    
   
1158  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1159  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"
1160  gm_s2="FC IEEE USE_R4 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"
1161    
1162  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1163  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"
1164  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"
1165  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD THISHOST THISUSER THISDATE THISVER MACHINE"
1166  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
1167  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME"  gm_s7="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME"
1168    
1169  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1170  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 1162  cat <<EOF Line 1178  cat <<EOF
1178    
1179  GENMAKE :  GENMAKE :
1180    
1181  A program for GENerating MAKEfiles for the MITgcm project.  For a  A program for GENerating MAKEfiles for the MITgcm project.
1182  quick list of options, use "genmake -h" or for more detail see:     For a quick list of options, use "genmake2 -h"
1183    or for more detail see the Developer's HOWTO manual at:
1184    http://mitgcm.org/devel_HOWTO/     http://mitgcm.org/public/docs.html
1185    
1186  EOF  EOF
1187    
1188    LOGFILE="genmake.log"
1189    #- clean-up previous genmake logfiles:
1190    rm -f genmake_state genmake_*optfile $LOGFILE
1191    
1192  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
1193  gm_local="genmake_local"  gm_local="genmake_local"
1194  printf "  getting local config information:  "  printf "  getting local config information:  "
# Line 1215  for ac_option in "$@" ; do Line 1235  for ac_option in "$@" ; do
1235              AD_OPTFILE=$ac_optarg ;;              AD_OPTFILE=$ac_optarg ;;
1236                    
1237          -pdepend | --pdepend)          -pdepend | --pdepend)
1238              ac_prev=PDEPEND ;;              ac_prev=PKG_DEPEND ;;
1239          -pdepend=* | --pdepend=*)          -pdepend=* | --pdepend=*)
1240              PDEPEND=$ac_optarg ;;              PKG_DEPEND=$ac_optarg ;;
1241                    
1242          -pdefault | --pdefault)          -pgroups | --pgroups)
1243              ac_prev=PDEFAULT ;;              ac_prev=PKG_GROUPS ;;
1244          -pdefault=* | --pdefault=*)          -pgroups=* | --pgroups=*)
1245              PDEFAULT=$ac_optarg ;;              PKG_GROUPS=$ac_optarg ;;
1246                    
1247          -make | --make | -m | --m)          -make | --make | -m | --m)
1248              ac_prev=MAKE ;;              ac_prev=MAKE ;;
# Line 1434  if test "x${OPTFILE}" = x ; then Line 1454  if test "x${OPTFILE}" = x ; then
1454      if test "x$MITGCM_OF" = x ; then      if test "x$MITGCM_OF" = x ; then
1455          echo "Warning: no OPTFILE specified so we'll look for possible settings"          echo "Warning: no OPTFILE specified so we'll look for possible settings"
1456          printf "\n===  Searching for possible settings for OPTFILE  ===\n"          printf "\n===  Searching for possible settings for OPTFILE  ===\n"
1457          find_possible_configs          find_possible_optfile
1458      else      else
1459          OPTFILE=$MITGCM_OF          OPTFILE=$MITGCM_OF
1460      fi      fi
# Line 1449  if test "x$OPTFILE" != xNONE ; then Line 1469  if test "x$OPTFILE" != xNONE ; then
1469              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
1470              exit 1              exit 1
1471          fi          fi
1472          if test "x$DUMPSTATE" != xf ; then          if test "x$DUMPSTATE" = xt ; then
1473              cp -f $OPTFILE "genmake_optfile"              cp -f $OPTFILE "genmake_optfile"
1474          fi          fi
1475      else      else
# Line 1476  if test "x${AD_OPTFILE}" != xNONE ; then Line 1496  if test "x${AD_OPTFILE}" != xNONE ; then
1496              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
1497              exit 1              exit 1
1498          fi          fi
1499          if test "x$DUMPSTATE" != xf ; then          if test "x$DUMPSTATE" = xt ; then
1500              cp -f $AD_OPTFILE "genmake_ad_optfile"              cp -f $AD_OPTFILE "genmake_ad_optfile"
1501          fi          fi
1502      else      else
# Line 1504  Error: no Fortran compiler: please speci Line 1524  Error: no Fortran compiler: please speci
1524  EOF  EOF
1525      exit 1      exit 1
1526  fi  fi
1527    
1528  if test "x$CC" = x ; then  if test "x$CC" = x ; then
1529      CC=cc      look_for_C_compilers
1530    #   CC=cc
1531  #     cat <<EOF 1>&2  #     cat <<EOF 1>&2
1532  # Error: no C compiler: please specify using one of the following:  # Error: no C compiler: please specify using one of the following:
1533  #   1) within the options file ("CC=...") as specified by "-of=OPTFILE"  #   1) within the options file ("CC=...") as specified by "-of=OPTFILE"
# Line 1514  if test "x$CC" = x ; then Line 1536  if test "x$CC" = x ; then
1536  # EOF  # EOF
1537  #     exit 1  #     exit 1
1538  fi  fi
1539    
1540  if test "x$LINK" = x ; then  if test "x$LINK" = x ; then
1541      LINK=$FC      LINK=$FC
1542  fi  fi
# Line 1521  if test "x$MAKE" = x ; then Line 1544  if test "x$MAKE" = x ; then
1544      MAKE="make"      MAKE="make"
1545  fi  fi
1546  if test "x$CPP" = x ; then  if test "x$CPP" = x ; then
1547      CPP=cpp      CPP="cpp -traditional -P"
1548  fi  fi
1549  #EH3 === UGLY ===  #EH3 === UGLY ===
1550  #  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 1548  EOF Line 1571  EOF
1571  else  else
1572      rm -f test_cpp      rm -f test_cpp
1573  fi  fi
1574    
1575  look_for_makedepend  look_for_makedepend
1576    
1577    #  Check that soft-link command is set and usable
1578  if test "x$LN" = x ; then  if test "x$LN" = x ; then
1579      LN="ln -s"      LN="ln -s"
1580  fi  fi
# Line 1558  RETVAL=$? Line 1584  RETVAL=$?
1584  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
1585      cat <<EOF 1>&2      cat <<EOF 1>&2
1586    
1587  Error: The command "ln -s" failed -- please specify a working soft-link  Error: The command "$LN" failed -- please specify a working soft-link
1588    command in the optfile.    command in the optfile.
1589    
1590  EOF  EOF
# Line 1811  for d in $MODS ; do Line 1837  for d in $MODS ; do
1837  done  done
1838  echo  echo
1839    
1840  if test "x${PLATFORM}" = x ; then  #if test "x${PLATFORM}" = x ; then
1841      PLATFORM=$p_PLATFORM  #    PLATFORM=$p_PLATFORM
1842  fi  #fi
1843    
1844  if test "x${EXEDIR}" = x ; then  if test "x${EXEDIR}" = x ; then
1845      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`
# Line 1883  fi Line 1909  fi
1909  #  they appear as regular source code  #  they appear as regular source code
1910  if test -r $ROOTDIR"/eesupp/src/Makefile" ; then  if test -r $ROOTDIR"/eesupp/src/Makefile" ; then
1911      echo "  Making source files in eesupp from templates"      echo "  Making source files in eesupp from templates"
1912      ( cd $ROOTDIR"/eesupp/src/" && $MAKE ) > make_eesupp.errors 2>&1      ( cd $ROOTDIR"/eesupp/src/" && $MAKE clean_old && $MAKE \
1913        ) > make_eesupp.errors 2>&1
1914      RETVAL=$?      RETVAL=$?
1915      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
1916          rm -f make_eesupp.errors          rm -f make_eesupp.errors
# Line 1898  fi Line 1925  fi
1925  for pdir in exch2 regrid ; do  for pdir in exch2 regrid ; do
1926      if test -r $ROOTDIR"/pkg/${pdir}/Makefile" ; then      if test -r $ROOTDIR"/pkg/${pdir}/Makefile" ; then
1927          echo "  Making source files in pkg/${pdir} from templates"          echo "  Making source files in pkg/${pdir} from templates"
1928          ( cd $ROOTDIR"/pkg/"${pdir} && $MAKE ) > make_${pdir}.errors 2>&1          ( cd $ROOTDIR"/pkg/"${pdir} && $MAKE clean_old && $MAKE \
1929            ) > make_${pdir}.errors 2>&1
1930          RETVAL=$?          RETVAL=$?
1931          if test "x${RETVAL}" = x0 ; then          if test "x${RETVAL}" = x0 ; then
1932              rm -f make_${pdir}.errors              rm -f make_${pdir}.errors
# Line 1911  for pdir in exch2 regrid ; do Line 1939  for pdir in exch2 regrid ; do
1939  done  done
1940    
1941  printf "\n===  Determining package settings  ===\n"  printf "\n===  Determining package settings  ===\n"
1942  if  test "x${PDEPEND}" = x ; then  if  test "x${PKG_DEPEND}" = x ; then
1943      tmp=$ROOTDIR"/pkg/pkg_depend"      tmp=$ROOTDIR"/pkg/pkg_depend"
1944      if test -r $tmp ; then      if test -r $tmp ; then PKG_DEPEND=$tmp ; fi
1945          PDEPEND=$tmp  fi
1946      else  if  test "x${PKG_DEPEND}" = x ; then
1947          echo "Warning:  No package dependency information was specified."          echo "Warning:  No package dependency information was specified."
1948          echo "  Please check that ROOTDIR/pkg/pkg_depend exists."          echo "  Please check that ROOTDIR/pkg/pkg_depend exists."
1949    else
1950        if test ! -r ${PKG_DEPEND} ; then
1951            echo "Error:  can't read package dependency info from PKG_DEPEND=\"$PKG_DEPEND\""
1952            exit 1
1953      fi      fi
1954        echo "  getting package dependency info from  $PKG_DEPEND"
1955    #  Strip the comments and then convert the dependency file into arrays: PNAME, DNAME
1956        get_pdepend_list $PKG_DEPEND
1957    fi
1958    
1959    # A default package groups file "$ROOTDIR/pkg/pkg_groups" is provided
1960    #  to define the "default_pkg_list" and package groups (for convenience, one
1961    #  can specify a group of packages using names like "ocean" and "atmosphere").
1962    if test "x${PKG_GROUPS}" = x ; then
1963        tmp=$ROOTDIR"/pkg/pkg_groups"
1964        if test -r $tmp ; then PKG_GROUPS=$tmp ; fi
1965    fi
1966    if test "x${PKG_GROUPS}" = x ; then
1967            echo "Warning:  No package groups information was specified."
1968            echo "  Please check that ROOTDIR/pkg/pkg_groups exists."
1969  else  else
1970      if test ! -r ${PDEPEND} ; then      if test ! -r ${PKG_GROUPS} ; then
1971          echo "Error:  can't read package dependency info from PDEPEND=\"$PDEPEND\""          echo "Error:  can't read package groups info from PKG_GROUPS=\"$PKG_GROUPS\""
1972          exit 1          exit 1
1973      fi      fi
1974        echo "  getting package groups info from      $PKG_GROUPS"
1975  fi  fi
1976  echo "  getting package dependency info from  $PDEPEND"  
1977  #  Strip the comments and then convert the dependency file into  #  Search for packages to compile.
1978  #  two arrays: PNAME, DNAME  echo "  checking list of packages to compile:"
1979  get_pdepend_list $PDEPEND  PKG_LIST=
1980    if test "x${PKG_LIST}" = x ; then
 #  Search for default packages.  Note that a "$ROOTDIR/pkg/pkg_groups"  
 #  file has been added so that, for convenience, one can specify  
 #  groups of packages using names like "ocean" and "atmosphere".  
 echo "  checking default package list:  "  
 if test "x${PDEFAULT}" = x ; then  
1981      for i in "." $MODS ; do      for i in "." $MODS ; do
1982          if test -r $i"/packages.conf" ; then          if test -r $i"/packages.conf" ; then
1983                  PDEFAULT=$i"/packages.conf"                  PKG_LIST=$i"/packages.conf"
1984                  break                  break
1985          fi          fi
1986      done      done
1987  fi  fi
1988  if test "x${PDEFAULT}" = x ; then  if test "x${PKG_LIST}" = x ; then
1989      PDEFAULT="$ROOTDIR/pkg/pkg_default"      pkg_list='default_pkg_list'
1990  fi      if test "x${PKG_GROUPS}" = x ; then
1991  if test "x${PDEFAULT}" = xNONE ; then          echo "Error:  need package groups info to expand pkg_list=\"$pkg_list\""
1992      echo "    default packages file disabled"          exit 1
1993        fi
1994  else  else
1995      if test ! -r $PDEFAULT ; then      if test ! -r $PKG_LIST ; then
1996          echo "Warning:  can't read default packages from PDEFAULT=\"$PDEFAULT\""          echo "Error:  can't read package list from PKG_LIST=\"$PKG_LIST\""
1997            exit 1
1998      else      else
1999          echo "    using PDEFAULT=\"$PDEFAULT\""          echo "    using PKG_LIST=\"$PKG_LIST\""
2000          #  Strip the comments and add all the names          #  Strip the comments and add all the names
2001          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}'`
2002          RETVAL=$?          RETVAL=$?
2003          if test "x${RETVAL}" != x0 ; then          if test "x${RETVAL}" != x0 ; then
2004              printf "Error: can't parse default package list "              printf "Error: can't parse package list "
2005              echo "-- please check PDEFAULT=\"$PDEFAULT\""              echo "-- please check PKG_LIST=\"$PKG_LIST\""
2006              exit 1              exit 1
2007          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"  
2008      fi      fi
2009  fi  fi
2010    for i in $pkg_list ; do
2011        PACKAGES="$PACKAGES $i"
2012    done
2013    echo     "    before group expansion packages are:$PACKAGES"
2014    if test "x${PKG_GROUPS}" != x ; then
2015        RET=1
2016        while test $RET = 1 ; do expand_pkg_groups; RET=$?; done
2017        echo "    after group expansion packages are: $PACKAGES"
2018    fi
2019    
2020  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
2021  echo "" > ./.tmp_pack  echo "" > ./.tmp_pack
# Line 1999  PACKAGES="$PACKAGES $ENABLE" Line 2046  PACKAGES="$PACKAGES $ENABLE"
2046  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2047      j=`echo $i | sed 's/[-+]//'`      j=`echo $i | sed 's/[-+]//'`
2048      if test ! -d "$ROOTDIR/pkg/$j" ; then      if test ! -d "$ROOTDIR/pkg/$j" ; then
2049          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"
2050          exit 1          exit 1
2051      fi      fi
2052      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
# Line 2018  mnc_in=$? Line 2065  mnc_in=$?
2065  if test "x$HAVE_NETCDF" != xt ; then  if test "x$HAVE_NETCDF" != xt ; then
2066      if test "x$mnc_in" = x0 ; then      if test "x$mnc_in" = x0 ; then
2067          cat <<EOF          cat <<EOF
   
2068  *********************************************************************  *********************************************************************
2069  WARNING: the "mnc" package was enabled but tests failed to compile  WARNING: the "mnc" package was enabled but tests failed to compile
2070    NetCDF applications.  Please check that:    NetCDF applications.  Please check that:
# Line 2029  WARNING: the "mnc" package was enabled b Line 2075  WARNING: the "mnc" package was enabled b
2075    
2076    Due to this failure, the "mnc" package is now DISABLED.    Due to this failure, the "mnc" package is now DISABLED.
2077  *********************************************************************  *********************************************************************
   
2078  EOF  EOF
2079          PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`          PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`
2080          DISABLE="$DISABLE mnc"          DISABLE="$DISABLE mnc"
# Line 2061  if test "x$HAVE_NETCDF" != xt ; then Line 2106  if test "x$HAVE_NETCDF" != xt ; then
2106      RETVAL=$?      RETVAL=$?
2107      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
2108          cat <<EOF          cat <<EOF
   
2109  *********************************************************************  *********************************************************************
2110  WARNING: the "profiles" package was enabled but tests failed to  WARNING: the "profiles" package was enabled but tests failed to
2111    compile NetCDF applications.  Please check that:    compile NetCDF applications.  Please check that:
# Line 2072  WARNING: the "profiles" package was enab Line 2116  WARNING: the "profiles" package was enab
2116    
2117    Due to this failure, the "profiles" package is now DISABLED.    Due to this failure, the "profiles" package is now DISABLED.
2118  *********************************************************************  *********************************************************************
   
2119  EOF  EOF
2120          PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`          PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`
2121          DISABLE="$DISABLE profiles"          DISABLE="$DISABLE profiles"
# Line 2082  EOF Line 2125  EOF
2125      fi      fi
2126  fi  fi
2127    
2128  echo "  applying package dependency rules"  if  test "x${PKG_DEPEND}" != x ; then
2129  ck=    echo "  applying package dependency rules"
2130  while test "x$ck" != xtt ; do    ck=
2131      while test "x$ck" != xtt ; do
2132      i=0      i=0
2133      # rtot=${#PNAME[@]}      # rtot=${#PNAME[@]}
2134      rtot=$nname      rtot=$nname
# Line 2155  while test "x$ck" != xtt ; do Line 2199  while test "x$ck" != xtt ; do
2199          #i=$(( $i + 1 ))          #i=$(( $i + 1 ))
2200      done      done
2201      ck=$ck"t"      ck=$ck"t"
2202  done    done
2203  echo "    packages are: $PACKAGES"    echo "    packages are: $PACKAGES"
2204    fi
2205  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2206      adr="$ROOTDIR/pkg/$i"      adr="$ROOTDIR/pkg/$i"
2207      if test -d $adr ; then      if test -d $adr ; then
# Line 2272  if test -f ./adSrcFiles.tmp ; then Line 2317  if test -f ./adSrcFiles.tmp ; then
2317      rm -f ./adSrcFiles.tmp      rm -f ./adSrcFiles.tmp
2318  fi  fi
2319  echo "  Creating the list of files for the adjoint compiler."  echo "  Creating the list of files for the adjoint compiler."
2320    touch adSrcFiles.tmp
2321  for i in $SOURCEDIRS ; do  for i in $SOURCEDIRS ; do
2322      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`      list_files=`( cd $i && ls -1 *.list 2>/dev/null )`
2323      for j in $list_files ; do      for j in $list_files ; do
# Line 2668  output.txt: \$(EXECUTABLE) Line 2714  output.txt: \$(EXECUTABLE)
2714          @printf 'running ... '          @printf 'running ... '
2715          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
2716    
2717    # remove most of the files that "make" generates
2718  clean:  clean:
2719          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template
2720          -rm -rf *.o          -rm -rf *.o
2721          -rm -rf *.$FS *.flowdir          -rm -rf *.$FS *.flowdir
2722          -rm -rf *.f$FS90 \$(AD_CLEAN) ad_input*          -rm -rf *.f$FS90 \$(AD_CLEAN) ad_input*
2723    
2724    # remove most of the files that "make" and "make depend" generate
2725  Clean:  Clean:
2726          @make clean          @make clean
2727          @make cleanlinks          @make cleanlinks
2728          -rm -f \$(SPECIAL_FILES)          -rm -f \$(SPECIAL_FILES) f90mkdepend.log
         -rm -f genmake_state genmake_*optfile genmake_warnings genmake_errors  
         -rm -f make.log run.log f90mkdepend.log *.bak "$MAKEFILE.old"  
2729          -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
2730            -rm -f genmake_warnings genmake_errors make.log
2731    
2732    # remove also the executable, files that "genmake2" generates (except Makefile)
2733    #         and output from a run (plus log files from testreport)
2734  CLEAN:  CLEAN:
2735          @make Clean          @make Clean
2736            -rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak $MAKEFILE.old
2737            -rm -f $LOGFILE genmake_state genmake_*optfile genmake.tr_log make.tr_log
2738          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
2739          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
2740          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
2741          -rm -f \$(EXECUTABLE) \$(EXE_AD) *.txt STD* *diagnostics.log datetime          -rm -f *.txt STD* *diagnostics.log datetime
2742          -rm -f *_MIT_CE_000.opt0000 costfunction*0000          -rm -f *_MIT_CE_000.opt0000 costfunction*0000
2743          -rm -rf mnc_test_*          -rm -rf mnc_test_*
2744    
 #eh3 Makefile: makefile  
2745  makefile:  makefile:
2746          $THIS_SCRIPT $G2ARGS          $THIS_SCRIPT $G2ARGS
2747  cleanlinks:  cleanlinks:
# Line 3205  fi Line 3257  fi
3257    
3258    
3259  #  Write the "state" for future records  #  Write the "state" for future records
3260  if test "x$DUMPSTATE" != xf ; then  if test "x$DUMPSTATE" = xt ; then
3261      printf "" > genmake_state      printf "" > genmake_state
3262      for i in $gm_state ; do      for i in $gm_state ; do
3263          t1="t2=\$$i"          t1="t2=\$$i"

Legend:
Removed from v.1.206  
changed lines
  Added in v.1.213

  ViewVC Help
Powered by ViewVC 1.1.22