/[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.11.2.1 by adcroft, Wed Oct 1 18:44:48 2003 UTC revision 1.11.2.3 by edhill, Wed Oct 1 20:47:26 2003 UTC
# Line 11  Line 11 
11  # Search for particular CPP #cmds associated with packages  # Search for particular CPP #cmds associated with packages
12  # usage: test_for_package_in_cpp_options CPP_file package_name  # usage: test_for_package_in_cpp_options CPP_file package_name
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     grep -i "#define.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1      grep -i "#define.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1
17     RETVAL=$?      RETVAL=$?
18     if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
19        echo "Error: In $cpp_options there is an illegal line: #define ALLOW_$pkg"          echo "Error: In $cpp_options there is an illegal line: #define ALLOW_$pkg"
20        exit 99          exit 99
21     fi      fi
22     grep -i "#undef.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1      grep -i "#undef.*ALLOW_$pkg" $cpp_options > /dev/null 2>&1
23     RETVAL=$?      RETVAL=$?
24     if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
25        echo "Error: In $cpp_options there is an illegal line: #undef ALLOW_$pkg"          echo "Error: In $cpp_options there is an illegal line: #undef ALLOW_$pkg"
26        exit 99          exit 99
27     fi      fi
28     grep -i "#define.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1      grep -i "#define.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1
29     RETVAL=$?      RETVAL=$?
30     if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
31        echo "Error: In $cpp_options there is an illegal line: #define DISABLE_$pkg"          echo "Error: In $cpp_options there is an illegal line: #define DISABLE_$pkg"
32        exit 99          exit 99
33     fi      fi
34     grep -i "#undef.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1      grep -i "#undef.*DISABLE_$pkg" $cpp_options > /dev/null 2>&1
35     RETVAL=$?      RETVAL=$?
36     if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
37        echo "Error: In $cpp_options there is an illegal line: #undef DISABLE_$pkg"          echo "Error: In $cpp_options there is an illegal line: #undef DISABLE_$pkg"
38        exit 99          exit 99
39     fi     fi
40  }  }
41    
# Line 634  fi Line 634  fi
634  source ./.pd_tmp  source ./.pd_tmp
635  rm -f ./.pd_tmp  rm -f ./.pd_tmp
636    
637    #  Search for default packages.  Note that a "$ROOTDIR/pkg/pkg_groups"
638    #  file should eventually be added so that, for convenience, one can
639    #  specify groups of packages using names like "ocean" and "atmosphere".
640  echo  -n "  checking default package list:  "  echo  -n "  checking default package list:  "
641  if test "x${PDEFAULT}" = x ; then  if test "x${PDEFAULT}" = x ; then
642        for i in "." $MODS ; do
643            if test -r $i"/packages.conf" ; then
644                    PDEFAULT=$i"/packages.conf"
645                    break
646            fi
647        done
648    fi
649    if test "x${PDEFAULT}" = x ; then
650      PDEFAULT="$ROOTDIR/pkg/pkg_default"      PDEFAULT="$ROOTDIR/pkg/pkg_default"
651  fi  fi
652  if test "x${PDEFAULT}" = xNONE ; then  if test "x${PDEFAULT}" = xNONE ; then
# Line 795  done Line 806  done
806  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
807  PACKAGES_DOT_H=PACKAGES.h  PACKAGES_DOT_H=PACKAGES.h
808  if test -e $PACKAGES_DOT_H ; then  if test -e $PACKAGES_DOT_H ; then
     if test ! -e $PACKAGES_DOT_H.bak ; then  
         cp -f $PACKAGES_DOT_H $PACKAGES_DOT_H.bak  
     fi  
