/[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.143 by edhill, Tue Feb 14 16:21:09 2006 UTC revision 1.168 by mlosch, Wed Feb 13 07:39:34 2008 UTC
# Line 13  Line 13 
13  test_for_package_in_cpp_options() {  test_for_package_in_cpp_options() {
14      cpp_options=$1      cpp_options=$1
15      pkg=$2      pkg=$2
16      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg[ ]"
17      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg[ ]"
18      test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg[ ]"
19      test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg[ ]"
20        test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_$pkg$"
21        test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_$pkg$"
22        test_for_string_in_file $cpp_options "^[ ]*#define.*DISABLE_$pkg$"
23        test_for_string_in_file $cpp_options "^[ ]*#undef.*DISABLE_$pkg$"
24  }  }
25    
26  # Search for particular CPP #cmds associated with MPI  # Search for particular CPP #cmds associated with MPI
27  # usage: test_for_mpi_in_cpp_eeoptions CPP_file  # usage: test_for_mpi_in_cpp_eeoptions CPP_file
28  test_for_mpi_in_cpp_eeoptions() {  test_for_mpi_in_cpp_eeoptions() {
29      cpp_options=$1      cpp_options=$1
30      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI[ ]"
31      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI[ ]"
32      test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI[ ]"
33      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI" || exit 99      test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI[ ]"
34        test_for_string_in_file $cpp_options "^[ ]*#define.*ALLOW_USE_MPI$"
35        test_for_string_in_file $cpp_options "^[ ]*#undef.*ALLOW_USE_MPI$"
36        test_for_string_in_file $cpp_options "^[ ]*#define.*ALWAYS_USE_MPI$"
37        test_for_string_in_file $cpp_options "^[ ]*#undef.*ALWAYS_USE_MPI$"
38  }  }
39    
40  # Search for particular string in a file. Return 1 if detected, 0 if not  # Search for particular string in a file. Return 1 if detected, 0 if not
# Line 39  test_for_string_in_file() { Line 47  test_for_string_in_file() {
47      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
48          printf "Error: In $file there is an illegal line: "          printf "Error: In $file there is an illegal line: "
49          grep -i "$strng" $file          grep -i "$strng" $file
50          return 1          exit 99
51      fi      fi
52      return 0      return 0
53  }  }
# Line 317  find_possible_configs()  { Line 325  find_possible_configs()  {
325    
326      #================================================================      #================================================================
327      #  look for possible C compilers      #  look for possible C compilers
328      tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc"      tmp="$MITGCM_CC $CC gcc c89 cc c99 mpicc icc"
329      p_CC=      p_CC=
330      for c in $tmp ; do      for c in $tmp ; do
331          rm -f ./genmake_hello.c  ./genmake_hello          rm -f ./genmake_hello.c  ./genmake_hello
# Line 356  EOF Line 364  EOF
364    
365      #================================================================      #================================================================
366      #  look for possible FORTRAN compilers      #  look for possible FORTRAN compilers
367      tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 gfortran"      tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc ifort f90 f95 mpif77 mpf77 mpxlf95 gfortran g95"
368      p_FC=      p_FC=
369      for c in $tmp ; do      for c in $tmp ; do
370          rm -f ./hello.f ./hello          rm -f ./hello.f ./hello
# Line 579  Usage: "$0" [OPTIONS] Line 587  Usage: "$0" [OPTIONS]
587      -ts | --ts      -ts | --ts
588            Produce timing information per timestep            Produce timing information per timestep
589      -papis | --papis      -papis | --papis
590            Produce summary MFlop/s with PAPI per timestep            Produce summary MFlop/s (and IPC) with PAPI per timestep
591        -pcls | --pcls
592              Produce summary MFlop/s etc. with PCL per timestep
593      -foolad | --foolad      -foolad | --foolad
594            Fool the AD code generator            Fool the AD code generator
595      -papi | --papi      -papi | --papi
596            Performance analysis with PAPI            Performance analysis with PAPI
597        -pcl | --pcl
598              Performance analysis with PCL
599      -hpmt | --hpmt      -hpmt | --hpmt
600            Performance analysis with the HPM Toolkit            Performance analysis with the HPM Toolkit
601    
602      -gsl | --gsl      -gsl | --gsl
603            Use GSL to control floating point rounding and precision            Use GSL to control floating point rounding and precision
604        -devel | --devel
605              Add additional warning and debugging flags for development
606    
607      -mpi | --mpi      -mpi | --mpi
608            Include MPI header files and link to MPI libraries            Include MPI header files and link to MPI libraries
# Line 732  void FC_NAMEMANGLE(cloc) ( double *curti Line 746  void FC_NAMEMANGLE(cloc) ( double *curti
746   *curtim = *curtim/1.E6;   *curtim = *curtim/1.E6;
747  }  }
748  EOF  EOF
749      make genmake_tc_1.o >> genmake_warnings 2>&1      COMM="$CC $CFLAGS -c genmake_tc_1.c"
750        echo $COMM >> genmake_warnings
751        $COMM >> genmake_warnings 2>&1
752      RET_C=$?      RET_C=$?
753      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
754        program hello        program hello
# Line 742  EOF Line 758  EOF
758        print *," HELLO WORLD", wtime        print *," HELLO WORLD", wtime
759        end        end
760  EOF  EOF
761      $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
762        echo $COMM >> genmake_warnings
763        $COMM >> genmake_warnings 2>&1
764      RET_F=$?      RET_F=$?
765      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1
766      RETVAL=$?      RETVAL=$?
# Line 755  EOF Line 773  EOF
773    
774    
775  check_HAVE_SIGREG()  {  check_HAVE_SIGREG()  {
776        if test ! "x$HAVE_SIGREG" = x ; then
777            return
778        fi
779      get_fortran_c_namemangling      get_fortran_c_namemangling
780      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
781  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 786  void FC_NAMEMANGLE(sigreg) (int * aip) Line 807  void FC_NAMEMANGLE(sigreg) (int * aip)
807      return;      return;
808  }  }
809  EOF  EOF
810      make genmake_tc_1.o >> genmake_warnings 2>&1      COMM="$CC $CFLAGS -c genmake_tc_1.c"
811        echo $COMM >> genmake_warnings
812        $COMM >> genmake_warnings 2>&1
813      RET_C=$?      RET_C=$?
814      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
815        program hello        program hello
# Line 812  EOF Line 835  EOF
835    
836    
837  check_HAVE_SETRLSTK()  {  check_HAVE_SETRLSTK()  {
838        if test "x$HAVE_SETRLSTK" = xt ; then
839            DEFINES="$DEFINES -DHAVE_SETRLSTK"
840            return
841        fi  
842        if test ! "x$HAVE_SETRLSTK" = x ; then
843            return
844        fi
845      get_fortran_c_namemangling      get_fortran_c_namemangling
846      cat <<EOF > genmake_tc_1.c      cat <<EOF > genmake_tc_1.c
847  $FC_NAMEMANGLE  $FC_NAMEMANGLE
# Line 827  void FC_NAMEMANGLE(setrlstk) () Line 857  void FC_NAMEMANGLE(setrlstk) ()
857      return;      return;
858  }  }
859  EOF  EOF
860      make genmake_tc_1.o >> genmake_warnings 2>&1      COMM="$CC $CFLAGS -c genmake_tc_1.c"
861        echo $COMM >> genmake_warnings
862        $COMM >> genmake_warnings 2>&1
863      RET_C=$?      RET_C=$?
864      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
865        program hello        program hello
# Line 871  void FC_NAMEMANGLE(tfsize) ( int *nbyte Line 903  void FC_NAMEMANGLE(tfsize) ( int *nbyte
903          *nbyte = -1;          *nbyte = -1;
904  }  }
905  EOF  EOF
906      make genmake_tc_1.o >> genmake_tc.log 2>&1      COMM="$CC $CFLAGS -c genmake_tc_1.c"
907        echo $COMM >> genmake_warnings
908        $COMM >> genmake_tc.log 2>&1
909      RET_C=$?      RET_C=$?
910      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
911        program hello        program hello
# Line 922  EOF Line 956  EOF
956      cat genmake_tnc.F >> genmake_tnc.log      cat genmake_tnc.F >> genmake_tnc.log
957      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log
958      RET_CPP=f      RET_CPP=f
959      COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F"      COMM="cat genmake_tnc.F | $CPP $DEFINES $INCLUDES"
960      echo "$COMM" >> genmake_tnc.log      echo "$COMM" >> genmake_tnc.log
961      $COMM > genmake_tnc.$FS 2>/dev/null  &&  RET_CPP=t      eval $COMM > genmake_tnc.$FS 2>/dev/null  &&  RET_CPP=t
962      if test "x$RET_CPP" = xf ; then      if test "x$RET_CPP" = xf ; then
963          echo "  WARNING: CPP failed to pre-process the netcdf test." \          echo "  WARNING: CPP failed to pre-process the netcdf test." \
964              >> genmake_tnc.log              >> genmake_tnc.log
# Line 932  EOF Line 966  EOF
966              >> genmake_tnc.log              >> genmake_tnc.log
967      fi      fi
968      echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS  \ " >> genmake_tnc.log      echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS  \ " >> genmake_tnc.log
969      echo "  &&  $LINK -o genmake_tnc.o $LIBS" >> genmake_tnc.log      echo "  &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc.o $LIBS" >> genmake_tnc.log
970      $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \      $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
971          &&  $LINK -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
972      RET_COMPILE=$?      RET_COMPILE=$?
973      cat genmake_tnc.log >> genmake_warnings      cat genmake_tnc.log >> genmake_warnings
974    
# Line 950  EOF Line 984  EOF
984      else      else
985          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
986          echo "try again with added '-lnetcdf'" > genmake_tnc.log          echo "try again with added '-lnetcdf'" > genmake_tnc.log
987          echo "$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS \ " >> genmake_tnc.log          echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log
988          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
989          echo " &&  $LINK -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
990          $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null  \          cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS 2>/dev/null  \
991              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
992              &&  $LINK -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
993          RET_COMPILE=$?          RET_COMPILE=$?
994          cat genmake_tnc.log >> genmake_warnings          cat genmake_tnc.log >> genmake_warnings
995          if test "x$RET_COMPILE" = x0 ; then          if test "x$RET_COMPILE" = x0 ; then
996              LIBS="$LIBS -lnetcdf"              LIBS="$LIBS -lnetcdf"
997              HAVE_NETCDF=t              HAVE_NETCDF=t
998            else
999            # try again with "-lnetcdff" added to the libs
1000                echo "try again with added '-lnetcdff -lnetcdf'" > genmake_tnc.log
1001                echo "cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS \ " >> genmake_tnc.log
1002                echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
1003                echo " &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log
1004                cat genmake_tnc.F | $CPP $DEFINES $INCLUDES > genmake_tnc.$FS 2>/dev/null  \
1005                    &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
1006                    &&  $LINK $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.o $LIBS -lnetcdff -lnetcdf >> genmake_tnc.log 2>&1
1007                RET_COMPILE=$?
1008                cat genmake_tnc.log >> genmake_warnings
1009                if test "x$RET_COMPILE" = x0 ; then
1010                    LIBS="$LIBS -lnetcdff -lnetcdf"
1011                    HAVE_NETCDF=t
1012                fi
1013          fi          fi
1014      fi      fi
1015      rm -f genmake_tnc*      rm -f genmake_tnc*
# Line 996  OPTFILE= Line 1045  OPTFILE=
1045  INCLUDES="-I. $INCLUDES"  INCLUDES="-I. $INCLUDES"
1046  FFLAGS=  FFLAGS=
1047  FOPTIM=  FOPTIM=
1048    FEXTRAFLAGS=
1049  CFLAGS=  CFLAGS=
1050  KFLAGS1=  KFLAGS1=
1051  KFLAGS2=  KFLAGS2=
# Line 1008  MPI= Line 1058  MPI=
1058  MPIPATH=  MPIPATH=
1059  TS=  TS=
1060  PAPIS=  PAPIS=
1061    PCLS=
1062  FOOLAD=  FOOLAD=
1063  PAPI=  PAPI=
1064    PCL=
1065  HPMT=  HPMT=
1066  GSL=  GSL=
1067    DEVEL=
1068  HAVE_TEST_L=  HAVE_TEST_L=
1069    
1070  # DEFINES checked by test compilation or command-line  # DEFINES checked by test compilation or command-line
# Line 1019  HAVE_SYSTEM= Line 1072  HAVE_SYSTEM=
1072  HAVE_FDATE=  HAVE_FDATE=
1073  FC_NAMEMANGLE=  FC_NAMEMANGLE=
1074  HAVE_CLOC=  HAVE_CLOC=
1075  HAVE_SETRLSTK=  # HAVE_SETRLSTK=
1076  HAVE_STAT=  HAVE_STAT=
1077  HAVE_NETCDF=  HAVE_NETCDF=
1078  HAVE_ETIME=  HAVE_ETIME=
# Line 1070  TAMC_EXTRA= Line 1123  TAMC_EXTRA=
1123    
1124  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1125  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
1126  gm_s2="FC CPP IEEE TS PAPIS PAPI HPMT GSL MPI JAM DUMPSTATE STANDARDDIRS"  gm_s2="FC CPP IEEE TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI JAM DUMPSTATE STANDARDDIRS"
1127    
1128  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1129  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM "  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM FEXTRAFLAGS"
1130  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
1131  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"
1132  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
# Line 1100  EOF Line 1153  EOF
1153    
1154  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
1155  gm_local="genmake_local"  gm_local="genmake_local"
 for i in . $MODS ; do  
     if test -r $i/$gm_local ; then  
         . $i/$gm_local  
         break  
     fi  
 done  
