/[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.53 by edhill, Fri Dec 5 15:08:33 2003 UTC revision 1.75 by edhill, Wed Apr 7 20:28:09 2004 UTC
# Line 37  test_for_string_in_file() { Line 37  test_for_string_in_file() {
37      grep -i "$strng" $file > /dev/null 2>&1      grep -i "$strng" $file > /dev/null 2>&1
38      RETVAL=$?      RETVAL=$?
39      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
40          echo -n "Error: In $file there is an illegal line: "          printf "Error: In $file there is an illegal line: "
41          grep -i "$strng" $file          grep -i "$strng" $file
42          return 1          return 1
43      fi      fi
# Line 67  expand_pkg_groups() { Line 67  expand_pkg_groups() {
67          done          done
68          PACKAGES=$new_packages          PACKAGES=$new_packages
69          rm -f ./p[1,2].tmp          rm -f ./p[1,2].tmp
70            return $matched
71      else      else
72          echo "Warning: can't read package groups definition file: $PKG_GROUPS"          echo "Warning: can't read package groups definition file: $PKG_GROUPS"
73      fi      fi
74  }  }
75    
76    #  Check for broken environments (eg. cygwin, MacOSX w/HFS+) that
77    #  cannot distinguish [*.F/*.F90] from [*.f/*.f90] files.
78    check_for_broken_Ff()  {
79        #  First check the ability to create a *.F/.f pair.
80        cat <<EOF >> ./hello.F
81          program hello
82          write(*,*) 'hi'
83          stop
84          end
85    EOF
86        cp ./hello.F ./hello.f
87        RETVAL=$?
88        if test "x$RETVAL" != x0 ; then
89            FEXT='fp'
90            F90EXT='fp90'
91            return
92        fi
93        rm -f ./hello.f
94    
95        #  Then check the ability of ${MAKE} to use the two.
96        test -e Makefile  &&  mv -f Makefile Makefile.bak
97        cat <<EOF >> Makefile
98    .SUFFIXES:
99    hello.f: hello.F
100            cp -f hello.F hello.f
101    EOF
102        ( $MAKE hello.f ) > /dev/null 2>&1
103        RETVAL=$?
104        if test "x$RETVAL" != x0 -o ! -f ./hello.f ; then
105            FEXT='fp'
106            F90EXT='fp90'
107            return
108        fi
109        rm -f ./hello.f ./hello.F Makefile
110        test -e Makefile  &&  mv -f Makefile.bak Makefile
111    
112        #  Both tests passed, so use the default.
113        FEXT='F'
114        F90EXT='F90'
115    }
116    
117    
118  # Guess possible config options for this host  # Guess possible config options for this host
119  find_possible_configs()  {  find_possible_configs()  {
120    
121      tmp1=`uname`"_"`uname -m`      tmp1=`uname`"_"`uname -m`
122      tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`      tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
123      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
124      PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`      tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`
125        tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
126        tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`
127        PLATFORM=$tmp3
128      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
129      echo "  The platform appears to be:  $PLATFORM"      echo "  The platform appears to be:  $PLATFORM"
130            
# Line 98  find_possible_configs()  { Line 144  find_possible_configs()  {
144          CPP="cpp -traditional -P"          CPP="cpp -traditional -P"
145      fi      fi
146    
147      # makedepend is not always available      #  The "original" makedepend is part of the Imake system that is
148        #  most often distributed with XFree86 or with an XFree86 source
149        #  package.  As a result, many machines (eg. generic Linux) do not
150        #  have a system-default "makedepend" available.  For those
151        #  systems, we have two fall-back options:
152        #
153        #    1) a makedepend implementation shipped with the cyrus-imapd
154        #       package:  ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
155        #
156        #    2) a known-buggy xmakedpend shell script
157        #
158        #  So the choices are, in order:
159        #
160        #    1) use the user-specified program
161        #    2) use a system-wide default
162        #    3) locally build and use the cyrus implementation
163        #    4) fall back to the buggy local xmakedpend script
164        #
165      if test "x${MAKEDEPEND}" = x ; then      if test "x${MAKEDEPEND}" = x ; then
166        which makedepend >& /dev/null        which makedepend > /dev/null 2>&1
167        RETVAL=$?        RETVAL=$?
168        if test "x${RETVAL}" = x1 ; then        if test ! "x${RETVAL}" = x0 ; then
169           echo "    makedepend was not found. Using xmakedpend instead."           echo "    a system-default makedepend was not found."
170           MAKEDEPEND='$(TOOLSDIR)/xmakedepend'  
171             #  Try to build the cyrus impl
172             rm -f ./genmake_cy_md
173             (
174                 cd $ROOTDIR/tools/cyrus-imapd-makedepend  \
175                     &&  ./configure > /dev/null 2>&1  \
176                     &&  make > /dev/null 2>&1  \
177                     &&  ./makedepend ifparser.c > /dev/null 2>&1  \
178                     &&  echo "true"
179             ) > ./genmake_cy_md
180             grep true ./genmake_cy_md > /dev/null 2>&1
181             RETVAL=$?
182             if test "x$RETVAL" = x0 ; then
183                 MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend'
184             else
185                 MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
186             fi
187             rm -f ./genmake_cy_md
188        fi        fi
189      fi      fi
190    
# Line 143  EOF Line 223  EOF
223          echo "   "$p_FC          echo "   "$p_FC
224          if test "x$FC" = x ; then          if test "x$FC" = x ; then
225              FC=`echo $p_FC | $AWK '{print $1}'`              FC=`echo $p_FC | $AWK '{print $1}'`
226                echo "  Setting FORTRAN compiler to: "$FC
227          fi          fi
228      fi      fi
229    
230      for i in $p_FC ; do      if test "x$OPTFILE" = x ; then
231          p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i          OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$FC
232          if test -r $p_OF ; then          if test ! -r $OPTFILE ; then
233              OPTFILE=$p_OF               echo "  I looked for the file "$OPTFILE" but did not find it"
234              echo "  The options file:  $p_OF"          fi
235              echo "    appears to match so we'll use it."      fi
236              break  #    echo "  The options file:  $p_OF"
237          fi  #    echo "    appears to match so we'll use it."
238      done  #   for i in $p_FC ; do
239    #p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i
240    #if test -r $p_OF ; then
241    #    OPTFILE=$p_OF
242    #    echo "  The options file:  $p_OF"
243    #    echo "    appears to match so we'll use it."
244    #    break
245    #fi
246    #   done
247      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
248          cat 1>&2 <<EOF          cat 1>&2 <<EOF
249    
# Line 213  get_pdepend_list()  { Line 302  get_pdepend_list()  {
302      . ./.pd_tmp      . ./.pd_tmp
303      rm -f ./.pd_tmp      rm -f ./.pd_tmp
304    
305      echo -n "PNAME = "${}      printf "PNAME = "${}
306  }  }
307    
308    
# Line 251  Usage: "$0" [OPTIONS] Line 340  Usage: "$0" [OPTIONS]
340        --makefile=NAME | -mf=NAME        --makefile=NAME | -mf=NAME
341            Call the makefile "NAME".  The default is "Makefile".            Call the makefile "NAME".  The default is "Makefile".
342    
343        -makedepend NAME | -md NAME
344          --makedepend=NAME | -md=NAME
345              Use "NAME" for the MAKEDEPEND program.
346    
347      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME
348        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME
349            Specify the location of the MITgcm ROOTDIR as "NAME".            Specify the location of the MITgcm ROOTDIR as "NAME".
# Line 292  Usage: "$0" [OPTIONS] Line 385  Usage: "$0" [OPTIONS]
385            *only* works if it is supported by the OPTFILE that            *only* works if it is supported by the OPTFILE that
386            is being used.            is being used.
387    
388        -mpi | --mpi
389              Include MPI header files and link to MPI libraries
390        -mpi=PATH | --mpi=PATH
391              Include MPI header files and link to MPI libraries using MPI_ROOT
392              set to PATH. i.e. Include files from $PATH/include, link to libraries
393              from $PATH/lib and use binaries from $PATH/bin.
394    
395        -bash NAME
396              Explicitly specify the Bourne or BASH shell to use
397    
398    While it is most often a single word, the "NAME" variables specified    While it is most often a single word, the "NAME" variables specified
399    above can in many cases be a space-delimited string such as:    above can in many cases be a space-delimited string such as:
400    
# Line 435  EOF Line 538  EOF
538  }  }
539    
540    
541    check_netcdf_libs()  {
542        cat <<EOF > genmake_tnc.for
543          program fgennc
544    #include "netcdf.inc"
545          integer iret, ncid, xid
546          iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)
547          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
548          iret = nf_def_dim(ncid, 'X', 11, xid)
549          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
550          iret = nf_close(ncid)
551          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
552          end
553    EOF
554        $CPP genmake_tnc.for > genmake_tnc.f  \
555            &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1
556        RET_COMPILE=$?
557        test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
558        RETVAL=$?
559        if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
560            HAVE_NETCDF=t
561        else
562            # try again with "-lnetcdf" added to the libs
563            $CPP genmake_tnc.for > genmake_tnc.f  \
564                &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \
565                $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1
566            RET_COMPILE=$?
567            test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
568            RETVAL=$?
569            if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
570                LIBS="$LIBS -lnetcdf"
571                HAVE_NETCDF=t
572            else
573                cat genmake_tnc.log >> genmake_warnings
574            fi
575        fi
576        rm -f genmake_tnc*
577    }
578    
579    
580    
581    ###############################################################################
582    #   Sequential part of script starts here
583    ###############################################################################
584    
585  #  Set defaults here  #  Set defaults here
586  COMMANDL="$0 $@"  COMMANDL="$0 $@"
587    
# Line 443  LN= Line 590  LN=
590  S64=  S64=
591  KPP=  KPP=
592  FC=  FC=
593    CPP=
594  LINK=  LINK=
 # DEFINES="-DWORDLENGTH=4"  