809      cat $PACKAGES_DOT_H \      cat $PACKAGES_DOT_H \
810          | awk 'BEGIN{p=1;} ($1=="C===" && $2=="GENMAKE"){p=0;} {if (p==1) print $0}' \          | awk 'BEGIN{p=1;} ($1=="C===" && $2=="GENMAKE"){p=0;} {if (p==1) print $0}' \
811          > $PACKAGES_DOT_H.tmp          > $PACKAGES_DOT_H".tmp"
812  fi  fi
813  cat <<EOF >>$PACKAGES_DOT_H.tmp  cat <<EOF >>$PACKAGES_DOT_H".tmp"
814  C=== GENMAKE v2 ===  C=== GENMAKE v2 ===
815  C  The following defines have been set by GENMAKE, so please do not  C  The following defines have been set by GENMAKE, so please do not
816  C  edit anything below these comments.  In general, you should  C  edit anything below these comments.  In general, you should
# Line 828  for n in $names ; do Line 836  for n in $names ; do
836          done          done
837          if test "x$has_pack" = xf ; then          if test "x$has_pack" = xf ; then
838              undef=`echo "ALLOW_$n" | awk '{print toupper($0)}'`              undef=`echo "ALLOW_$n" | awk '{print toupper($0)}'`
839              echo "#undef $undef" >> $PACKAGES_DOT_H.tmp              echo "#undef $undef" >> $PACKAGES_DOT_H".tmp"
840  #           DEFINES="$DEFINES -U$undef"  #           DEFINES="$DEFINES -U$undef"
841    
842  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
# Line 848  for n in $names ; do Line 856  for n in $names ; do
856          fi          fi
857      fi      fi
858  done  done
859  cat <<EOF >>$PACKAGES_DOT_H.tmp  cat <<EOF >>$PACKAGES_DOT_H".tmp"
860    
861  C  Packages enabled by genmake:  C  Packages enabled by genmake:
862  EOF  EOF
863  for i in $PACKAGES ; do  for i in $PACKAGES ; do
864      def=`echo "ALLOW_$i" | awk '{print toupper($0)}'`      def=`echo "ALLOW_$i" | awk '{print toupper($0)}'`
865      echo "#define $def" >> $PACKAGES_DOT_H.tmp      echo "#define $def" >> $PACKAGES_DOT_H".tmp"
866      DEFINES="$DEFINES -D$def"  #eh3 DEFINES="$DEFINES -D$def"
867    
868  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
869      case $i in      case $i in
870          aim_v23)          aim_v23)
871              echo "#define   ALLOW_AIM" >> $PACKAGES_DOT_H.tmp              echo "#define   ALLOW_AIM" >> $PACKAGES_DOT_H".tmp"
872              DEFINES="$DEFINES -DALLOW_AIM"              DEFINES="$DEFINES -DALLOW_AIM"
873              echo "Warning: ALLOW_AIM is set to enable aim_v23. This is REALLY ugly Jean-Michel :-)"              echo "Warning: ALLOW_AIM is set to enable aim_v23. This is REALLY ugly Jean-Michel :-)"
874              ;;              ;;
875      esac      esac
876  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
877    
878  done  done
879  mv -f $PACKAGES_DOT_H.tmp $PACKAGES_DOT_H  cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
880    RETVAL=$?
881    if test "x$RETVAL" = x0 ; then
882        mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H".bak"
883        mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
884    fi
885    
886  echo "  Adding STANDARDDIRS"  echo "  Adding STANDARDDIRS"
887  BUILDDIR=${BUILDDIR:-.}  BUILDDIR=${BUILDDIR:-.}
# Line 892  for d in $STANDARDDIRS ; do Line 905  for d in $STANDARDDIRS ; do
905      fi      fi
906  done  done
907    
908  echo "  Searching for CPP_OPTIONS.h (macros and flags for configuring the model):"  echo " Searching for CPP_OPTIONS.h in order to warn about the presence"
909    echo " of \"#define ALLOW_PKGNAME\"-type statements:"
910  CPP_OPTIONS=  CPP_OPTIONS=
911  spaths=". $INCLUDEDIRS"  spaths=". $INCLUDEDIRS"
912  for i in $spaths ; do  for i in $spaths ; do
# Line 901  for i in $spaths ; do Line 915  for i in $spaths ; do
915      if test -f $try -a -r $try ; then      if test -f $try -a -r $try ; then
916          echo "    found CPP_OPTIONS=\"$try\""          echo "    found CPP_OPTIONS=\"$try\""
917          CPP_OPTIONS="$try"          CPP_OPTIONS="$try"
 #aja    if test "x$i" != "x." ; then  
 #aja        cp -f $CPP_OPTIONS .  
 #aja    fi  
918          break          break
919      fi      fi
920  done  done
# Line 983  echo "" >> csrclist.inc Line 994  echo "" >> csrclist.inc
994  echo "" >> f90srclist.inc  echo "" >> f90srclist.inc
995  echo "" >> hlist.inc  echo "" >> hlist.inc
996    
 echo $DEFINES  
   
997  if test -e $MAKEFILE ; then  if test -e $MAKEFILE ; then
998      mv -f $MAKEFILE "$MAKEFILE.bak"      mv -f $MAKEFILE "$MAKEFILE.bak"
999  fi  fi

Legend:
Removed from v.1.11.2.1  
changed lines
  Added in v.1.11.2.3

  ViewVC Help
Powered by ViewVC 1.1.22