1156  printf "  getting local config information:  "  printf "  getting local config information:  "
1157  if test -f $gm_local ; then  if test -f $gm_local ; then
1158      echo "using $gm_local"      echo "using $gm_local"
# Line 1254  for ac_option in "$@" ; do Line 1301  for ac_option in "$@" ; do
1301              TS=true ;;              TS=true ;;
1302          -papis | --papis)          -papis | --papis)
1303              PAPIS=true ;;              PAPIS=true ;;
1304            -pcls | --pcls)
1305                PCLS=true ;;
1306          -foolad | --foolad)          -foolad | --foolad)
1307              FOOLAD=true ;;              FOOLAD=true ;;
1308          -papi | --papi)          -papi | --papi)
1309              PAPI=true ;;              PAPI=true ;;
1310            -pcl | --pcl)
1311                PCL=true ;;
1312          -hpmt | --hpmt)          -hpmt | --hpmt)
1313              HPMT=true ;;              HPMT=true ;;
1314    
1315          -gsl | --gsl)          -gsl | --gsl)
1316              GSL=true ;;              GSL=true ;;
1317    
1318            -devel | --devel)
1319                DEVEL=true ;;
1320    
1321          -mpi | --mpi)          -mpi | --mpi)
1322              MPI=true ;;              MPI=true ;;
1323          -mpi=* | --mpi=*)          -mpi=* | --mpi=*)
# Line 1312  done Line 1366  done
1366  if test -f ./.genmakerc ; then  if test -f ./.genmakerc ; then
1367      echo      echo
1368      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
1369      echo "  file.  This file format is no longer supported.  Please see:"      echo "  file.  This file format is no longer supported.  For directions on"
1370      echo      echo "  how to setup and use the new \"genmake2\" script, please see:"
1371      echo "    http://mitgcm.org/devel_HOWTO/"      echo "    http://mitgcm.org/devel_HOWTO/"
1372      echo      echo "  and send an email to MITgcm-support@mitgcm.org if you need help."
1373      echo "  for directions on how to setup and use the new \"genmake2\" input"      echo "WARNING: ignore \"./.genmakerc\" and continue."
     echo "  files and send an email to MITgcm-support@mitgcm.org if you want help."  
