/[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.208 by jmc, Thu May 27 02:09:13 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 1215  for ac_option in "$@" ; do Line 1213  for ac_option in "$@" ; do
1213              AD_OPTFILE=$ac_optarg ;;              AD_OPTFILE=$ac_optarg ;;
1214                    
1215          -pdepend | --pdepend)          -pdepend | --pdepend)
1216              ac_prev=PDEPEND ;;              ac_prev=PKG_DEPEND ;;
1217          -pdepend=* | --pdepend=*)          -pdepend=* | --pdepend=*)
1218              PDEPEND=$ac_optarg ;;              PKG_DEPEND=$ac_optarg ;;
1219                    
1220          -pdefault | --pdefault)          -pgroups | --pgroups)
1221              ac_prev=PDEFAULT ;;              ac_prev=PKG_GROUPS ;;
1222          -pdefault=* | --pdefault=*)          -pgroups=* | --pgroups=*)
1223              PDEFAULT=$ac_optarg ;;              PKG_GROUPS=$ac_optarg ;;
1224                    
1225          -make | --make | -m | --m)          -make | --make | -m | --m)
1226              ac_prev=MAKE ;;              ac_prev=MAKE ;;
# Line 1913  for pdir in exch2 regrid ; do Line 1911  for pdir in exch2 regrid ; do
1911  done  done
1912    
1913  printf "\n===  Determining package settings  ===\n"  printf "\n===  Determining package settings  ===\n"
1914  if  test "x${PDEPEND}" = x ; then  if  test "x${PKG_DEPEND}" = x ; then
1915      tmp=$ROOTDIR"/pkg/pkg_depend"      tmp=$ROOTDIR"/pkg/pkg_depend"
1916      if test -r $tmp ; then      if test -r $tmp ; then PKG_DEPEND=$tmp ; fi
1917          PDEPEND=$tmp  fi
1918      else  if  test "x${PKG_DEPEND}" = x ; then
1919          echo "Warning:  No package dependency information was specified."          echo "Warning:  No package dependency information was specified."
1920          echo "  Please check that ROOTDIR/pkg/pkg_depend exists."          echo "  Please check that ROOTDIR/pkg/pkg_depend exists."
1921    else
1922        if test ! -r ${PKG_DEPEND} ; then
1923            echo "Error:  can't read package dependency info from PKG_DEPEND=\"$PKG_DEPEND\""
1924            exit 1
1925      fi      fi
1926        echo "  getting package dependency info from  $PKG_DEPEND"
1927    #  Strip the comments and then convert the dependency file into arrays: PNAME, DNAME
1928        get_pdepend_list $PKG_DEPEND
1929    fi
1930    
1931    # A default package groups file "$ROOTDIR/pkg/pkg_groups" is provided
1932    #  to define the "default_pkg_list" and package groups (for convenience, one
1933    #  can specify a group of packages using names like "ocean" and "atmosphere").
1934    if test "x${PKG_GROUPS}" = x ; then
1935        tmp=$ROOTDIR"/pkg/pkg_groups"
1936        if test -r $tmp ; then PKG_GROUPS=$tmp ; fi
1937    fi
1938    if test "x${PKG_GROUPS}" = x ; then
1939            echo "Warning:  No package groups information was specified."
1940            echo "  Please check that ROOTDIR/pkg/pkg_groups exists."
1941  else  else
1942      if test ! -r ${PDEPEND} ; then      if test ! -r ${PKG_GROUPS} ; then
1943          echo "Error:  can't read package dependency info from PDEPEND=\"$PDEPEND\""          echo "Error:  can't read package groups info from PKG_GROUPS=\"$PKG_GROUPS\""
1944          exit 1          exit 1
1945      fi      fi
1946        echo "  getting package groups info from      $PKG_GROUPS"
1947  fi  fi
1948  echo "  getting package dependency info from  $PDEPEND"  
1949  #  Strip the comments and then convert the dependency file into  #  Search for packages to compile.
1950  #  two arrays: PNAME, DNAME  echo "  checking list of packages to compile:"
1951  get_pdepend_list $PDEPEND  PKG_LIST=
1952    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  
1953      for i in "." $MODS ; do      for i in "." $MODS ; do
1954          if test -r $i"/packages.conf" ; then          if test -r $i"/packages.conf" ; then
1955                  PDEFAULT=$i"/packages.conf"                  PKG_LIST=$i"/packages.conf"
1956                  break                  break
1957          fi          fi
1958      done      done
1959  fi  fi
1960  if test "x${PDEFAULT}" = x ; then  if test "x${PKG_LIST}" = x ; then
1961      PDEFAULT="$ROOTDIR/pkg/pkg_default"      pkg_list='default_pkg_list'
1962  fi      if test "x${PKG_GROUPS}" = x ; then
1963  if test "x${PDEFAULT}" = xNONE ; then          echo "Error:  need package groups info to expand pkg_list=\"$pkg_list\""
1964      echo "    default packages file disabled"          exit 1
1965        fi
1966  else  else
1967      if test ! -r $PDEFAULT ; then      if test ! -r $PKG_LIST ; then
1968          echo "Warning:  can't read default packages from PDEFAULT=\"$PDEFAULT\""          echo "Error:  can't read package list from PKG_LIST=\"$PKG_LIST\""
1969            exit 1
1970      else      else
1971          echo "    using PDEFAULT=\"$PDEFAULT\""          echo "    using PKG_LIST=\"$PKG_LIST\""
1972          #  Strip the comments and add all the names          #  Strip the comments and add all the names
1973          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}'`
1974          RETVAL=$?          RETVAL=$?
1975          if test "x${RETVAL}" != x0 ; then          if test "x${RETVAL}" != x0 ; then
1976              printf "Error: can't parse default package list "              printf "Error: can't parse package list "
1977              echo "-- please check PDEFAULT=\"$PDEFAULT\""              echo "-- please check PKG_LIST=\"$PKG_LIST\""
1978              exit 1              exit 1
1979          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"  
1980      fi      fi
1981  fi  fi
1982    for i in $pkg_list ; do
1983        PACKAGES="$PACKAGES $i"
1984    done
1985    echo     "    before group expansion packages are:$PACKAGES"
1986    if test "x${PKG_GROUPS}" != x ; then
1987        RET=1
1988        while test $RET = 1 ; do expand_pkg_groups; RET=$?; done
1989        echo "    after group expansion packages are: $PACKAGES"
1990    fi
1991    
1992  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
1993  echo "" > ./.tmp_pack  echo "" > ./.tmp_pack
# Line 2001  PACKAGES="$PACKAGES $ENABLE" Line 2018  PACKAGES="$PACKAGES $ENABLE"
2018  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2019      j=`echo $i | sed 's/[-+]//'`      j=`echo $i | sed 's/[-+]//'`
2020      if test ! -d "$ROOTDIR/pkg/$j" ; then      if test ! -d "$ROOTDIR/pkg/$j" ; then
2021          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""          echo "Error: dir '$ROOTDIR/pkg/$i' missing for package '$i'"
2022          exit 1          exit 1
2023      fi      fi
2024      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
# Line 2020  mnc_in=$? Line 2037  mnc_in=$?
2037  if test "x$HAVE_NETCDF" != xt ; then  if test "x$HAVE_NETCDF" != xt ; then
2038      if test "x$mnc_in" = x0 ; then      if test "x$mnc_in" = x0 ; then
2039          cat <<EOF          cat <<EOF
   
