/[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.58 by afe, Fri Jan 9 22:08:39 2004 UTC revision 1.78 by adcroft, Tue May 4 16:30:21 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        #  Do we have defaults for $FS and/or $FS90 ?
80        tfs=f
81        tfs9=f90
82        if test "x$FS" != x ; then
83            tfs="$FS"
84        fi
85        if test "x$FS90" != x ; then
86            tfs9="$FS90"
87        fi
88    
89        #  First check the ability to create a *.F/.f pair.
90        cat <<EOF >> genmake_hello.F
91          program hello
92          write(*,*) 'hi'
93          stop
94          end
95    EOF
96        cp genmake_hello.F "genmake_hello."$tfs > /dev/null 2>&1
97        RETVAL=$?
98        if test "x$RETVAL" != x0 ; then
99            if test "x$FS" = x ; then
100                FS='for'
101                FS90='fr9'
102                check_for_broken_Ff
103            else
104                cat <<EOF 2>&1
105    ERROR: Your file system cannot distinguish between *.F and *.f files
106      (fails the "cp" test) and this program cannot find a suitable
107      replacement extension.  Please try a different build environment or
108      contact the <MITgcm-support@mitgcm.org> list for help.
109    
110    EOF
111                exit -1
112            fi
113            return
114        fi
115        rm -f genmake_hello.*
116    
117        #  Check the ability of ${MAKE} and ${LN} to use the current set
118        #  of extensions.
119        cat <<EOF >> genmake_hello.F
120          program hello
121          write(*,*) 'hi'
122          stop
123          end
124    EOF
125        test -e Makefile  &&  mv -f Makefile Makefile.bak
126        cat <<EOF >> Makefile
127    %.$tfs : %.F
128    .SUFFIXES:
129    genmake_hello.$tfs: genmake_hello.F
130            $LN genmake_hello.F genmake_hello.$tfs
131    EOF
132        $MAKE "genmake_hello."$tfs > /dev/null 2>&1
133        RETVAL=$?
134        if test "x$RETVAL" != x0 -o ! -e "genmake_hello."$tfs ; then
135            if test "x$FS" = x ; then
136                FS='for'
137                FS90='fr9'
138                check_for_broken_Ff
139            else
140                cat <<EOF 2>&1
141    ERROR: Your file system cannot distinguish between *.F and *.f files
142      (fails the "make/ln" test) and this program cannot find a suitable
143      replacement extension.  Please try a different build environment or
144      contact the <MITgcm-support@mitgcm.org> list for help.
145    
146    EOF
147                exit -1
148                return
149            fi
150        fi
151        rm -f genmake_hello.* Makefile
152        test -e Makefile  &&  mv -f Makefile.bak Makefile
153    
154        #  If we make it here, use the extensions
155        FS=$tfs
156        FS90=$tfs9
157        return
158    }
159    
160    
161  # Guess possible config options for this host  # Guess possible config options for this host
162  find_possible_configs()  {  find_possible_configs()  {
163    
# Line 80  find_possible_configs()  { Line 166  find_possible_configs()  {
166      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`      tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'`
167      tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`      tmp1=`echo $tmp3 | sed -e 's|x86_64|amd64|'`
168      tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`      tmp2=`echo $tmp1 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
169      PLATFORM=$tmp2      tmp3=`echo $tmp2 | sed -e 's/cray sv1/craysv1/'`
170        PLATFORM=$tmp3
171        echo $PLATFORM | grep cygwin > /dev/null 2>&1  &&  PLATFORM=cygwin_ia32
172      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
173      echo "  The platform appears to be:  $PLATFORM"      echo "  The platform appears to be:  $PLATFORM"
174            
# Line 100  find_possible_configs()  { Line 188  find_possible_configs()  {
188          CPP="cpp -traditional -P"          CPP="cpp -traditional -P"
189      fi      fi
190    
191      # makedepend is not always available      #  The "original" makedepend is part of the Imake system that is
192        #  most often distributed with XFree86 or with an XFree86 source
193        #  package.  As a result, many machines (eg. generic Linux) do not
194        #  have a system-default "makedepend" available.  For those
195        #  systems, we have two fall-back options:
196        #
197        #    1) a makedepend implementation shipped with the cyrus-imapd
198        #       package:  ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
199        #
200        #    2) a known-buggy xmakedpend shell script
201        #
202        #  So the choices are, in order:
203        #
204        #    1) use the user-specified program
205        #    2) use a system-wide default
206        #    3) locally build and use the cyrus implementation
207        #    4) fall back to the buggy local xmakedpend script
208        #
209      if test "x${MAKEDEPEND}" = x ; then      if test "x${MAKEDEPEND}" = x ; then
210        which makedepend >& /dev/null        which makedepend > /dev/null 2>&1
211        RETVAL=$?        RV0=$?
212        if test "x${RETVAL}" = x1 ; then        cat <<EOF >> genmake_tc.f
213           echo "    makedepend was not found. Using xmakedpend instead."        program test
214           MAKEDEPEND='$(TOOLSDIR)/xmakedepend'        write(*,*) 'test'
215          stop
216          end
217    EOF
218          makedepend genmake_tc.f > /dev/null 2>&1
219          RV1=$?
220          if test ! "x${RV0}${RV1}" = x00 ; then
221             echo "    a system-default makedepend was not found."
222    
223             #  Try to build the cyrus impl
224             rm -f ./genmake_cy_md
225             (
226                 cd $ROOTDIR/tools/cyrus-imapd-makedepend  \
227                     &&  ./configure > /dev/null 2>&1  \
228                     &&  make > /dev/null 2>&1
229                 if test -x ./makedepend.exe ; then
230                     $LN ./makedepend.exe ./makedepend
231                 fi
232                 ./makedepend ifparser.c > /dev/null 2>&1  \
233                     &&  echo "true"
234             ) > ./genmake_cy_md
235             grep true ./genmake_cy_md > /dev/null 2>&1
236             RETVAL=$?
237             if test "x$RETVAL" = x0 ; then
238                 MAKEDEPEND='$(TOOLSDIR)/cyrus-imapd-makedepend/makedepend'
239             else
240                 MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
241             fi
242             rm -f ./genmake_cy_md
243        fi        fi
244      fi      fi
245    
# Line 145  EOF Line 278  EOF
278          echo "   "$p_FC          echo "   "$p_FC
279          if test "x$FC" = x ; then          if test "x$FC" = x ; then
280              FC=`echo $p_FC | $AWK '{print $1}'`              FC=`echo $p_FC | $AWK '{print $1}'`
281                echo "  Setting FORTRAN compiler to: "$FC
282          fi          fi
283      fi      fi
284    
285      for i in $p_FC ; do      if test "x$OPTFILE" = x ; then
286          p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i          OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$FC
287          if test -r $p_OF ; then          if test ! -r $OPTFILE ; then
288              OPTFILE=$p_OF               echo "  I looked for the file "$OPTFILE" but did not find it"
289              echo "  The options file:  $p_OF"          fi
290              echo "    appears to match so we'll use it."      fi
291              break  #    echo "  The options file:  $p_OF"
292          fi  #    echo "    appears to match so we'll use it."
293      done  #   for i in $p_FC ; do
294    #p_OF=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i
295    #if test -r $p_OF ; then
296    #    OPTFILE=$p_OF
297    #    echo "  The options file:  $p_OF"
298    #    echo "    appears to match so we'll use it."
299    #    break
300    #fi
301    #   done
302      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
303          cat 1>&2 <<EOF          cat 1>&2 <<EOF
304    
# Line 215  get_pdepend_list()  { Line 357  get_pdepend_list()  {
357      . ./.pd_tmp      . ./.pd_tmp
358      rm -f ./.pd_tmp      rm -f ./.pd_tmp
359    
360      echo -n "PNAME = "${}      printf "PNAME = "${}
361  }  }
362    
363    
# Line 253  Usage: "$0" [OPTIONS] Line 395  Usage: "$0" [OPTIONS]
395        --makefile=NAME | -mf=NAME        --makefile=NAME | -mf=NAME
396            Call the makefile "NAME".  The default is "Makefile".            Call the makefile "NAME".  The default is "Makefile".
397    
398        -makedepend NAME | -md NAME
399          --makedepend=NAME | -md=NAME
400              Use "NAME" for the MAKEDEPEND program.
401    
402      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME
403        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME
404            Specify the location of the MITgcm ROOTDIR as "NAME".            Specify the location of the MITgcm ROOTDIR as "NAME".
# Line 294  Usage: "$0" [OPTIONS] Line 440  Usage: "$0" [OPTIONS]
440            *only* works if it is supported by the OPTFILE that            *only* works if it is supported by the OPTFILE that
441            is being used.            is being used.
442    
443        -mpi | --mpi
444              Include MPI header files and link to MPI libraries
445        -mpi=PATH | --mpi=PATH
446              Include MPI header files and link to MPI libraries using MPI_ROOT
447              set to PATH. i.e. Include files from $PATH/include, link to libraries
448              from $PATH/lib and use binaries from $PATH/bin.
449    
450        -bash NAME
451              Explicitly specify the Bourne or BASH shell to use
452    
453    While it is most often a single word, the "NAME" variables specified    While it is most often a single word, the "NAME" variables specified
454    above can in many cases be a space-delimited string such as:    above can in many cases be a space-delimited string such as:
455    
# Line 437  EOF Line 593  EOF
593  }  }
594    
595    
596    check_netcdf_libs()  {
597        cat <<EOF > genmake_tnc.for
598          program fgennc
599    #include "netcdf.inc"
600          integer iret, ncid, xid
601          iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)
602          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
603          iret = nf_def_dim(ncid, 'X', 11, xid)
604          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
605          iret = nf_close(ncid)
606          IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
607          end
608    EOF
609        $CPP genmake_tnc.for > genmake_tnc.f  \
610            &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1
611        RET_COMPILE=$?
612        test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
613        RETVAL=$?
614        if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
615            HAVE_NETCDF=t
616        else
617            # try again with "-lnetcdf" added to the libs
618            $CPP genmake_tnc.for > genmake_tnc.f  \
619                &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \
620                $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1
621            RET_COMPILE=$?
622            test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
623            RETVAL=$?
624            if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
625                LIBS="$LIBS -lnetcdf"
626                HAVE_NETCDF=t
627            else
628                cat genmake_tnc.log >> genmake_warnings
629            fi
630        fi
631        rm -f genmake_tnc*
632    }
633    
634    
635    
636    ###############################################################################
637    #   Sequential part of script starts here
638    ###############################################################################
639    
640  #  Set defaults here  #  Set defaults here
641  COMMANDL="$0 $@"  COMMANDL="$0 $@"
642    
# Line 445  LN= Line 645  LN=
645  S64=  S64=
646  KPP=  KPP=
647  FC=  FC=
648    CPP=
649  LINK=  LINK=
 # DEFINES="-DWORDLENGTH=4"  
650  DEFINES=  DEFINES=
651  PACKAGES=  PACKAGES=
652  ENABLE=  ENABLE=
# Line 463  FOPTIM= Line 663  FOPTIM=
663  CFLAGS=  CFLAGS=
664  KFLAGS1=  KFLAGS1=
665  KFLAGS2=  KFLAGS2=
666    #LDADD=
667  LIBS=  LIBS=
668  KPPFILES=  KPPFILES=
669  NOOPTFILES=  NOOPTFILES=
670  NOOPTFLAGS=  NOOPTFLAGS=
671    MPI=
672    MPIPATH=
673    
674  # DEFINES checked by test compilation  # DEFINES checked by test compilation
675  HAVE_SYSTEM=  HAVE_SYSTEM=
676  HAVE_FDATE=  HAVE_FDATE=
677  FC_NAMEMANGLE=  FC_NAMEMANGLE=
678  HAVE_CLOC=  HAVE_CLOC=
679    HAVE_NETCDF=
680    
681  MODS=  MODS=
682  TOOLSDIR=  TOOLSDIR=
# Line 480  SOURCEDIRS= Line 684  SOURCEDIRS=
684  INCLUDEDIRS=  INCLUDEDIRS=
685  STANDARDDIRS="USE_THE_DEFAULT"  STANDARDDIRS="USE_THE_DEFAULT"
686    
687    G2ARGS=
688    BASH=
689  PWD=`pwd`  PWD=`pwd`
690  MAKE=make  MAKE=make
691  AWK=awk  AWK=awk
# Line 495  IEEE= Line 701  IEEE=
701  if test "x$MITGCM_IEEE" != x ; then  if test "x$MITGCM_IEEE" != x ; then
702      IEEE=$MITGCM_IEEE      IEEE=$MITGCM_IEEE
703  fi  fi
704    FS=
705    FS90=
706    
707  AUTODIFF_PKG_USED=f  AUTODIFF_PKG_USED=f
708  AD_OPTFILE=  AD_OPTFILE=
# Line 512  TAMC_EXTRA= Line 720  TAMC_EXTRA=
720    
721  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
722  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
723  gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS"  gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS"
724    
725  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
726  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 548  for i in . $MODS ; do Line 756  for i in . $MODS ; do
756          break          break
757      fi      fi
758  done  done
759  echo -n "  getting local config information:  "  printf "  getting local config information:  "
760  if test -e $gm_local ; then  if test -e $gm_local ; then
761      echo "using $gm_local"      echo "using $gm_local"
762      . $gm_local      . $gm_local
# Line 572  fi Line 780  fi
780  ac_prev=  ac_prev=
781  for ac_option ; do  for ac_option ; do
782    
783        G2ARGS="$G2ARGS \"$ac_option\""
784    
785      # If the previous option needs an argument, assign it.      # If the previous option needs an argument, assign it.
786      if test -n "$ac_prev"; then      if test -n "$ac_prev"; then
787          eval "$ac_prev=\$ac_option"          eval "$ac_prev=\$ac_option"
# Line 613  for ac_option ; do Line 823  for ac_option ; do
823          -make=* | --make=* | -m=* | --m=*)          -make=* | --make=* | -m=* | --m=*)
824              MAKE=$ac_optarg ;;              MAKE=$ac_optarg ;;
825                    
826            -bash | --bash)
827                ac_prev=BASH ;;
828            -bash=* | --bash=*)
829                BASH=$ac_optarg ;;
830            
831            -makedepend | --makedepend | -md | --md)
832                ac_prev=MAKEDEPEND ;;
833            -makedepend=* | --makedepend=* | -md=* | --md=*)
834                MAKEDEPEND=$ac_optarg ;;
835            
836          -makefile | --makefile | -ma | --ma)          -makefile | --makefile | -ma | --ma)
837              ac_prev=MAKEFILE ;;              ac_prev=MAKEFILE ;;
838          -makefile=* | --makefile=* | -ma=* | --ma=*)          -makefile=* | --makefile=* | -ma=* | --ma=*)
# Line 660  for ac_option ; do Line 880  for ac_option ; do
880          -fc=* | --fc=*)          -fc=* | --fc=*)
881              FC=$ac_optarg ;;              FC=$ac_optarg ;;
882                    
883            -fs | --fs)
884                ac_prev=FS ;;
885            -fs=* | --fs=*)
886                FS=$ac_optarg ;;
887            
888            -fs90 | --fs90)
889                ac_prev=FS90 ;;
890            -fs90=* | --fs90=*)
891                FS90=$ac_optarg ;;
892            
893          -ieee | --ieee)          -ieee | --ieee)
894              IEEE=true ;;              IEEE=true ;;
895          -noieee | --noieee)          -noieee | --noieee)
896              IEEE= ;;              IEEE= ;;
897    
898            -mpi | --mpi)
899                MPI=true ;;
900            -mpi=* | --mpi=*)
901                MPIPATH=$ac_optarg
902                MPI=true ;;
903                    
904  #       -jam | --jam)  #       -jam | --jam)
905  #           JAM=1 ;;  #           JAM=1 ;;
# Line 716  if test "x${ROOTDIR}" = x ; then Line 952  if test "x${ROOTDIR}" = x ; then
952          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do          for d in . .. ../.. ../../.. ../../../.. ../../../../.. ; do
953              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
954                  ROOTDIR=$d                  ROOTDIR=$d
955                  echo -n "Warning:  ROOTDIR was not specified but there appears to be"                  printf "Warning:  ROOTDIR was not specified but there appears to be"
956                  echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it."                  echo " a copy of MITgcm at \"$ROOTDIR\" so we'll try it."
957                  break                  break
958              fi              fi
# Line 750  if test "x$OPTFILE" != xNONE ; then Line 986  if test "x$OPTFILE" != xNONE ; then
986          . "$OPTFILE"          . "$OPTFILE"
987          RETVAL=$?          RETVAL=$?
988          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
989              echo -n "Error: failed to source OPTFILE \"$OPTFILE\""              printf "Error: failed to source OPTFILE \"$OPTFILE\""
990              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
991              exit 1              exit 1
992          fi          fi
# Line 763  if test "x$OPTFILE" != xNONE ; then Line 999  if test "x$OPTFILE" != xNONE ; then
999      fi      fi
1000  fi  fi
1001    
1002    #  Check for broken systems that cannot correctly distinguish *.F and *.f files
1003    # check_for_broken_Ff
1004    
1005  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:  "
1006  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1007      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" = x ; then
# Line 777  if test "x${AD_OPTFILE}" != xNONE ; then Line 1016  if test "x${AD_OPTFILE}" != xNONE ; then
1016          . "$AD_OPTFILE"          . "$AD_OPTFILE"
1017          RETVAL=$?          RETVAL=$?
1018          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
1019              echo -n "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""              printf "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""
1020              echo "--please check that variable syntax is bash-compatible"              echo "--please check that variable syntax is bash-compatible"
1021              exit 1              exit 1
1022          fi          fi
# Line 792  fi Line 1031  fi
1031    
1032  #  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,
1033  #  either set defaults or complain and abort!  #  either set defaults or complain and abort!
1034    if test ! "x$BASH" = x ; then
1035        # add a trailing space so that it works within the Makefile syntax (see below)
1036        BASH="$BASH "
1037    fi
1038  if test "x$FC" = x ; then  if test "x$FC" = x ; then
1039      cat <<EOF 1>&2      cat <<EOF 1>&2
1040    
# Line 805  fi Line 1048  fi
1048  if test "x$LINK" = x ; then  if test "x$LINK" = x ; then
1049      LINK=$FC      LINK=$FC
1050  fi  fi
 if test "x$CPP" = x ; then  
     CPP="cpp"  
 fi  
1051  if test "x$MAKE" = x ; then  if test "x$MAKE" = x ; then
1052      MAKE="make"      MAKE="make"
1053  fi  fi
1054    if test "x$CPP" = x ; then
1055        CPP=cpp
1056    fi
1057    #EH3 === UGLY ===
1058    #  The following is an ugly little hack to check for $CPP in /lib/ and
1059    #  it should eventually be replaced with a more general function that
1060    #  searches a combo of the user's path and a list of "usual suspects"
1061    #  to find the correct location for binaries such as $CPP.
1062    for i in " " "/lib/" ; do
1063        echo "#define A a" | $i$CPP > test_cpp 2>&1 && CPP=$i$CPP
1064    done
1065    #EH3 === UGLY ===
1066  echo "#define A a" | $CPP > test_cpp 2>&1  echo "#define A a" | $CPP > test_cpp 2>&1
1067  RETVAL=$?  RETVAL=$?
1068  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
# Line 847  EOF Line 1099  EOF
1099  fi  fi
1100  rm -f genmake_test_ln genmake_tlink  rm -f genmake_test_ln genmake_tlink
1101    
1102    #  Check for broken *.F/*.f handling and fix if possible
1103    check_for_broken_Ff
1104    
1105    if test ! "x$MPI" = x ; then
1106          echo "  Turning on MPI cpp macros"
1107          DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI"
1108    fi
1109    
1110  printf "\n===  Checking system libraries  ===\n"  printf "\n===  Checking system libraries  ===\n"
1111  echo -n "  Do we have the system() command using $FC...  "  printf "  Do we have the system() command using $FC...  "
1112  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.f <<EOF
1113        program hello        program hello
1114        call system('echo hi')        call system('echo hi')
# Line 867  else Line 1126  else
1126  fi  fi
1127  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1128    
1129  echo -n "  Do we have the fdate() command using $FC...  "  printf "  Do we have the fdate() command using $FC...  "
1130  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.f <<EOF
1131        program hello        program hello
1132        CHARACTER(128) string        CHARACTER(128) string
# Line 888  else Line 1147  else
1147  fi  fi
1148  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1149    
1150  echo -n "  Can we call simple C routines (here, \"cloc()\") using $FC...  "  printf "  Can we call simple C routines (here, \"cloc()\") using $FC...  "
1151  check_HAVE_CLOC  check_HAVE_CLOC
1152  if test "x$HAVE_CLOC" != x ; then  if test "x$HAVE_CLOC" != x ; then
1153      echo "yes"      echo "yes"
# Line 897  else Line 1156  else
1156  fi  fi
1157  rm -f genmake_t*  rm -f genmake_t*
1158    
1159    printf "  Can we create NetCDF-enabled binaries...  "
1160    check_netcdf_libs
1161    if test "x$HAVE_NETCDF" != x ; then
1162        echo "yes"
1163    else
1164        echo "no"
1165    fi
1166    
1167    
1168  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
1169  echo -n "  Adding MODS directories:  "  printf "  Adding MODS directories:  "
1170  for d in $MODS ; do  for d in $MODS ; do
1171      if test ! -d $d ; then      if test ! -d $d ; then
1172          echo          echo
1173          echo "Error: MODS directory \"$d\" not found!"          echo "Error: MODS directory \"$d\" not found!"
1174          exit 1          exit 1
1175      else      else
1176          echo -n " $d"          printf " $d"
1177          SOURCEDIRS="$SOURCEDIRS $d"          SOURCEDIRS="$SOURCEDIRS $d"
1178          INCLUDEDIRS="$INCLUDEDIRS $d"          INCLUDEDIRS="$INCLUDEDIRS $d"
1179      fi      fi
# Line 936  if test "x${TOOLSDIR}" = x ; then Line 1203  if test "x${TOOLSDIR}" = x ; then
1203      TOOLSDIR="$ROOTDIR/tools"      TOOLSDIR="$ROOTDIR/tools"
1204  fi  fi
1205  if test ! -d ${TOOLSDIR} ; then  if test ! -d ${TOOLSDIR} ; then
1206      echo "Error: the specified $TOOLSDIR (\"$TOOLSDIR\") does not exist!"      echo "Error: the specified TOOLSDIR (\"$TOOLSDIR\") does not exist!"
1207      exit 1      exit 1
1208  fi  fi
1209  if test "x$S64" = x ; then  if test "x$S64" = x ; then
# Line 957  if test -r $ROOTDIR"/eesupp/src/Makefile Line 1224  if test -r $ROOTDIR"/eesupp/src/Makefile
1224          rm -f make_eesupp.errors          rm -f make_eesupp.errors
1225      else      else
1226          echo "Error: problem encountered while building source files in eesupp:"          echo "Error: problem encountered while building source files in eesupp:"
1227          cat make_eesupp.errors          cat make_eesupp.errors 1>&2
1228          exit 1          exit 1
1229      fi      fi
1230  fi  fi
# Line 970  if test -r $ROOTDIR"/pkg/exch2/Makefile" Line 1237  if test -r $ROOTDIR"/pkg/exch2/Makefile"
1237      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
1238          rm -f make_exch2.errors          rm -f make_exch2.errors
1239      else      else
1240          echo "Error: problem encountered while building source files in exch2:"        cat make_exch2.errors          echo "Error: problem encountered while building source files in exch2:"
1241            cat make_exch2.errors 1>&2
1242          exit 1          exit 1
1243      fi      fi
1244  fi  fi
# Line 1030  else Line 1298  else
1298          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`
1299          RETVAL=$?          RETVAL=$?
1300          if test "x${RETVAL}" != x0 ; then          if test "x${RETVAL}" != x0 ; then
1301              echo -n "Error: can't parse default package list "              printf "Error: can't parse default package list "
1302              echo "-- please check PDEFAULT=\"$PDEFAULT\""              echo "-- please check PDEFAULT=\"$PDEFAULT\""
1303              exit 1              exit 1
1304          fi          fi
# Line 1038  else Line 1306  else
1306              PACKAGES="$PACKAGES $i"              PACKAGES="$PACKAGES $i"
1307          done          done
1308          echo "    before group expansion packages are: $PACKAGES"          echo "    before group expansion packages are: $PACKAGES"
1309          expand_pkg_groups          while ! expand_pkg_groups; do echo > /dev/null; done
1310          echo "    after group expansion packages are:  $PACKAGES"          echo "    after group expansion packages are:  $PACKAGES"
1311      fi      fi
1312  fi  fi
1313    
1314  echo "  applying DISABLE settings"  echo "  applying DISABLE settings"
1315    for i in $PACKAGES ; do
1316        echo $i >> ./.tmp_pack
1317    done
1318    for i in `grep  "-" ./.tmp_pack` ; do
1319        j=`echo $i | sed 's/[-]//'`
1320        DISABLE="$DISABLE $j"
1321    done
1322  pack=  pack=
1323  for p in $PACKAGES ; do  for p in $PACKAGES ; do
1324      addit="t"      addit="t"
# Line 1060  PACKAGES="$pack" Line 1335  PACKAGES="$pack"
1335  echo "  applying ENABLE settings"  echo "  applying ENABLE settings"
1336  echo "" > ./.tmp_pack  echo "" > ./.tmp_pack
1337  PACKAGES="$PACKAGES $ENABLE"  PACKAGES="$PACKAGES $ENABLE"
1338    # Test if each explicitly referenced package exists
1339  for i in $PACKAGES ; do  for i in $PACKAGES ; do
1340      if test ! -d "$ROOTDIR/pkg/$i" ; then      j=`echo $i | sed 's/[-+]//'`
1341        if test ! -d "$ROOTDIR/pkg/$j" ; then
1342          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""          echo "Error: can't find package $i at \"$ROOTDIR/pkg/$i\""
1343          exit 1          exit 1
1344      fi      fi
1345      echo $i >> ./.tmp_pack      echo $i >> ./.tmp_pack
1346  done  done
 pack=`cat ./.tmp_pack | sort | uniq`  
 rm -f ./.tmp_pack  
1347  PACKAGES=  PACKAGES=
1348  for i in $pack ; do  for i in `grep -v "-" ./.tmp_pack | sort | uniq` ; do
1349      PACKAGES="$PACKAGES $i"      PACKAGES="$PACKAGES $i"
1350  done  done
1351    rm -f ./.tmp_pack
1352  echo "    packages are:  $PACKAGES"  echo "    packages are:  $PACKAGES"
1353    
1354  echo "  applying package dependency rules"  echo "  applying package dependency rules"
# Line 1158  for i in $PACKAGES ; do Line 1434  for i in $PACKAGES ; do
1434      fi      fi
1435  done  done
1436    
1437    #  Build MNC templates and check for ability to build and use NetCDF
1438    echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1
1439    RETVAL=$?
1440    if test "x$RETVAL" = x0 ; then
1441        ( cd $ROOTDIR"/pkg/mnc" && $MAKE templates ) > make_mnc.errors 2>&1
1442        RETVAL=$?
1443        if test "x${RETVAL}" = x0 ; then
1444            rm -f make_mnc.errors
1445        else
1446            echo "Error: problem encountered while building source files in pkg/mnc:"
1447            cat make_mnc.errors 1>&2
1448            exit 1
1449        fi
1450        if test "x$HAVE_NETCDF" != xt ; then
1451            cat <<EOF
1452    
1453    WARNING: the "mnc" package has been enabled but tests failed to
1454      compile and/or execute NetCDF applications.  Please check that:
1455    
1456      1) NetCDF is installed for your compiler and
1457      2) the LIBS variable (within the 'optfile") specifies the correct
1458           NetCDF library to link against.
1459      
1460    EOF
1461        fi
1462    fi
1463    
1464  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
1465  PACKAGES_DOT_H=PACKAGES_CONFIG.h  PACKAGES_DOT_H=PACKAGES_CONFIG.h
# Line 1270  for i in $SOURCEDIRS ; do Line 1572  for i in $SOURCEDIRS ; do
1572      done      done
1573  done  done
1574    
1575    
1576  echo  echo
1577  echo "===  Creating the Makefile  ==="  echo "===  Creating the Makefile  ==="
1578  echo "  setting INCLUDES"  echo "  setting INCLUDES"
# Line 1286  rm -rf .links.tmp Line 1589  rm -rf .links.tmp
1589  mkdir .links.tmp  mkdir .links.tmp
1590  echo "# This section creates symbolic links" > srclinks.tmp  echo "# This section creates symbolic links" > srclinks.tmp
1591  echo "" >> srclinks.tmp  echo "" >> srclinks.tmp
1592  echo -n 'SRCFILES = '    > srclist.inc  printf 'SRCFILES = '    > srclist.inc
1593  echo -n 'CSRCFILES = '   > csrclist.inc  printf 'CSRCFILES = '   > csrclist.inc
1594  echo -n 'F90SRCFILES = ' > f90srclist.inc  printf 'F90SRCFILES = ' > f90srclist.inc
1595  echo -n 'HEADERFILES = ' > hlist.inc  printf 'HEADERFILES = ' > hlist.inc
1596  echo -n 'AD_FLOW_FILES = ' > ad_flow_files.inc  printf 'AD_FLOW_FILES = ' > ad_flow_files.inc
1597  alldirs="$SOURCEDIRS $INCLUDEDIRS ."  alldirs="$SOURCEDIRS $INCLUDEDIRS ."
1598  for d in $alldirs ; do  for d in $alldirs ; do
1599      deplist=      deplist=
# Line 1315  for d in $alldirs ; do Line 1618  for d in $alldirs ; do
1618                  case $extn in                  case $extn in
1619                      F)                      F)
1620                          echo    " \\"  >> srclist.inc                          echo    " \\"  >> srclist.inc
1621                          echo -n " $sf" >> srclist.inc                          printf " $sf" >> srclist.inc
1622                          ;;                          ;;
1623                      F90)                      F90)
1624                          echo    " \\"  >> f90srclist.inc                          echo    " \\"  >> f90srclist.inc
1625                          echo -n " $sf" >> f90srclist.inc                          printf " $sf" >> f90srclist.inc
1626                          ;;                          ;;
1627                      c)                      c)
1628                          echo    " \\"  >> csrclist.inc                          echo    " \\"  >> csrclist.inc
1629                          echo -n " $sf" >> csrclist.inc                          printf " $sf" >> csrclist.inc
1630                          ;;                          ;;
1631                      h)                      h)
1632                          echo    " \\"  >> hlist.inc                          echo    " \\"  >> hlist.inc
1633                          echo -n " $sf" >> hlist.inc                          printf " $sf" >> hlist.inc
1634                          ;;                          ;;
1635                      flow)                      flow)
1636                          echo    " \\"  >> ad_flow_files.inc                          echo    " \\"  >> ad_flow_files.inc
1637                          echo -n " $sf" >> ad_flow_files.inc                          printf " $sf" >> ad_flow_files.inc
1638                          ;;                          ;;
1639                  esac                  esac
1640              fi              fi
# Line 1360  echo "#    $MACHINE" >> $MAKEFILE Line 1663  echo "#    $MACHINE" >> $MAKEFILE
1663  echo "# This makefile was generated automatically on" >> $MAKEFILE  echo "# This makefile was generated automatically on" >> $MAKEFILE
1664  echo "#    $THISDATE" >> $MAKEFILE  echo "#    $THISDATE" >> $MAKEFILE
1665  echo "# by the command:" >> $MAKEFILE  echo "# by the command:" >> $MAKEFILE
1666  echo "#    $0 $@" >> $MAKEFILE  echo "#    $0 $G2ARGS" >> $MAKEFILE
1667  echo "# executed by:" >> $MAKEFILE  echo "# executed by:" >> $MAKEFILE
1668  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE
1669    
# Line 1428  FC = ${FC} Line 1731  FC = ${FC}
1731  # Fortran compiler  # Fortran compiler
1732  F90C = ${F90C}  F90C = ${F90C}
1733  # Link editor  # Link editor
1734  LINK = ${LINK}  LINK = ${LINK} ${LDADD}
1735    
1736  # Defines for CPP  # Defines for CPP
1737  DEFINES = ${DEFINES}  DEFINES = ${DEFINES}
# Line 1460  cat csrclist.inc      >> $MAKEFILE Line 1763  cat csrclist.inc      >> $MAKEFILE
1763  cat f90srclist.inc    >> $MAKEFILE  cat f90srclist.inc    >> $MAKEFILE
1764  cat hlist.inc         >> $MAKEFILE  cat hlist.inc         >> $MAKEFILE
1765  cat ad_flow_files.inc >> $MAKEFILE  cat ad_flow_files.inc >> $MAKEFILE
1766  echo               >> $MAKEFILE  echo >> $MAKEFILE
1767  echo 'F77FILES =  $(SRCFILES:.F=.f)'                                           >> $MAKEFILE  echo 'F77FILES =  $(SRCFILES:.F=.'$FS')'      >> $MAKEFILE
1768  echo 'F90FILES =  $(F90SRCFILES:.F90=.f90)'                                    >> $MAKEFILE  echo 'F90FILES =  $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE
1769  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE
1770    echo >> $MAKEFILE
1771    echo '.SUFFIXES:' >> $MAKEFILE
1772    echo '.SUFFIXES: .o .F .p .'$FS' .c .F90 .'$FS90 >> $MAKEFILE
1773  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
1774  rm -f ad_flow_files.inc  rm -f ad_flow_files.inc
1775    
1776  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
1777    
 .SUFFIXES:  
 .SUFFIXES: .o .f .p .F .c .F90 .f90  
   