1374      echo      echo
1375  fi  fi
1376    
1377  #  Find the MITgcm ${ROOTDIR}  #  Find the MITgcm ${ROOTDIR}
1378  if test "x${ROOTDIR}" = x ; then  if test "x${ROOTDIR}" = x ; then
1379      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`
1380      if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then      if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesupp -a -d ../pkg ; then
1381          ROOTDIR=".."          ROOTDIR=".."
1382      else      else
1383          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do
# Line 1514  if test ! "x$TS" = x ; then Line 1567  if test ! "x$TS" = x ; then
1567        else        else
1568              DEFINES="$DEFINES -DTIME_PER_TIMESTEP"              DEFINES="$DEFINES -DTIME_PER_TIMESTEP"
1569        fi        fi
1570          PACKAGES="$PACKAGES showflops"
1571  fi  fi
1572  if test ! "x$PAPIS" = x ; then  if test ! "x$PAPIS" = x ; then
1573        echo "  Turning on PAPI flop summary per timestep"        echo "  Turning on PAPI flop summary per timestep"
# Line 1525  if test ! "x$PAPIS" = x ; then Line 1579  if test ! "x$PAPIS" = x ; then
1579        fi        fi
1580        INCLUDES="$INCLUDES $PAPIINC"        INCLUDES="$INCLUDES $PAPIINC"
1581        LIBS="$LIBS $PAPILIB"        LIBS="$LIBS $PAPILIB"
1582          PACKAGES="$PACKAGES showflops"
1583    fi
1584    if test ! "x$PCLS" = x ; then
1585          echo "  Turning on PCL counter summary per timestep"
1586          echo "  Please make sure PCLINC, PCLLIB are defined"
1587          if test ! "x$FOOLAD" = x ; then
1588                DEFINES="$DEFINES -DUSE_PCL_FLOPS_SFP"
1589          else
1590                DEFINES="$DEFINES -DUSE_PCL_FLOPS"
1591          fi
1592          INCLUDES="$INCLUDES $PCLINC"
1593          LIBS="$LIBS $PCLLIB"
1594          PACKAGES="$PACKAGES showflops"
1595  fi  fi
1596  if test ! "x$PAPI" = x ; then  if test ! "x$PAPI" = x ; then
1597        if test ! "x$PAPIS" = x ; then        if test ! "x$PAPIS" = x ; then
# Line 1538  if test ! "x$PAPI" = x ; then Line 1605  if test ! "x$PAPI" = x ; then
1605            LIBS="$LIBS $PAPILIB"            LIBS="$LIBS $PAPILIB"
1606        fi        fi
1607  fi  fi
1608    if test ! "x$PCL" = x ; then
1609          if test ! "x$PCLS" = x ; then
1610              echo "  PCL performance analysis and flop summary per timestep cannot co-exist!"
1611              echo "  Sticking with PCL flop summary per timestep!"
1612          else
1613              echo "  Turning on performance analysis with PCL"
1614              echo "  Please make sure PCLINC, PCLLIB are defined"
1615              DEFINES="$DEFINES -DUSE_PCL"
1616              INCLUDES="$INCLUDES $PCLINC"
1617              LIBS="$LIBS $PCLLIB"
1618          fi
1619    fi
1620  if test ! "x$HPMT" = x ; then  if test ! "x$HPMT" = x ; then
1621        if test ! "x$PAPI" = x ; then        if test ! "x$PAPI" = x ; then
1622            echo "  PAPI and the HPM Toolkit cannot co-exist!"            echo "  PAPI and the HPM Toolkit cannot co-exist!"
1623            echo "  Sticking with PAPI!"            echo "  Sticking with PAPI!"
1624          else if test ! "x$PCL" = x ; then
1625              echo "  PCL and the HPM Toolkit cannot co-exist!"
1626              echo "  Sticking with PCL!"
1627        else        else
1628            echo "  Turning on performance analysis with the HPM Toolkit"            echo "  Turning on performance analysis with the HPM Toolkit"
1629            echo "  Please make sure HPMTINC, HPMTLIB are defined"            echo "  Please make sure HPMTINC, HPMTLIB are defined"
# Line 1549  if test ! "x$HPMT" = x ; then Line 1631  if test ! "x$HPMT" = x ; then
1631            INCLUDES="$INCLUDES $HPMTINC"            INCLUDES="$INCLUDES $HPMTINC"
1632            LIBS="$LIBS $HPMTLIB"            LIBS="$LIBS $HPMTLIB"
1633        fi        fi
1634          fi
1635  fi  fi
1636  if test ! "x$GSL" = x ; then  if test ! "x$GSL" = x ; then
1637        echo "  Turning on use of GSL to control floating point calculations"        echo "  Turning on use of GSL to control floating point calculations"
# Line 1636  rm -f genmake_t* Line 1719  rm -f genmake_t*
1719    
1720  printf "  Can we unlimit the stack size using $FC...  "  printf "  Can we unlimit the stack size using $FC...  "
1721  check_HAVE_SETRLSTK  check_HAVE_SETRLSTK
1722  if test "x$HAVE_SETRLSTK" != x ; then  if test "x$HAVE_SETRLSTK" = xt ; then
1723      echo "yes"      echo "yes"
1724  else  else
1725      echo "no"      echo "no"
# Line 1645  rm -f genmake_t* Line 1728  rm -f genmake_t*
1728    
1729  printf "  Can we register a signal handler using $FC...  "  printf "  Can we register a signal handler using $FC...  "
1730  check_HAVE_SIGREG  check_HAVE_SIGREG
1731  if test "x$HAVE_SIGREG" != x ; then  if test "x$HAVE_SIGREG" = xt ; then
1732      echo "yes"      echo "yes"
1733  else  else
1734      echo "no"      echo "no"
# Line 1763  if test -r $ROOTDIR"/eesupp/src/Makefile Line 1846  if test -r $ROOTDIR"/eesupp/src/Makefile
1846      fi      fi
1847  fi  fi
1848    
1849  #same for exch2  #same for pkg/exch2 and pkg/regrid
1850  if test -r $ROOTDIR"/pkg/exch2/Makefile" ; then  for pdir in exch2 regrid ; do
1851      echo "  Making source files in exch2 from  templates"      if test -r $ROOTDIR"/pkg/${pdir}/Makefile" ; then
1852      ( cd $ROOTDIR"/pkg/exch2/" && $MAKE ) > make_exch2.errors 2>&1          echo "  Making source files in pkg/${pdir} from templates"
1853      RETVAL=$?          ( cd $ROOTDIR"/pkg/"${pdir} && $MAKE ) > make_${pdir}.errors 2>&1
1854      if test "x${RETVAL}" = x0 ; then          RETVAL=$?
1855          rm -f make_exch2.errors          if test "x${RETVAL}" = x0 ; then
1856      else              rm -f make_${pdir}.errors
1857          echo "Error: problem encountered while building source files in exch2:"          else
1858          cat make_exch2.errors 1>&2              echo "Error: problem encountered while building source files in pkg/${pdir}:"
1859          exit 1              cat make_${pdir}.errors 1>&2
1860                exit 1
1861            fi
1862      fi      fi
1863  fi  done
1864    
1865  printf "\n===  Determining package settings  ===\n"  printf "\n===  Determining package settings  ===\n"
1866  if  test "x${PDEPEND}" = x ; then  if  test "x${PDEPEND}" = x ; then
# Line 1886  done Line 1971  done
1971  rm -f ./.tmp_pack  rm -f ./.tmp_pack
1972  echo "    packages are:  $PACKAGES"  echo "    packages are:  $PACKAGES"
1973    
1974  #  Check availability of NetCDF and then either build the MNC template  #  Check for package MNC: if NetCDF is available, then build the MNC
1975  #  files or delete mnc from the list of available packages.  #  template files ; otherwise, delete mnc from the list of packages.
1976  echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1  echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1
1977  RETVAL=$?  RETVAL=$?
1978  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
# Line 1921  EOF Line 2006  EOF
2006      fi      fi
2007  fi  fi
2008    
2009    #  Check for package PROFILES: if NetCDF is not available,
2010    #  then delete profiles from the list of available packages.
2011    echo $PACKAGES | grep ' profiles ' > /dev/null 2>&1
2012    RETVAL=$?
2013    if test "x$RETVAL" = x0 ; then
2014        if test "x$HAVE_NETCDF" != xt ; then
2015            cat <<EOF
2016    
2017    *********************************************************************
2018    WARNING: the "profiles" package was enabled but tests failed to
2019      compile NetCDF applications.  Please check that:
2020    
2021      1) NetCDF is correctly installed for this compiler and
2022      2) the LIBS variable (within the "optfile") specifies the correct
2023           NetCDF library to link against.
2024    
2025      Due to this failure, the "profiles" package is now DISABLED.
2026    *********************************************************************
2027    
2028    EOF
2029            PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`
2030            DISABLE="$DISABLE profiles"
2031        fi
2032    fi
2033    
2034  echo "  applying package dependency rules"  echo "  applying package dependency rules"
2035  ck=  ck=
2036  while test "x$ck" != xtt ; do  while test "x$ck" != xtt ; do
2037      i=0      i=0
2038      # rtot=${#PNAME[@]}      # rtot=${#PNAME[@]}
2039      rtot=$nname      rtot=$nname
2040      while test $i -lt $rtot ; do      while test $i -le $rtot ; do
2041    
2042          #  Is $pname in the current $PACKAGES list?          #  Is $pname in the current $PACKAGES list?
2043          #  pname=${PNAME[$i]}          #  pname=${PNAME[$i]}
# Line 1961  while test "x$ck" != xtt ; do Line 2071  while test "x$ck" != xtt ; do
2071    
2072          #  Do we need to add $dname according to the dependency rules?          #  Do we need to add $dname according to the dependency rules?
2073          if test "x$pin" = xt -a "x$plus" = "x+" -a "x$din" = xf ; then          if test "x$pin" = xt -a "x$plus" = "x+" -a "x$din" = xf ; then
2074                #echo "   " $pname ": need to add :" $dname
2075              in_dis="f"              in_dis="f"
2076              for dis in $DISABLE ; do              for dis in $DISABLE ; do
2077                  if test "x$dis" = "x$dname" ; then                  if test "x$dis" = "x$dname" ; then
# Line 2150  if test ! "x$DIVA" = x ; then Line 2261  if test ! "x$DIVA" = x ; then
2261          perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h          perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h
2262      else      else
2263          echo " We cannot create a copy of mpif.h!"          echo " We cannot create a copy of mpif.h!"
2264          exit -1  #       exit -1
2265      fi      fi
2266  fi  fi
2267    
# Line 2353  INCLUDES = ${INCLUDES} Line 2464  INCLUDES = ${INCLUDES}
2464  KFLAGS1 = ${KFLAGS1}  KFLAGS1 = ${KFLAGS1}
2465  KFLAGS2 = ${KFLAGS2}  KFLAGS2 = ${KFLAGS2}
2466  # Optim./debug for FC  # Optim./debug for FC
2467  FFLAGS = ${FFLAGS}  FFLAGS = ${FFLAGS} ${FEXTRAFLAGS}
2468  FOPTIM = ${FOPTIM}  FOPTIM = ${FOPTIM}
2469  # Optim./debug for FC  # Optim./debug for FC
2470  F90FLAGS = ${F90FLAGS}  F90FLAGS = ${F90FLAGS}
# Line 2401  lib: libmitgcmuv.a Line 2512  lib: libmitgcmuv.a
2512    
2513  libmitgcmuv.a: \$(OBJFILES)  libmitgcmuv.a: \$(OBJFILES)
2514          ar rcv libmitgcmuv.a \$(OBJFILES)          ar rcv libmitgcmuv.a \$(OBJFILES)
2515            ar d   libmitgcmuv.a main.o
2516    
2517  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)
2518    
# Line 2411  output.txt: \$(EXECUTABLE) Line 2523  output.txt: \$(EXECUTABLE)
2523          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
2524    
2525  clean:  clean:
2526          -rm -rf *.o *.$FS *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template          -rm -rf *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template
2527            -rm -rf *.o
2528            -rm -rf *.$FS
2529  Clean:  Clean:
2530          @make clean          @make clean
2531          @make cleanlinks          @make cleanlinks
2532          -rm -f \$(SPECIAL_FILES)          -rm -f \$(SPECIAL_FILES)
2533          -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak          -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak
2534            -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log
2535  CLEAN:  CLEAN:
2536          @make Clean          @make Clean
2537          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
2538          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
2539          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
2540          -rm -f \$(EXECUTABLE) output.txt STD*          -rm -f \$(EXECUTABLE) \$(EXE_AD) *.txt STD* *diagnostics.log datetime
2541            -rm -f *_MIT_CE_000.opt0000 costfunction*0000
2542            -rm -rf mnc_test_*
2543    
2544  #eh3 Makefile: makefile  #eh3 Makefile: makefile
2545  makefile:  makefile:
# Line 2480  cat >>$MAKEFILE <<EOF Line 2597  cat >>$MAKEFILE <<EOF
2597          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
2598  .$FS.o:  .$FS.o:
2599          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
2600  .F90.$FS90:  .F90.o:  
         \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@  
 .$FS90.o:  