595  DEFINES=  DEFINES=
596  PACKAGES=  PACKAGES=
597  ENABLE=  ENABLE=
# Line 461  FOPTIM= Line 608  FOPTIM=
608  CFLAGS=  CFLAGS=
609  KFLAGS1=  KFLAGS1=
610  KFLAGS2=  KFLAGS2=
611    #LDADD=
612  LIBS=  LIBS=
613  KPPFILES=  KPPFILES=
614  NOOPTFILES=  NOOPTFILES=
615  NOOPTFLAGS=  NOOPTFLAGS=
616    MPI=
617    MPIPATH=
618    
619  # DEFINES checked by test compilation  # DEFINES checked by test compilation
620  HAVE_SYSTEM=  HAVE_SYSTEM=
621  HAVE_FDATE=  HAVE_FDATE=
622  FC_NAMEMANGLE=  FC_NAMEMANGLE=
623  HAVE_CLOC=  HAVE_CLOC=
624    HAVE_NETCDF=
625    
626  MODS=  MODS=
627  TOOLSDIR=  TOOLSDIR=
628  SOURCEDIRS=  SOURCEDIRS=
629  INCLUDEDIRS=  INCLUDEDIRS=
630  STANDARDDIRS=  STANDARDDIRS="USE_THE_DEFAULT"
631    
632    G2ARGS=
633    BASH=
634  PWD=`pwd`  PWD=`pwd`
635  MAKE=make  MAKE=make
636  AWK=awk  AWK=awk
# Line 493  IEEE= Line 646  IEEE=
646  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
647      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
648  fi  fi
649    FEXT=
650    F90EXT=
651    
652  AUTODIFF_PKG_USED=f  AUTODIFF_PKG_USED=f
653  AD_OPTFILE=  AD_OPTFILE=
# Line 510  TAMC_EXTRA= Line 665  TAMC_EXTRA=
665    
666  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
667  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
668  gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS"  gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS"
669    
670  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
671  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 "
# Line 546  for i in . $MODS ; do Line 701  for i in . $MODS ; do
701          break          break
702      fi      fi
703  done  done
704  echo -n "  getting local config information:  "  printf "  getting local config information:  "
705  if test -e $gm_local ; then  if test -e $gm_local ; then
706      echo "using $gm_local"      echo "using $gm_local"
707      . $gm_local      . $gm_local
# Line 570  fi Line 725  fi
725  ac_prev=  ac_prev=
726  for ac_option ; do  for ac_option ; do
727    
728        G2ARGS="$G2ARGS \"$ac_option\""
729    
730      # If the previous option needs an argument, assign it.      # If the previous option needs an argument, assign it.
731      if test -n "$ac_prev"; then      if test -n "$ac_prev"; then
732          eval "$ac_prev=\$ac_option"          eval "$ac_prev=\$ac_option"
# Line 611  for ac_option ; do Line 768  for ac_option ; do
768          -make=* | --make=* | -m=* | --m=*)          -make=* | --make=* | -m=* | --m=*)
769              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
770                    
771            -bash | --bash)
772                ac_prev=BASH ;;
773            -bash=* | --bash=*)
774                BASH=$ac_optarg ;;
775            
776            -makedepend | --makedepend | -md | --md)
777                ac_prev=MAKEDEPEND ;;
778            -makedepend=* | --makedepend=* | -md=* | --md=*)
779                MAKEDEPEND=$ac_optarg ;;
780            
781          -makefile | --makefile | -ma | --ma)          -makefile | --makefile | -ma | --ma)
782              ac_prev=MAKEFILE ;;              ac_prev=MAKEFILE ;;
783          -makefile=* | --makefile=* | -ma=* | --ma=*)          -makefile=* | --makefile=* | -ma=* | --ma=*)
# Line 662  for ac_option ; do Line 829  for ac_option ; do
829              IEEE=true ;;              IEEE=true ;;
830          -noieee | --noieee)          -noieee | --noieee)
831              IEEE= ;;              IEEE= ;;
832    
833            -mpi | --mpi)
834                MPI=true ;;
835            -mpi=* | --mpi=*)
836                MPIPATH=$ac_optarg
837                MPI=true ;;
838                    
839  #       -jam | --jam)  #       -jam | --jam)
840  #           JAM=1 ;;  #           JAM=1 ;;
# Line 714  if test "x${ROOTDIR}" = x ; then Line 887  if test "x${ROOTDIR}" = x ; then
887          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do
888              if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then              if [ -d "$d/model" -a -d "$d/eesupp" -a -d "$d/pkg" ]; then
889                  ROOTDIR=$d                  ROOTDIR=$d
890                  echo -n "Warning:  ROOTDIR was not specified but there appears to be"                  printf "Warning:  ROOTDIR was not specified but there appears to be"
891                  echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it."                  echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it."
892                  break                  break
893              fi              fi
# Line 748  if test "x$OPTFILE" != xNONE ; then Line 921  if test "x$OPTFILE" != xNONE ; then
921          . "$OPTFILE"          . "$OPTFILE"
922          RETVAL=$?          RETVAL=$?
923          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
924              echo -n "Error: failed to source OPTFILE \"$OPTFILE\""              printf "Error: failed to source OPTFILE \"$OPTFILE\""
925              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
926              exit 1              exit 1
927          fi          fi
# Line 761  if test "x$OPTFILE" != xNONE ; then Line 934  if test "x$OPTFILE" != xNONE ; then
934      fi      fi
935  fi  fi
936    
937    #  Check for broken systems that cannot correctly distinguish *.F and *.f files
938    if test "x$FEXT" = x -a "x$F90EXT" = x ; then
939        check_for_broken_Ff
940    fi
941    
942  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:  "
943  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
944      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" = x ; then
# Line 775  if test "x${AD_OPTFILE}" != xNONE ; then Line 953  if test "x${AD_OPTFILE}" != xNONE ; then
953          . "$AD_OPTFILE"          . "$AD_OPTFILE"
954          RETVAL=$?          RETVAL=$?
955          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
956              echo -n "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""              printf "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""
957              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
958              exit 1              exit 1
959          fi          fi
# Line 790  fi Line 968  fi
968    
969  #  Check that FC, LINK, CPP, S64, LN, and MAKE are defined.  If not,  #  Check that FC, LINK, CPP, S64, LN, and MAKE are defined.  If not,
970  #  either set defaults or complain and abort!  #  either set defaults or complain and abort!
971    if test ! "x$BASH" = x ; then
972        # add a trailing space so that it works within the Makefile syntax (see below)
973        BASH="$BASH "
974    fi
975  if test "x$FC" = x ; then  if test "x$FC" = x ; then
976      cat <<EOF 1>&2      cat <<EOF 1>&2
977    
# Line 803  fi Line 985  fi
985  if test "x$LINK" = x ; then  if test "x$LINK" = x ; then
986      LINK=$FC      LINK=$FC
987  fi  fi
 if test "x$CPP" = x ; then  
     CPP="cpp"  
 fi  