1778  all: \$(EXECUTABLE)  all: \$(EXECUTABLE)
1779  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES)  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES)
1780          @echo Creating \$@ ...          @echo Creating \$@ ...
1781          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
1782  depend:  depend:
1783          @make links          @make links
1784          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)          \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
1785          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
1786            -rm -f makedepend.out
1787    
1788  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)
1789    
# Line 1491  output.txt: \$(EXECUTABLE) Line 1794  output.txt: \$(EXECUTABLE)
1794          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
1795    
1796  clean:  clean:
1797          -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} *.template          -rm -rf *.o *.$FS *.p *.$FS90 *.mod ${RMFILES} work.{pc,pcl} *.template
1798  Clean:  Clean:
1799          @make clean          @make clean
1800          @make cleanlinks          @make cleanlinks
# Line 1502  CLEAN: Line 1805  CLEAN:
1805          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
1806          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
1807          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
1808          -rm -f \$(EXECUTABLE) output.txt          -rm -f \$(EXECUTABLE) output.txt STD*
1809    
1810  #eh3 Makefile: makefile  #eh3 Makefile: makefile
1811  makefile:  makefile:
1812          $THIS_SCRIPT $@          $THIS_SCRIPT $G2ARGS
1813  cleanlinks:  cleanlinks:
1814          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
1815    
1816  # Special targets ($SPECIAL_FILES) which are create by make  # Special targets ($SPECIAL_FILES) which are create by make
1817  ${PACKAGES_DOT_H}:  ${PACKAGES_DOT_H}:
1818          @echo Creating \$@ ...          @echo Creating \$@ ...
1819          @\$(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) > \$@
1820  AD_CONFIG.h:  AD_CONFIG.h:
1821          @echo Creating \$@ ...          @echo Creating \$@ ...
1822          @\$(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 > \$@
1823  FC_NAMEMANGLE.h:  FC_NAMEMANGLE.h:
1824          @echo Creating \$@ ...          @echo Creating \$@ ...
1825          echo "$FC_NAMEMANGLE" > \$@          echo "$FC_NAMEMANGLE" > \$@
1826    
1827  # The normal chain of rules is (  .F - .f - .o  )  # The normal chain of rules is (  .F - .$FS - .o  )
1828  .F.f:  
1829    %.o : %.F
1830    
1831    .F.$FS:
1832          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1833  .f.o:  .$FS.o:
1834          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
1835  .F90.f90:  .F90.$FS90:
1836          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1837  .f90.o:  .$FS90.o:
1838          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<
1839  .c.o:  .c.o:
1840          \$(CC) \$(CFLAGS) -c \$<          \$(CC) \$(CFLAGS) -c \$<
1841    
1842  # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain  # Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain
1843  .F.p:  .F.p:
1844          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1845  .p.f:  .p.$FS:
1846          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<          \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
1847    
1848  #=========================================  #=========================================
# Line 1563  done Line 1869  done
1869    
1870  echo "  Add the source list for AD code generation"  echo "  Add the source list for AD code generation"
1871  echo >> $MAKEFILE  echo >> $MAKEFILE
1872  echo -n "AD_FILES = " >> $MAKEFILE  printf "AD_FILES = " >> $MAKEFILE
1873  AD_FILES=`cat ad_files`  AD_FILES=`cat ad_files`
1874  for i in $AD_FILES ; do  for i in $AD_FILES ; do
1875      echo    " \\" >> $MAKEFILE      echo    " \\" >> $MAKEFILE
1876      echo -n " $i" >> $MAKEFILE      printf " $i" >> $MAKEFILE
1877  done  done
1878  echo >> $MAKEFILE  echo >> $MAKEFILE
1879  rm -f ad_files  rm -f ad_files
# Line 1580  adtaf: ad_taf_output.f Line 1886  adtaf: ad_taf_output.f
1886  adtamc: ad_tamc_output.f  adtamc: ad_tamc_output.f
1887    
1888  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1889          @\$(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
1890          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
1891          -rm -f ad_config.template          -rm -f ad_config.template
1892          @make \$(F77FILES)          @make \$(F77FILES)
# Line 1612  ftltaf: ftl_taf_output.f Line 1918  ftltaf: ftl_taf_output.f
1918  ftltamc: ftl_tamc_output.f  ftltamc: ftl_tamc_output.f
1919    
1920  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)
1921          @\$(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
1922          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
1923          -rm -f ftl_config.template          -rm -f ftl_config.template
1924          @make \$(F77FILES)          @make \$(F77FILES)
# Line 1661  for i in $KPPFILES ; do Line 1967  for i in $KPPFILES ; do
1967      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
1968          echo "Error: unable to add file \"$i\" to the exceptions list"          echo "Error: unable to add file \"$i\" to the exceptions list"
1969      fi      fi
1970      echo "$base.f: $base.p" >> $MAKEFILE      echo "$base.$FS: $base.p" >> $MAKEFILE
1971  done  done
1972    
1973  echo "  Making list of NOOPTFILES"  echo "  Making list of NOOPTFILES"
# Line 1671  for i in $NOOPTFILES ; do Line 1977  for i in $NOOPTFILES ; do
1977      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
1978          echo "Error: unable to add file \"$i\" to the exceptions list"          echo "Error: unable to add file \"$i\" to the exceptions list"
1979      fi      fi
1980      echo "$base.o: $base.f" >> $MAKEFILE      echo "$base.o: $base.$FS" >> $MAKEFILE
1981      printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE      printf "\t\$(FC) \$(FFLAGS) \$(NOOPTFLAGS) -c \$<\n" >> $MAKEFILE
1982  done  done
1983    
# Line 1685  printf "\n\n# DO NOT DELETE\n" >> $MAKEF Line 1991  printf "\n\n# DO NOT DELETE\n" >> $MAKEF
1991  printf "\n===  Done  ===\n"  printf "\n===  Done  ===\n"
1992    
1993  # Create special header files  # Create special header files
1994  $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"
1995  if test ! -f $PACKAGES_DOT_H ; then  if test ! -f $PACKAGES_DOT_H ; then
1996      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H      mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H
1997  else  else
1998      cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H      cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H > /dev/null 2>&1
1999      RETVAL=$?      RETVAL=$?
2000      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
2001          rm -f $PACKAGES_DOT_H".tmp"          rm -f $PACKAGES_DOT_H".tmp"
# Line 1699  else Line 2005  else
2005      fi      fi
2006  fi  fi
2007  if test ! -f AD_CONFIG.h ; then  if test ! -f AD_CONFIG.h ; then
2008      $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
2009  fi  fi
2010    
2011    
2012  #  Write the "state" for future records  #  Write the "state" for future records
2013  if test "x$DUMPSTATE" != xf ; then  if test "x$DUMPSTATE" != xf ; then
2014      echo -n "" > genmake_state      printf "" > genmake_state
2015      for i in $gm_state ; do      for i in $gm_state ; do
2016          t1="t2=\$$i"          t1="t2=\$$i"
2017          eval $t1          eval $t1

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.78

  ViewVC Help
Powered by ViewVC 1.1.22