2601          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<
2602  .c.o:  .c.o:
2603          \$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$<          \$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$<
# Line 2509  ad_vars="$ad_vars FTL_TAMC_FLAGS FTL_TAF Line 2624  ad_vars="$ad_vars FTL_TAMC_FLAGS FTL_TAF
2624  ad_vars="$ad_vars SVD_TAMC_FLAGS SVD_TAF_FLAGS"  ad_vars="$ad_vars SVD_TAMC_FLAGS SVD_TAF_FLAGS"
2625  for i in $ad_vars ; do  for i in $ad_vars ; do
2626      name=$i      name=$i
2627      t1="t2=\$"`echo $i`      t1="t2=\$"`echo "$i"`
2628      eval $t1      eval $t1
2629      printf "%-20s = " $name >> $MAKEFILE      printf "%-20s = " $name >> $MAKEFILE
2630      echo $t2 >> $MAKEFILE      echo "$t2" | sed -e 's| \+| |g' >> $MAKEFILE
2631  done  done
2632    
2633  echo "  Add the source list for AD code generation"  echo "  Add the source list for AD code generation"
# Line 2529  rm -f ad_files Line 2644  rm -f ad_files
2644  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
2645    
2646  # ... AD ...  # ... AD ...
2647  adall: ad_taf  adall: \$(EXE_AD)
2648  adtaf: ad_taf_output.$FS  adtaf: ad_taf_output.$FS
2649  adtamc: ad_tamc_output.$FS  adtamc: ad_tamc_output.$FS
2650    
# Line 2549  adtafonly: Line 2664  adtafonly:
2664          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
2665          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
2666    
2667  ad_taf: ad_taf_output.o \$(OBJFILES)  \${EXE_AD}: ad_taf_output.o \$(OBJFILES)
2668          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o \${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
2669    
2670  ad_tamc_output.$FS: ad_input_code.$FS  ad_tamc_output.$FS: ad_input_code.$FS
2671          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS

Legend:
Removed from v.1.143  
changed lines
  Added in v.1.168

  ViewVC Help
Powered by ViewVC 1.1.22