2040  *********************************************************************  *********************************************************************
2041  WARNING: the "mnc" package was enabled but tests failed to compile  WARNING: the "mnc" package was enabled but tests failed to compile
2042    NetCDF applications.  Please check that:    NetCDF applications.  Please check that:
# Line 2031  WARNING: the "mnc" package was enabled b Line 2047  WARNING: the "mnc" package was enabled b
2047    
2048    Due to this failure, the "mnc" package is now DISABLED.    Due to this failure, the "mnc" package is now DISABLED.
2049  *********************************************************************  *********************************************************************
   
2050  EOF  EOF
2051          PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`          PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`
2052          DISABLE="$DISABLE mnc"          DISABLE="$DISABLE mnc"
# Line 2063  if test "x$HAVE_NETCDF" != xt ; then Line 2078  if test "x$HAVE_NETCDF" != xt ; then
2078      RETVAL=$?      RETVAL=$?
2079      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
2080          cat <<EOF          cat <<EOF
   
2081  *********************************************************************  *********************************************************************
2082  WARNING: the "profiles" package was enabled but tests failed to  WARNING: the "profiles" package was enabled but tests failed to
2083    compile NetCDF applications.  Please check that:    compile NetCDF applications.  Please check that:
# Line 2074  WARNING: the "profiles" package was enab Line 2088  WARNING: the "profiles" package was enab
2088    
2089    Due to this failure, the "profiles" package is now DISABLED.    Due to this failure, the "profiles" package is now DISABLED.
2090  *********************************************************************  *********************************************************************
   
2091  EOF  EOF
2092          PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`          PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`
2093          DISABLE="$DISABLE profiles"          DISABLE="$DISABLE profiles"
# Line 2084  EOF Line 2097  EOF
2097      fi      fi
2098  fi  fi
2099    
2100  echo "  applying package dependency rules"  if  test "x${PKG_DEPEND}" != x ; then
2101  ck=    echo "  applying package dependency rules"
2102  while test "x$ck" != xtt ; do    ck=
2103      while test "x$ck" != xtt ; do
2104      i=0      i=0
2105      # rtot=${#PNAME[@]}      # rtot=${#PNAME[@]}
2106      rtot=$nname      rtot=$nname
# Line 2157  while test "x$ck" != xtt ; do Line 2171  while test "x$ck" != xtt ; do
2171          #i=$(( $i + 1 ))          #i=$(( $i + 1 ))
2172      done      done
2173      ck=$ck"t"      ck=$ck"t"
2174  done    done
2175  echo "    packages are: $PACKAGES"    echo "    packages are: $PACKAGES"
2176    fi
2177  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2178      adr="$ROOTDIR/pkg/$i"      adr="$ROOTDIR/pkg/$i"
2179      if test -d $adr ; then      if test -d $adr ; then

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

  ViewVC Help
Powered by ViewVC 1.1.22