988  if test "x$MAKE" = x ; then  if test "x$MAKE" = x ; then
989      MAKE="make"      MAKE="make"
990  fi  fi
991    if test "x$CPP" = x ; then
992        CPP=cpp
993    fi
994    #EH3 === UGLY ===
995    #  The following an ugly little hack to check for $CPP in /lib/ and it
996    #  should eventually be replaced with a more general function that
997    #  searches a combo of the user's path and a list of "usual suspects"
998    #  to find the correct location for binaries such as $CPP.
999    for i in " " "/lib/" ; do
1000        echo "#define A a" | $i$CPP > test_cpp 2>&1 && CPP=$i$CPP
1001    done
1002    #EH3 === UGLY ===
1003  echo "#define A a" | $CPP > test_cpp 2>&1  echo "#define A a" | $CPP > test_cpp 2>&1
1004  RETVAL=$?  RETVAL=$?
1005  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
# Line 845  EOF Line 1036  EOF
1036  fi  fi
1037  rm -f genmake_test_ln genmake_tlink  rm -f genmake_test_ln genmake_tlink
1038    
1039    if test ! "x$MPI" = x ; then
1040          echo "  Turning on MPI cpp macros"
1041          DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI"
1042    fi
1043    
1044  printf "\n===  Checking system libraries  ===\n"  printf "\n===  Checking system libraries  ===\n"
1045  echo -n "  Do we have the system() command using $FC...  "  printf "  Do we have the system() command using $FC...  "
1046  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.f <<EOF
1047        program hello        program hello
1048        call system('echo hi')        call system('echo hi')
# Line 865  else Line 1060  else
1060  fi  fi
1061  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1062    
1063  echo -n "  Do we have the fdate() command using $FC...  "  printf "  Do we have the fdate() command using $FC...  "
1064  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.f <<EOF
1065        program hello        program hello
1066        CHARACTER(128) string        CHARACTER(128) string
# Line 886  else Line 1081  else
1081  fi  fi
1082  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1083    
1084  echo -n "  Can we call simple C routines (here, \"cloc()\") using $FC...  "  printf "  Can we call simple C routines (here, \"cloc()\") using $FC...  "
1085  check_HAVE_CLOC  check_HAVE_CLOC
1086  if test "x$HAVE_CLOC" != x ; then  if test "x$HAVE_CLOC" != x ; then
1087      echo "yes"      echo "yes"
# Line 895  else Line 1090  else
1090  fi  fi
1091  rm -f genmake_t*  rm -f genmake_t*
1092    
1093    printf "  Can we create NetCDF-enabled binaries...  "
1094    check_netcdf_libs
1095    if test "x$HAVE_NETCDF" != x ; then
1096        echo "yes"
1097    else
1098        echo "no"
1099    fi
1100    
1101    
1102  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
1103  echo -n "  Adding MODS directories:  "  printf "  Adding MODS directories:  "
1104  for d in $MODS ; do  for d in $MODS ; do
1105      if test ! -d $d ; then      if test ! -d $d ; then
1106          echo          echo
1107          echo "Error: MODS directory \"$d\" not found!"          echo "Error: MODS directory \"$d\" not found!"
1108          exit 1          exit 1
1109      else      else
1110          echo -n " $d"          printf " $d"
1111          SOURCEDIRS="$SOURCEDIRS $d"          SOURCEDIRS="$SOURCEDIRS $d"
1112          INCLUDEDIRS="$INCLUDEDIRS $d"          INCLUDEDIRS="$INCLUDEDIRS $d"
1113      fi      fi
# Line 934  if test "x${TOOLSDIR}" = x ; then Line 1137  if test "x${TOOLSDIR}" = x ; then
1137      TOOLSDIR="$ROOTDIR/tools"      TOOLSDIR="$ROOTDIR/tools"
1138  fi  fi
1139  if test ! -d ${TOOLSDIR} ; then  if test ! -d ${TOOLSDIR} ; then
1140      echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!"      echo "Error: the specified TOOLSDIR (\"$TOOLSDIR\") does not exist!"
1141      exit 1      exit 1
1142  fi  fi
1143  if test "x$S64" = x ; then  if test "x$S64" = x ; then
# Line 955  if test -r $ROOTDIR"/eesupp/src/Makefile Line 1158  if test -r $ROOTDIR"/eesupp/src/Makefile
1158          rm -f make_eesupp.errors          rm -f make_eesupp.errors
1159      else      else
1160          echo "Error: problem encountered while building source files in eesupp:"          echo "Error: problem encountered while building source files in eesupp:"
1161          cat make_eesupp.errors          cat make_eesupp.errors 1>&2
1162          exit 1          exit 1
1163      fi      fi
1164  fi  fi
1165    
1166    #same for exch2
1167    if test -r $ROOTDIR"/pkg/exch2/Makefile" ; then
1168        echo "  Making source files in exch2 from  templates"
1169        ( cd $ROOTDIR"/pkg/exch2/" && $MAKE ) > make_exch2.errors 2>&1
1170        RETVAL=$?
1171        if test "x${RETVAL}" = x0 ; then
1172            rm -f make_exch2.errors
1173        else
1174            echo "Error: problem encountered while building source files in exch2:"
1175            cat make_exch2.errors 1>&2
1176            exit 1
1177        fi
1178    fi
1179    
1180  printf "\n===  Determining package settings  ===\n"  printf "\n===  Determining package settings  ===\n"
1181  if  test "x${PDEPEND}" = x ; then  if  test "x${PDEPEND}" = x ; then
1182      tmp=$ROOTDIR"/pkg/pkg_depend"      tmp=$ROOTDIR"/pkg/pkg_depend"
# Line 1015  else Line 1232  else
1232          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`
1233          RETVAL=$?          RETVAL=$?
1234          if test "x${RETVAL}" != x0 ; then          if test "x${RETVAL}" != x0 ; then
1235              echo -n "Error: can't parse default package list "              printf "Error: can't parse default package list "
1236              echo "-- please check PDEFAULT=\"$PDEFAULT\""              echo "-- please check PDEFAULT=\"$PDEFAULT\""
1237              exit 1              exit 1
1238          fi          fi
# Line 1023  else Line 1240  else
1240              PACKAGES="$PACKAGES $i"              PACKAGES="$PACKAGES $i"
1241          done          done
1242          echo "    before group expansion packages are: $PACKAGES"          echo "    before group expansion packages are: $PACKAGES"
1243          expand_pkg_groups          while ! expand_pkg_groups; do echo > /dev/null; done
1244          echo "    after group expansion packages are:  $PACKAGES"          echo "    after group expansion packages are:  $PACKAGES"
1245      fi      fi
1246  fi  fi
1247    
1248  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
1249    for i in $PACKAGES ; do
1250        echo $i >> ./.tmp_pack
1251    done
1252    for i in `grep  "-" ./.tmp_pack` ; do
1253        j=`echo $i | sed 's/[-]//'`
1254        DISABLE="$DISABLE $j"
1255    done
1256  pack=  pack=
1257  for p in $PACKAGES ; do  for p in $PACKAGES ; do
1258      addit="t"      addit="t"
# Line 1045  PACKAGES="$pack" Line 1269  PACKAGES="$pack"
1269  echo "  applying ENABLE settings"  echo "  applying ENABLE settings"
1270  echo "" > ./.tmp_pack  echo "" > ./.tmp_pack
1271  PACKAGES="$PACKAGES $ENABLE"  PACKAGES="$PACKAGES $ENABLE"
1272    # Test if each explicitly referenced package exists
1273  for i in $PACKAGES ; do  for i in $PACKAGES ; do
1274      if test ! -d "$ROOTDIR/pkg/$i" ; then      j=`echo $i | sed 's/[-+]//'`
1275        if test ! -d "$ROOTDIR/pkg/$j" ; then
1276          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""
1277          exit 1          exit 1
1278      fi      fi
1279      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
1280  done  done
 pack=`cat ./.tmp_pack | sort | uniq`  
 rm -f ./.tmp_pack  
1281  PACKAGES=  PACKAGES=
1282  for i in $pack ; do  for i in `grep -v "-" ./.tmp_pack | sort | uniq` ; do
1283      PACKAGES="$PACKAGES $i"      PACKAGES="$PACKAGES $i"
1284  done  done
1285    rm -f ./.tmp_pack
1286  echo "    packages are:  $PACKAGES"  echo "    packages are:  $PACKAGES"
1287    
1288  echo "  applying package dependency rules"  echo "  applying package dependency rules"
# Line 1143  for i in $PACKAGES ; do Line 1368  for i in $PACKAGES ; do
1368      fi      fi
1369  done  done
1370    
1371    #  Build MNC templates and check for ability to build and use NetCDF
1372    echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1
1373    RETVAL=$?
1374    if test "x$RETVAL" = x0 ; then
1375        ( cd $ROOTDIR"/pkg/mnc" && $MAKE templates ) > make_mnc.errors 2>&1
1376        RETVAL=$?
1377        if test "x${RETVAL}" = x0 ; then
1378            rm -f make_mnc.errors
1379        else
1380            echo "Error: problem encountered while building source files in pkg/mnc:"
1381            cat make_mnc.errors 1>&2
1382            exit 1
1383        fi
1384        if test "x$HAVE_NETCDF" != xt ; then
1385            cat <<EOF
1386    
1387    WARNING: the "mnc" package has been enabled but tests failed to
1388      compile and/or execute NetCDF applications.  Please check that:
1389    
1390      1) NetCDF is installed for your compiler and
1391      2) the LIBS variable (within the 'optfile") specifies the correct
1392           NetCDF library to link against.
1393      
1394    EOF
1395        fi
1396    fi
1397    
1398  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
1399  PACKAGES_DOT_H=PACKAGES_CONFIG.h  PACKAGES_DOT_H=PACKAGES_CONFIG.h
# Line 1177  for i in $PACKAGES ; do Line 1428  for i in $PACKAGES ; do
1428  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!  #EH3  WARNING :  This is an UGLY HACK that needs to be removed!!!
1429      case $i in      case $i in
1430          aim_v23)          aim_v23)
             DEFINES="$DEFINES -DALLOW_AIM"  
1431              ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM"              ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM"
1432              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."
1433              ;;              ;;
1434      esac      esac
1435  #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 1188  done Line 1438  done
1438    
1439  echo "  Adding STANDARDDIRS"  echo "  Adding STANDARDDIRS"
1440  BUILDDIR=${BUILDDIR:-.}  BUILDDIR=${BUILDDIR:-.}
1441  if test "x$STANDARDDIRS" = x ; then  if test "x$STANDARDDIRS" = xUSE_THE_DEFAULT ; then
1442      STANDARDDIRS="eesupp model"      STANDARDDIRS="eesupp model"
1443  fi  fi
1444  for d in $STANDARDDIRS ; do  if test "x$STANDARDDIRS" != x ; then
1445      adr="$ROOTDIR/$d/src"      for d in $STANDARDDIRS ; do
1446      if test ! -d $adr ; then          adr="$ROOTDIR/$d/src"
1447          echo "Error:  directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""          if test ! -d $adr ; then
1448          echo "  is correct and that you correctly specified the STANDARDDIRS option"              echo "Error:  directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""
1449          exit 1              echo "  is correct and that you correctly specified the STANDARDDIRS option"
1450      else              exit 1
1451          SOURCEDIRS="$SOURCEDIRS $adr"          else
1452      fi              SOURCEDIRS="$SOURCEDIRS $adr"
1453      adr="$ROOTDIR/$d/inc"          fi
1454      if test ! -d $adr ; then          adr="$ROOTDIR/$d/inc"
1455          echo "Error:  directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""          if test ! -d $adr ; then
1456          echo "  is correct and that you correctly specified the STANDARDDIRS option"              echo "Error:  directory $adr not found -- please check that ROOTDIR=\"$ROOTDIR\""
1457          exit 1              echo "  is correct and that you correctly specified the STANDARDDIRS option"
1458      else              exit 1
1459          INCLUDEDIRS="$INCLUDEDIRS $adr"          else
1460      fi              INCLUDEDIRS="$INCLUDEDIRS $adr"
1461  done          fi
1462        done
1463    fi
1464    
1465  echo "  Searching for *OPTIONS.h files in order to warn about the presence"  echo "  Searching for *OPTIONS.h files in order to warn about the presence"
1466  echo "    of \"#define \"-type statements that are no longer allowed:"  echo "    of \"#define \"-type statements that are no longer allowed:"
# Line 1218  spaths=". $INCLUDEDIRS" Line 1470  spaths=". $INCLUDEDIRS"
1470  names=`ls -1 "$ROOTDIR/pkg"`  names=`ls -1 "$ROOTDIR/pkg"`
1471  for i in $spaths ; do  for i in $spaths ; do
1472      try="$i/CPP_OPTIONS.h"      try="$i/CPP_OPTIONS.h"
1473      if test -f $try -a -r $try -a "x$CPP_OPTIONS" == x ; then      if test -f $try -a -r $try -a "x$CPP_OPTIONS" = x ; then
1474          echo "    found CPP_OPTIONS=\"$try\""          echo "    found CPP_OPTIONS=\"$try\""
1475          CPP_OPTIONS="$try"          CPP_OPTIONS="$try"
1476          # New safety test: make sure packages are not mentioned in CPP_OPTIONS.h          # New safety test: make sure packages are not mentioned in CPP_OPTIONS.h
# Line 1227  for i in $spaths ; do Line 1479  for i in $spaths ; do
1479          done          done
1480      fi      fi
1481      try="$i/CPP_EEOPTIONS.h"      try="$i/CPP_EEOPTIONS.h"
1482      if test -f $try -a -r $try -a "x$CPP_EEOPTIONS" == x ; then      if test -f $try -a -r $try -a "x$CPP_EEOPTIONS" = x ; then
1483          echo "    found CPP_EEOPTIONS=\"$try\""          echo "    found CPP_EEOPTIONS=\"$try\""
1484          # New safety test: make sure MPI is not determined by CPP_EEOPTIONS.h          # New safety test: make sure MPI is not determined by CPP_EEOPTIONS.h
1485  #**** not yet enabled ****  #**** not yet enabled ****
# Line 1254  for i in $SOURCEDIRS ; do Line 1506  for i in $SOURCEDIRS ; do
1506      done      done
1507  done  done
1508    
1509    
1510  echo  echo
1511  echo "===  Creating the Makefile  ==="  echo "===  Creating the Makefile  ==="
1512  echo "  setting INCLUDES"  echo "  setting INCLUDES"
# Line 1270  rm -rf .links.tmp Line 1523  rm -rf .links.tmp
1523  mkdir .links.tmp  mkdir .links.tmp
1524  echo "# This section creates symbolic links" > srclinks.tmp  echo "# This section creates symbolic links" > srclinks.tmp
1525  echo "" >> srclinks.tmp  echo "" >> srclinks.tmp
1526  echo -n 'SRCFILES = '    > srclist.inc  printf 'SRCFILES = '    > srclist.inc
1527  echo -n 'CSRCFILES = '   > csrclist.inc  printf 'CSRCFILES = '   > csrclist.inc
1528  echo -n 'F90SRCFILES = ' > f90srclist.inc  printf 'F90SRCFILES = ' > f90srclist.inc
1529  echo -n 'HEADERFILES = ' > hlist.inc  printf 'HEADERFILES = ' > hlist.inc
1530  echo -n 'AD_FLOW_FILES = ' > ad_flow_files.inc  printf 'AD_FLOW_FILES = ' > ad_flow_files.inc
1531  alldirs="$SOURCEDIRS $INCLUDEDIRS ."  alldirs="$SOURCEDIRS $INCLUDEDIRS ."
1532  for d in $alldirs ; do  for d in $alldirs ; do
1533      deplist=      deplist=
# Line 1299  for d in $alldirs ; do Line 1552  for d in $alldirs ; do
1552                  case $extn in                  case $extn in
1553                      F)                      F)
1554                          echo    " \\"  >> srclist.inc                          echo    " \\"  >> srclist.inc
1555                          echo -n " $sf" >> srclist.inc                          printf " $sf" >> srclist.inc
1556                          ;;                          ;;
1557                      F90)                      F90)
1558                          echo    " \\"  >> f90srclist.inc                          echo    " \\"  >> f90srclist.inc
1559                          echo -n " $sf" >> f90srclist.inc                          printf " $sf" >> f90srclist.inc
1560                          ;;                          ;;
1561                      c)                      c)
1562                          echo    " \\"  >> csrclist.inc                          echo    " \\"  >> csrclist.inc
1563                          echo -n " $sf" >> csrclist.inc                          printf " $sf" >> csrclist.inc
1564                          ;;                          ;;
1565                      h)                      h)
1566                          echo    " \\"  >> hlist.inc                          echo    " \\"  >> hlist.inc
1567                          echo -n " $sf" >> hlist.inc                          printf " $sf" >> hlist.inc
1568                          ;;                          ;;
1569                      flow)                      flow)
1570                          echo    " \\"  >> ad_flow_files.inc                          echo    " \\"  >> ad_flow_files.inc
1571                          echo -n " $sf" >> ad_flow_files.inc                          printf " $sf" >> ad_flow_files.inc
1572                          ;;                          ;;
1573                  esac                  esac
1574              fi              fi
# Line 1344  echo "#    $MACHINE" >> $MAKEFILE Line 1597  echo "#    $MACHINE" >> $MAKEFILE
1597  echo "# This makefile was generated automatically on" >> $MAKEFILE  echo "# This makefile was generated automatically on" >> $MAKEFILE
1598  echo "#    $THISDATE" >> $MAKEFILE  echo "#    $THISDATE" >> $MAKEFILE
1599  echo "# by the command:" >> $MAKEFILE  echo "# by the command:" >> $MAKEFILE
1600  echo "#    $0 $@" >> $MAKEFILE  echo "#    $0 $G2ARGS" >> $MAKEFILE
1601  echo "# executed by:" >> $MAKEFILE  echo "# executed by:" >> $MAKEFILE
1602  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE
1603    
# Line 1412  FC = ${FC} Line 1665  FC = ${FC}
1665  # Fortran compiler  # Fortran compiler
1666  F90C = ${F90C}  F90C = ${F90C}
1667  # Link editor  # Link editor
1668  LINK = ${LINK}  LINK = ${LINK} ${LDADD}
1669    
1670  # Defines for CPP  # Defines for CPP
1671  DEFINES = ${DEFINES}  DEFINES = ${DEFINES}
# Line 1444  cat csrclist.inc      >> $MAKEFILE Line 1697  cat csrclist.inc      >> $MAKEFILE
1697  cat f90srclist.inc    >> $MAKEFILE  cat f90srclist.inc    >> $MAKEFILE
1698  cat hlist.inc         >> $MAKEFILE  cat hlist.inc         >> $MAKEFILE
1699  cat ad_flow_files.inc >> $MAKEFILE  cat ad_flow_files.inc >> $MAKEFILE
1700  echo               >> $MAKEFILE  echo >> $MAKEFILE
1701  echo 'F77FILES =  $(SRCFILES:.F=.f)'                                           >> $MAKEFILE  echo 'F77FILES =  $(SRCFILES:.'$FEXT'=.f)'        >> $MAKEFILE
1702  echo 'F90FILES =  $(F90SRCFILES:.F90=.f90)'                                    >> $MAKEFILE  echo 'F90FILES =  $(F90SRCFILES:.'$F90EXT'=.f90)' >> $MAKEFILE
1703  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE  echo 'OBJFILES =  $(SRCFILES:.'$FEXT'=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.'$F90EXT'=.o)' >> $MAKEFILE
1704    echo >> $MAKEFILE
1705    echo '.SUFFIXES:' >> $MAKEFILE
1706    echo '.SUFFIXES: .o .f .p .'$FEXT' .c .'$F90EXT' .f90' >> $MAKEFILE
1707    
1708  rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc  rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp f90srclist.inc
1709  rm -f ad_flow_files.inc  rm -f ad_flow_files.inc
1710    
1711  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
1712    
 .SUFFIXES:  
 .SUFFIXES: .o .f .p .F .c .F90 .f90  
   
1713  all: \$(EXECUTABLE)  all: \$(EXECUTABLE)
1714  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES)  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES)
1715          @echo Creating \$@ ...          @echo Creating \$@ ...
# Line 1465  depend: Line 1718  depend:
1718          @make links          @make links
1719          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
1720          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
1721            -rm -f makedepend.out
1722    
1723  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)
1724    
# Line 1490  CLEAN: Line 1744  CLEAN:
1744    
1745  #eh3 Makefile: makefile  #eh3 Makefile: makefile
1746  makefile:  makefile:
1747          $THIS_SCRIPT $@          $THIS_SCRIPT $G2ARGS
1748  cleanlinks:  cleanlinks:
1749          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
1750    
1751  # Special targets ($SPECIAL_FILES) which are create by make  # Special targets ($SPECIAL_FILES) which are create by make
1752  ${PACKAGES_DOT_H}:  ${PACKAGES_DOT_H}:
1753          @echo Creating \$@ ...          @echo Creating \$@ ...
1754          @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@
1755  AD_CONFIG.h:  AD_CONFIG.h:
1756          @echo Creating \$@ ...          @echo Creating \$@ ...
1757          @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@
1758  FC_NAMEMANGLE.h:  FC_NAMEMANGLE.h:
1759          @echo Creating \$@ ...          @echo Creating \$@ ...
1760          echo "$FC_NAMEMANGLE" > \$@          echo "$FC_NAMEMANGLE" > \$@
1761    
1762  # The normal chain of rules is (  .F - .f - .o  )  # The normal chain of rules is (  .$FEXT - .f - .o  )
1763  .F.f:  .$FEXT.f:
1764          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1765  .f.o:  .f.o:
1766          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
1767  .F90.f90:  .$F90EXT.f90:
1768          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1769  .f90.o:  .f90.o:
1770          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<
1771  .c.o:  .c.o:
1772          \$(CC) \$(CFLAGS) -c \$<          \$(CC) \$(CFLAGS) -c \$<
1773    
1774  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain  # Special exceptions that use the ( .$FEXT - .p - .f - .o ) rule-chain
1775  .F.p:  .$FEXT.p:
1776          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1777  .p.f:  .p.f:
1778          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
# Line 1547  done Line 1801  done
1801    
1802  echo "  Add the source list for AD code generation"  echo "  Add the source list for AD code generation"
1803  echo >> $MAKEFILE  echo >> $MAKEFILE
1804  echo -n "AD_FILES = " >> $MAKEFILE  printf "AD_FILES = " >> $MAKEFILE
1805  AD_FILES=`cat ad_files`  AD_FILES=`cat ad_files`
1806  for i in $AD_FILES ; do  for i in $AD_FILES ; do
1807      echo    " \\" >> $MAKEFILE      echo    " \\" >> $MAKEFILE
1808      echo -n " $i" >> $MAKEFILE      printf " $i" >> $MAKEFILE
1809  done  done
1810  echo >> $MAKEFILE  echo >> $MAKEFILE
1811  rm -f ad_files  rm -f ad_files
# Line 1564  adtaf: ad_taf_output.f Line 1818  adtaf: ad_taf_output.f
1818  adtamc: ad_tamc_output.f  adtamc: ad_tamc_output.f
1819    
1820  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1821          @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template
1822          cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h          cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h
1823          -rm -f ad_config.template          -rm -f ad_config.template
1824          @make \$(F77FILES)          @make \$(F77FILES)
# Line 1596  ftltaf: ftl_taf_output.f Line 1850  ftltaf: ftl_taf_output.f
1850  ftltamc: ftl_tamc_output.f  ftltamc: ftl_tamc_output.f
1851    
1852  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1853          @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template          @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template
1854          cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h          cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h
1855          -rm -f ftl_config.template          -rm -f ftl_config.template
1856          @make \$(F77FILES)          @make \$(F77FILES)
# Line 1669  printf "\n\n# DO NOT DELETE\n" >> $MAKEF Line 1923  printf "\n\n# DO NOT DELETE\n" >> $MAKEF
1923  printf "\n===  Done  ===\n"  printf "\n===  Done  ===\n"
1924    
1925  # Create special header files  # Create special header files
1926  $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" $DISABLED_PACKAGES " " "Enabled packages:" $ENABLED_PACKAGES > $PACKAGES_DOT_H".tmp"  $BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" $DISABLED_PACKAGES " " "Enabled packages:" $ENABLED_PACKAGES > $PACKAGES_DOT_H".tmp"
1927  if test ! -f $PACKAGES_DOT_H ; then  if test ! -f $PACKAGES_DOT_H ; then
1928      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
1929  else  else
1930      cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H      cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H > /dev/null 2>&1
1931      RETVAL=$?      RETVAL=$?
1932      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
1933          rm -f $PACKAGES_DOT_H".tmp"          rm -f $PACKAGES_DOT_H".tmp"
# Line 1683  else Line 1937  else
1937      fi      fi
1938  fi  fi
1939  if test ! -f AD_CONFIG.h ; then  if test ! -f AD_CONFIG.h ; then
1940      $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > AD_CONFIG.h      $BASH $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > AD_CONFIG.h
1941  fi  fi
1942    
1943    
1944  #  Write the "state" for future records  #  Write the "state" for future records
1945  if test "x$DUMPSTATE" != xf ; then  if test "x$DUMPSTATE" != xf ; then
1946      echo -n "" > genmake_state      printf "" > genmake_state
1947      for i in $gm_state ; do      for i in $gm_state ; do
1948          t1="t2=\$$i"          t1="t2=\$$i"
1949          eval $t1          eval $t1

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.75

  ViewVC Help
Powered by ViewVC 1.1.22