/[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.207 by jmc, Wed May 26 00:08:18 2010 UTC revision 1.209 by jmc, Mon Nov 1 00:20:28 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 484  get_pdepend_list()  { Line 483  get_pdepend_list()  {
483          > ./.pd_tmp          > ./.pd_tmp
484      RETVAL=$?      RETVAL=$?
485      if test ! "x${RETVAL}" = x0 ; then      if test ! "x${RETVAL}" = x0 ; then
486        echo "Error: unable to parse package dependencies -- please check PDEPEND=\"$1\""        echo "Error: unable to parse package dependencies -- please check PKG_DEPEND=\"$1\""
487        exit 1        exit 1
488      fi      fi
489      . ./.pd_tmp      . ./.pd_tmp
# Line 519  Usage: "$0" [OPTIONS] Line 518  Usage: "$0" [OPTIONS]
518        -pdepend=NAME | --pdepend=NAME        -pdepend=NAME | --pdepend=NAME
519            Get package dependency information from "NAME".            Get package dependency information from "NAME".
520    
521      -pdefault NAME | --pdefault NAME      -pgroups NAME | --pgroups NAME
522        -pdefault=NAME | --pdefault=NAME        -pgroups=NAME | --pgroups=NAME
523            Get the default package list from "NAME".            Get the package groups information from "NAME".
524    
525      -bash NAME      -bash NAME
526            Explicitly specify the Bourne or BASH shell to use            Explicitly specify the Bourne or BASH shell to use
# Line 1051  ENABLE= Line 1050  ENABLE=
1050  DISABLE=  DISABLE=
1051  # MAKEFILE=  # MAKEFILE=
1052  # MAKEDEPEND=  # MAKEDEPEND=
1053  PDEPEND=  PKG_DEPEND=
1054    PKG_GROUPS=
1055  DUMPSTATE=t  DUMPSTATE=t
 PDEFAULT=  
1056  OPTFILE=  OPTFILE=
1057  INCLUDES="-I. $INCLUDES"  INCLUDES="-I. $INCLUDES"
1058  FFLAGS=  FFLAGS=
# Line 1138  FTL_TAF_FLAGS= Line 1137  FTL_TAF_FLAGS=
1137  SVD_TAMC_FLAGS=  SVD_TAMC_FLAGS=
1138  TAMC_EXTRA=  TAMC_EXTRA=
1139    
   
1140  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1141  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"
1142  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"
1143    
1144  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1145  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"
1146  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS LIBS KPP KFLAGS1 KFLAGS2 KPPFILES NOOPTFILES NOOPTFLAGS"
1147  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD THISHOST THISUSER THISDATE THISVER MACHINE"
1148  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
1149  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME"  gm_s7="FC_NAMEMANGLE HAVE_NETCDF HAVE_SYSTEM HAVE_FDATE HAVE_ETIME"
1150    
1151  #  The following are all related to adjoint/tangent-linear stuff  #  The following are all related to adjoint/tangent-linear stuff
1152  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 1169  quick list of options, use "genmake -h" Line 1167  quick list of options, use "genmake -h"
1167    
1168  EOF  EOF
1169    
1170    #- clean-up previous genmake logfiles:
1171    rm -f genmake_state genmake_*optfile genmake_warnings genmake_errors
1172    
1173  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
1174  gm_local="genmake_local"  gm_local="genmake_local"
1175  printf "  getting local config information:  "  printf "  getting local config information:  "
# Line 1215  for ac_option in "$@" ; do Line 1216  for ac_option in "$@" ; do
1216              AD_OPTFILE=$ac_optarg ;;              AD_OPTFILE=$ac_optarg ;;
1217                    
1218          -pdepend | --pdepend)          -pdepend | --pdepend)
1219              ac_prev=PDEPEND ;;              ac_prev=PKG_DEPEND ;;
1220          -pdepend=* | --pdepend=*)          -pdepend=* | --pdepend=*)
1221              PDEPEND=$ac_optarg ;;              PKG_DEPEND=$ac_optarg ;;
1222                    
1223          -pdefault | --pdefault)          -pgroups | --pgroups)
1224              ac_prev=PDEFAULT ;;              ac_prev=PKG_GROUPS ;;
1225          -pdefault=* | --pdefault=*)          -pgroups=* | --pgroups=*)
1226              PDEFAULT=$ac_optarg ;;              PKG_GROUPS=$ac_optarg ;;
1227                    
1228          -make | --make | -m | --m)          -make | --make | -m | --m)
1229              ac_prev=MAKE ;;              ac_prev=MAKE ;;
# Line 1913  for pdir in exch2 regrid ; do Line 1914  for pdir in exch2 regrid ; do
1914  done  done
1915    
1916  printf "\n===  Determining package settings  ===\n"  printf "\n===  Determining package settings  ===\n"
1917  if  test "x${PDEPEND}" = x ; then  if  test "x${PKG_DEPEND}" = x ; then
1918      tmp=$ROOTDIR"/pkg/pkg_depend"      tmp=$ROOTDIR"/pkg/pkg_depend"
1919      if test -r $tmp ; then      if test -r $tmp ; then PKG_DEPEND=$tmp ; fi
1920          PDEPEND=$tmp  fi
1921      else  if  test "x${PKG_DEPEND}" = x ; then
1922          echo "Warning:  No package dependency information was specified."          echo "Warning:  No package dependency information was specified."
1923          echo "  Please check that ROOTDIR/pkg/pkg_depend exists."          echo "  Please check that ROOTDIR/pkg/pkg_depend exists."
1924    else
1925        if test ! -r ${PKG_DEPEND} ; then
1926            echo "Error:  can't read package dependency info from PKG_DEPEND=\"$PKG_DEPEND\""
1927            exit 1
1928      fi      fi
1929        echo "  getting package dependency info from  $PKG_DEPEND"
1930    #  Strip the comments and then convert the dependency file into arrays: PNAME, DNAME
1931        get_pdepend_list $PKG_DEPEND
1932    fi
1933    
1934    # A default package groups file "$ROOTDIR/pkg/pkg_groups" is provided
1935    #  to define the "default_pkg_list" and package groups (for convenience, one
1936    #  can specify a group of packages using names like "ocean" and "atmosphere").
1937    if test "x${PKG_GROUPS}" = x ; then
1938        tmp=$ROOTDIR"/pkg/pkg_groups"
1939        if test -r $tmp ; then PKG_GROUPS=$tmp ; fi
1940    fi
1941    if test "x${PKG_GROUPS}" = x ; then
1942            echo "Warning:  No package groups information was specified."
1943            echo "  Please check that ROOTDIR/pkg/pkg_groups exists."
1944  else  else
1945      if test ! -r ${PDEPEND} ; then      if test ! -r ${PKG_GROUPS} ; then
1946          echo "Error:  can't read package dependency info from PDEPEND=\"$PDEPEND\""          echo "Error:  can't read package groups info from PKG_GROUPS=\"$PKG_GROUPS\""
1947          exit 1          exit 1
1948      fi      fi
1949        echo "  getting package groups info from      $PKG_GROUPS"
1950  fi  fi
1951  echo "  getting package dependency info from  $PDEPEND"  
1952  #  Strip the comments and then convert the dependency file into  #  Search for packages to compile.
1953  #  two arrays: PNAME, DNAME  echo "  checking list of packages to compile:"
1954  get_pdepend_list $PDEPEND  PKG_LIST=
1955    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  
1956      for i in "." $MODS ; do      for i in "." $MODS ; do
1957          if test -r $i"/packages.conf" ; then          if test -r $i"/packages.conf" ; then
1958                  PDEFAULT=$i"/packages.conf"                  PKG_LIST=$i"/packages.conf"
1959                  break                  break
1960          fi          fi
1961      done      done
1962  fi  fi
1963  if test "x${PDEFAULT}" = x ; then  if test "x${PKG_LIST}" = x ; then
1964      PDEFAULT="$ROOTDIR/pkg/pkg_default"      pkg_list='default_pkg_list'
1965  fi      if test "x${PKG_GROUPS}" = x ; then
1966  if test "x${PDEFAULT}" = xNONE ; then          echo "Error:  need package groups info to expand pkg_list=\"$pkg_list\""
1967      echo "    default packages file disabled"          exit 1
1968        fi
1969  else  else
1970      if test ! -r $PDEFAULT ; then      if test ! -r $PKG_LIST ; then
1971          echo "Warning:  can't read default packages from PDEFAULT=\"$PDEFAULT\""          echo "Error:  can't read package list from PKG_LIST=\"$PKG_LIST\""
1972            exit 1
1973      else      else
1974          echo "    using PDEFAULT=\"$PDEFAULT\""          echo "    using PKG_LIST=\"$PKG_LIST\""
1975          #  Strip the comments and add all the names          #  Strip the comments and add all the names
1976          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}'`
1977          RETVAL=$?          RETVAL=$?
1978          if test "x${RETVAL}" != x0 ; then          if test "x${RETVAL}" != x0 ; then
1979              printf "Error: can't parse default package list "              printf "Error: can't parse package list "
1980              echo "-- please check PDEFAULT=\"$PDEFAULT\""              echo "-- please check PKG_LIST=\"$PKG_LIST\""
1981              exit 1              exit 1
1982          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"  
1983      fi      fi
1984  fi  fi
1985    for i in $pkg_list ; do
1986        PACKAGES="$PACKAGES $i"
1987    done
1988    echo     "    before group expansion packages are:$PACKAGES"
1989    if test "x${PKG_GROUPS}" != x ; then
1990        RET=1
1991        while test $RET = 1 ; do expand_pkg_groups; RET=$?; done
1992        echo "    after group expansion packages are: $PACKAGES"
1993    fi
1994    
1995  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
1996  echo "" > ./.tmp_pack  echo "" > ./.tmp_pack
# Line 2001  PACKAGES="$PACKAGES $ENABLE" Line 2021  PACKAGES="$PACKAGES $ENABLE"
2021  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2022      j=`echo $i | sed 's/[-+]//'`      j=`echo $i | sed 's/[-+]//'`
2023      if test ! -d "$ROOTDIR/pkg/$j" ; then      if test ! -d "$ROOTDIR/pkg/$j" ; then
2024          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"
2025          exit 1          exit 1
2026      fi      fi
2027      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
# Line 2020  mnc_in=$? Line 2040  mnc_in=$?
2040  if test "x$HAVE_NETCDF" != xt ; then  if test "x$HAVE_NETCDF" != xt ; then
2041      if test "x$mnc_in" = x0 ; then      if test "x$mnc_in" = x0 ; then
2042          cat <<EOF          cat <<EOF
   
