/[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.2 by edhill, Wed Oct 1 19:33:01 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 795  done Line 795  done
795  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
796  PACKAGES_DOT_H=PACKAGES.h  PACKAGES_DOT_H=PACKAGES.h
797  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  
798      cat $PACKAGES_DOT_H \      cat $PACKAGES_DOT_H \
799          | 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}' \
800          > $PACKAGES_DOT_H.tmp          > $PACKAGES_DOT_H".tmp"
801  fi  fi
802  cat <<EOF >>$PACKAGES_DOT_H.tmp  cat <<EOF >>$PACKAGES_DOT_H".tmp"
803  C=== GENMAKE v2 ===  C=== GENMAKE v2 ===
804  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
805  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 825  for n in $names ; do
825          done          done
826          if test "x$has_pack" = xf ; then          if test "x$has_pack" = xf ; then
827              undef=`echo "ALLOW_$n" | awk '{print toupper($0)}'`              undef=`echo "ALLOW_$n" | awk '{print toupper($0)}'`
828              echo "#undef $undef" >> $PACKAGES_DOT_H.tmp              echo "#undef $undef" >> $PACKAGES_DOT_H".tmp"
829  #           DEFINES="$DEFINES -U$undef"  #           DEFINES="$DEFINES -U$undef"
830    
831  #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 845  for n in $names ; do
845          fi          fi
846      fi      fi
847  done  done
848  cat <<EOF >>$PACKAGES_DOT_H.tmp  cat <<EOF >>$PACKAGES_DOT_H".tmp"
849    
850  C  Packages enabled by genmake:  C  Packages enabled by genmake:
851  EOF  EOF
852  for i in $PACKAGES ; do  for i in $PACKAGES ; do
853      def=`echo "ALLOW_$i" | awk '{print toupper($0)}'`      def=`echo "ALLOW_$i" | awk '{print toupper($0)}'`
854      echo "#define $def" >> $PACKAGES_DOT_H.tmp      echo "#define $def" >> $PACKAGES_DOT_H".tmp"
855      DEFINES="$DEFINES -D$def"  #eh3 DEFINES="$DEFINES -D$def"
856    
857  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
858      case $i in      case $i in
859          aim_v23)          aim_v23)
860              echo "#define   ALLOW_AIM" >> $PACKAGES_DOT_H.tmp              echo "#define   ALLOW_AIM" >> $PACKAGES_DOT_H".tmp"
861              DEFINES="$DEFINES -DALLOW_AIM"              DEFINES="$DEFINES -DALLOW_AIM"
862              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 :-)"
863              ;;              ;;
864      esac      esac
865  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
866    
867  done  done
868  mv -f $PACKAGES_DOT_H.tmp $PACKAGES_DOT_H  cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
869    RETVAL=$?
870    if test "x$RETVAL" = x0 ; then
871        mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H".bak"
872        mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
873    fi
874    
875  echo "  Adding STANDARDDIRS"  echo "  Adding STANDARDDIRS"
876  BUILDDIR=${BUILDDIR:-.}  BUILDDIR=${BUILDDIR:-.}
# Line 892  for d in $STANDARDDIRS ; do Line 894  for d in $STANDARDDIRS ; do
894      fi      fi
895  done  done
896    
897  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"
898    echo " of \"#define ALLOW_PKGNAME\"-type statements:"
899  CPP_OPTIONS=  CPP_OPTIONS=
900  spaths=". $INCLUDEDIRS"  spaths=". $INCLUDEDIRS"
901  for i in $spaths ; do  for i in $spaths ; do
# Line 901  for i in $spaths ; do Line 904  for i in $spaths ; do
904      if test -f $try -a -r $try ; then      if test -f $try -a -r $try ; then
905          echo "    found CPP_OPTIONS=\"$try\""          echo "    found CPP_OPTIONS=\"$try\""
906          CPP_OPTIONS="$try"          CPP_OPTIONS="$try"
 #aja    if test "x$i" != "x." ; then  
 #aja        cp -f $CPP_OPTIONS .  
 #aja    fi  
907          break          break
908      fi      fi
909  done  done
# Line 983  echo "" >> csrclist.inc Line 983  echo "" >> csrclist.inc
983  echo "" >> f90srclist.inc  echo "" >> f90srclist.inc
984  echo "" >> hlist.inc  echo "" >> hlist.inc
985    
 echo $DEFINES  
   
986  if test -e $MAKEFILE ; then  if test -e $MAKEFILE ; then
987      mv -f $MAKEFILE "$MAKEFILE.bak"      mv -f $MAKEFILE "$MAKEFILE.bak"
988  fi  fi

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

  ViewVC Help
Powered by ViewVC 1.1.22