2043  *********************************************************************  *********************************************************************
2044  WARNING: the "mnc" package was enabled but tests failed to compile  WARNING: the "mnc" package was enabled but tests failed to compile
2045    NetCDF applications.  Please check that:    NetCDF applications.  Please check that:
# Line 2031  WARNING: the "mnc" package was enabled b Line 2050  WARNING: the "mnc" package was enabled b
2050    
2051    Due to this failure, the "mnc" package is now DISABLED.    Due to this failure, the "mnc" package is now DISABLED.
2052  *********************************************************************  *********************************************************************
   
2053  EOF  EOF
2054          PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`          PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`
2055          DISABLE="$DISABLE mnc"          DISABLE="$DISABLE mnc"
# Line 2063  if test "x$HAVE_NETCDF" != xt ; then Line 2081  if test "x$HAVE_NETCDF" != xt ; then
2081      RETVAL=$?      RETVAL=$?
2082      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
2083          cat <<EOF          cat <<EOF
   
2084  *********************************************************************  *********************************************************************
2085  WARNING: the "profiles" package was enabled but tests failed to  WARNING: the "profiles" package was enabled but tests failed to
2086    compile NetCDF applications.  Please check that:    compile NetCDF applications.  Please check that:
# Line 2074  WARNING: the "profiles" package was enab Line 2091  WARNING: the "profiles" package was enab
2091    
2092    Due to this failure, the "profiles" package is now DISABLED.    Due to this failure, the "profiles" package is now DISABLED.
2093  *********************************************************************  *********************************************************************
   
2094  EOF  EOF
2095          PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`          PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`
2096          DISABLE="$DISABLE profiles"          DISABLE="$DISABLE profiles"
# Line 2084  EOF Line 2100  EOF
2100      fi      fi
2101  fi  fi
2102    
2103  echo "  applying package dependency rules"  if  test "x${PKG_DEPEND}" != x ; then
2104  ck=    echo "  applying package dependency rules"
2105  while test "x$ck" != xtt ; do    ck=
2106      while test "x$ck" != xtt ; do
2107      i=0      i=0
2108      # rtot=${#PNAME[@]}      # rtot=${#PNAME[@]}
2109      rtot=$nname      rtot=$nname
# Line 2157  while test "x$ck" != xtt ; do Line 2174  while test "x$ck" != xtt ; do
2174          #i=$(( $i + 1 ))          #i=$(( $i + 1 ))
2175      done      done
2176      ck=$ck"t"      ck=$ck"t"
2177  done    done
2178  echo "    packages are: $PACKAGES"    echo "    packages are: $PACKAGES"
2179    fi
2180  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2181      adr="$ROOTDIR/pkg/$i"      adr="$ROOTDIR/pkg/$i"
2182      if test -d $adr ; then      if test -d $adr ; then
# Line 2680  Clean: Line 2698  Clean:
2698          @make clean          @make clean
2699          @make cleanlinks          @make cleanlinks
2700          -rm -f \$(SPECIAL_FILES)          -rm -f \$(SPECIAL_FILES)
         -rm -f genmake_state genmake_*optfile genmake_warnings genmake_errors  
2701          -rm -f make.log run.log f90mkdepend.log *.bak "$MAKEFILE.old"          -rm -f make.log run.log f90mkdepend.log *.bak "$MAKEFILE.old"
2702          -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
2703  CLEAN:  CLEAN:
2704          @make Clean          @make Clean
2705            -rm -f genmake_state genmake_*optfile genmake_warnings genmake_errors
2706          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
2707          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
2708          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;

Legend:
Removed from v.1.207  
changed lines
  Added in v.1.209

  ViewVC Help
Powered by ViewVC 1.1.22