/[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.93 by edhill, Fri Jul 30 19:53:15 2004 UTC revision 1.128 by edhill, Mon Sep 5 13:39:28 2005 UTC
# Line 122  EOF Line 122  EOF
122        stop        stop
123        end        end
124  EOF  EOF
125      test -f Makefile  &&  mv -f Makefile Makefile.bak      test -f $MAKEFILE  &&  mv -f $MAKEFILE $MAKEFILE".tst"
126      cat <<EOF >> Makefile      cat <<EOF >> $MAKEFILE
 %.$tfs : %.F  
127  .SUFFIXES:  .SUFFIXES:
128  genmake_hello.$tfs: genmake_hello.F  .SUFFIXES: .$tfs .F
129          $LN genmake_hello.F genmake_hello.$tfs  .F.$tfs:
130            $LN \$< \$@
131  EOF  EOF
132      $MAKE "genmake_hello."$tfs > /dev/null 2>&1      $MAKE "genmake_hello."$tfs > /dev/null 2>&1
133      RETVAL=$?      RETVAL=$?
# Line 148  EOF Line 148  EOF
148              return              return
149          fi          fi
150      fi      fi
151      rm -f genmake_hello.* Makefile      rm -f genmake_hello.* $MAKEFILE
152      test -f Makefile  &&  mv -f Makefile.bak Makefile      test -f $MAKEFILE".tst"  &&  mv -f $MAKEFILE".tst" $MAKEFILE
153    
154      #  If we make it here, use the extensions      #  If we make it here, use the extensions
155      FS=$tfs      FS=$tfs
# Line 181  look_for_makedepend()  { Line 181  look_for_makedepend()  {
181      if test "x${MAKEDEPEND}" = x ; then      if test "x${MAKEDEPEND}" = x ; then
182          which makedepend > /dev/null 2>&1          which makedepend > /dev/null 2>&1
183          RV0=$?          RV0=$?
184            test -f $MAKEFILE  &&  mv -f $MAKEFILE $MAKEFILE".tst"
185            #  echo 'MAKEFILE="'$MAKEFILE'"'
186            cat <<EOF >> $MAKEFILE
187    #   THIS IS A TEST MAKEFILE GENERATED BY "genmake2"
188    #
189    #   Some "makedepend" implementations will die if they cannot
190    #   find a Makefile -- so this file is here to gives them an
191    #   empty one to find and parse.
192    EOF
193          cat <<EOF >> genmake_tc.f          cat <<EOF >> genmake_tc.f
194        program test        program test
195        write(*,*) 'test'        write(*,*) 'test'
# Line 189  look_for_makedepend()  { Line 198  look_for_makedepend()  {
198  EOF  EOF
199          makedepend genmake_tc.f > /dev/null 2>&1          makedepend genmake_tc.f > /dev/null 2>&1
200          RV1=$?          RV1=$?
201            test -f $MAKEFILE  &&  rm -f $MAKEFILE
202            test -f $MAKEFILE".tst"  &&  mv -f $MAKEFILE".tst" $MAKEFILE
203          if test "x${RV0}${RV1}" = x00 ; then          if test "x${RV0}${RV1}" = x00 ; then
204              MAKEDEPEND=makedepend              MAKEDEPEND=makedepend
205          else          else
# Line 310  EOF Line 321  EOF
321    
322      #================================================================      #================================================================
323      #  look for possible FORTRAN compilers      #  look for possible FORTRAN compilers
324      tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95"      tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95 gfortran"
325      p_FC=      p_FC=
326      for c in $tmp ; do      for c in $tmp ; do
327          rm -f ./hello.f ./hello          rm -f ./hello.f ./hello
# Line 516  Usage: "$0" [OPTIONS] Line 527  Usage: "$0" [OPTIONS]
527            *only* works if it is supported by the OPTFILE that            *only* works if it is supported by the OPTFILE that
528            is being used.            is being used.
529    
530        -ts | --ts
531              Produce timing information per timestep
532    
533      -mpi | --mpi      -mpi | --mpi
534            Include MPI header files and link to MPI libraries            Include MPI header files and link to MPI libraries
535      -mpi=PATH | --mpi=PATH      -mpi=PATH | --mpi=PATH
536            Include MPI header files and link to MPI libraries using MPI_ROOT            Include MPI header files and link to MPI libraries using MPI_ROOT
537            set to PATH. i.e. Include files from $PATH/include, link to libraries            set to PATH. i.e. Include files from \$PATH/include, link to libraries
538            from $PATH/lib and use binaries from $PATH/bin.            from \$PATH/lib and use binaries from \$PATH/bin.
539    
540      -bash NAME      -bash NAME
541            Explicitly specify the Bourne or BASH shell to use            Explicitly specify the Bourne or BASH shell to use
# Line 581  WARNING: Please contact <MITgcm-support@ Line 595  WARNING: Please contact <MITgcm-support@
595  EOF  EOF
596          return 1          return 1
597      fi      fi
598      cat > genmake_tcomp.f <<EOF      cat > genmake_tcomp.$FS <<EOF
599        subroutine tcall( string )        subroutine tcall( string )
600        character*(*) string        character*(*) string
601        call tsub( string )        call tsub( string )
602        end        end
603  EOF  EOF
604      $FC $FFLAGS $DEFINES -c genmake_tcomp.f >> genmake_warnings 2>&1      $FC $FFLAGS $DEFINES -c genmake_tcomp.$FS >> genmake_warnings 2>&1
605      RETVAL=$?      RETVAL=$?
606      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
607          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
# Line 653  void FC_NAMEMANGLE(cloc) ( double *curti Line 667  void FC_NAMEMANGLE(cloc) ( double *curti
667   *curtim = *curtim/1.E6;   *curtim = *curtim/1.E6;
668  }  }
669  EOF  EOF
670      make genmake_tc_1.o >> genmake_tc.log 2>&1      make genmake_tc_1.o >> genmake_warnings 2>&1
671      RET_C=$?      RET_C=$?
672      cat <<EOF > genmake_tc_2.f      cat <<EOF > genmake_tc_2.$FS
673        program hello        program hello
674        Real*8 wtime        Real*8 wtime
675        external cloc        external cloc
676        call cloc(wtime)        call cloc(wtime)
677        print *," HELLO WORLD", wtime        print *," HELLO WORLD", wtime
678        end program hello        end
679  EOF  EOF
680      $FC $FFLAGS -o genmake_tc genmake_tc_2.f genmake_tc_1.o >> genmake_tc.log 2>&1      $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1
681      RET_F=$?      RET_F=$?
682      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_tc.log 2>&1      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1
683      RETVAL=$?      RETVAL=$?
684      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
685          HAVE_CLOC=t          HAVE_CLOC=t
# Line 675  EOF Line 689  EOF
689  }  }
690    
691    
692    check_HAVE_STAT()  {
693        get_fortran_c_namemangling
694        cat <<EOF > genmake_tc_1.c
695    $FC_NAMEMANGLE
696    #include <stdio.h>
697    #include <stdlib.h>
698    #include <unistd.h>
699    #include <sys/stat.h>
700    #include <sys/types.h>
701    void FC_NAMEMANGLE(tfsize) ( int *nbyte )
702    {
703        char name[512];
704        struct stat astat;
705    
706        name[0] = 'a'; name[1] = '\0';
707        if (! stat(name, &astat))
708            *nbyte = (int)(astat.st_size);
709        else
710            *nbyte = -1;
711    }
712    EOF
713        make genmake_tc_1.o >> genmake_tc.log 2>&1
714        RET_C=$?
715        cat <<EOF > genmake_tc_2.$FS
716          program hello
717          integer nbyte
718          call tfsize(nbyte)
719          print *," HELLO WORLD", nbyte
720          end
721    EOF
722        $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1
723        RET_F=$?
724        test -x ./genmake_tc  &&  ./genmake_tc >> genmake_tc.log 2>&1
725        RETVAL=$?
726        if test "x$RETVAL" = x0 ; then
727            HAVE_STAT=t
728            DEFINES="$DEFINES -DHAVE_STAT"
729        fi
730        rm -f genmake_tc*
731    }
732    
733    
734  check_netcdf_libs()  {  check_netcdf_libs()  {
735        if test ! "x$SKIP_NETCDF_CHECK" = x ; then
736            return
737        fi
738      echo "" > genmake_tnc.log      echo "" > genmake_tnc.log
739      cat <<EOF > genmake_tnc.for      cat <<EOF > genmake_tnc.F
740        program fgennc        program fgennc
741  #include "netcdf.inc"  #include "netcdf.inc"
742    EOF
743        if test ! "x$MPI" = x ; then
744            echo '#include "mpif.h"' >> genmake_tnc.F
745        fi
746        cat <<EOF >> genmake_tnc.F
747        integer iret, ncid, xid        integer iret, ncid, xid
748        iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)        iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)
749        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
# Line 689  check_netcdf_libs()  { Line 753  check_netcdf_libs()  {
753        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
754        end        end
755  EOF  EOF
756      #echo "$CPP $DEFINES $INCLUDES"      echo "Executing:" > genmake_tnc.log
757      $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null  \      echo "  $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS" \
758          &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1          > genmake_tnc.log
759        RET_CPP=f
760        $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null  \
761            &&  RET_CPP=t
762        if test "x$RET_CPP" = xf ; then
763            echo "  WARNING: CPP failed to pre-process the netcdf test." \
764                > genmake_tnc.log
765            echo "    Please check that \$INCLUDES is properly set." \
766                > genmake_tnc.log
767        fi
768        echo "Executing:" > genmake_tnc.log
769        echo "  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS" > genmake_tnc.log
770        echo "  $LINK -o genmake_tnc.o $LIBS" > genmake_tnc.log
771        $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
772            &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1
773      RET_COMPILE=$?      RET_COMPILE=$?
774      test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1  
775      RETVAL=$?      #EH3  Remove test program execution for machines that either disallow
776      if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then      #EH3  execution or cannot support it (eg. cross-compilers)
777        #EH3
778        #EH3 test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
779        #EH3 RETVAL=$?
780        #EH3 if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
781    
782        if test "x$RET_COMPILE" = x0 ; then
783          HAVE_NETCDF=t          HAVE_NETCDF=t
784      else      else
785          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
786          $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null  \          $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null  \
787              &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
788              $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1              &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1
789          RET_COMPILE=$?          RET_COMPILE=$?
790          test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1          if test "x$RET_COMPILE" = x0 ; then
         RETVAL=$?  
         if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then  
791              LIBS="$LIBS -lnetcdf"              LIBS="$LIBS -lnetcdf"
792              HAVE_NETCDF=t              HAVE_NETCDF=t
793          else          else
# Line 728  PLATFORM= Line 810  PLATFORM=
810  LN=  LN=
811  S64=  S64=
812  KPP=  KPP=
813  FC=  #FC=
814  #CC=gcc  #CC=gcc
815  CPP=  #CPP=
816  LINK=  LINK=
817  DEFINES=  DEFINES=
818  PACKAGES=  PACKAGES=
819  ENABLE=  ENABLE=
820  DISABLE=  DISABLE=
821  MAKEFILE=  # MAKEFILE=
822  #MAKEDEPEND=  # MAKEDEPEND=
823  PDEPEND=  PDEPEND=
824  DUMPSTATE=t  DUMPSTATE=t
825  PDEFAULT=  PDEFAULT=
826  OPTFILE=  OPTFILE=
827  INCLUDES="-I."  INCLUDES="-I. $INCLUDES"
828  FFLAGS=  FFLAGS=
829  FOPTIM=  FOPTIM=
830  CFLAGS=  CFLAGS=
# Line 755  NOOPTFILES= Line 837  NOOPTFILES=
837  NOOPTFLAGS=  NOOPTFLAGS=
838  MPI=  MPI=
839  MPIPATH=  MPIPATH=
840    TS=
841    
842  # DEFINES checked by test compilation  # DEFINES checked by test compilation or command-line
843  HAVE_SYSTEM=  HAVE_SYSTEM=
844  HAVE_FDATE=  HAVE_FDATE=
845  FC_NAMEMANGLE=  FC_NAMEMANGLE=
846  HAVE_CLOC=  HAVE_CLOC=
847    HAVE_STAT=
848  HAVE_NETCDF=  HAVE_NETCDF=
849  HAVE_ETIME=  HAVE_ETIME=
850    IGNORE_TIME=
851    
852  MODS=  MODS=
853  TOOLSDIR=  TOOLSDIR=
# Line 773  STANDARDDIRS="USE_THE_DEFAULT" Line 858  STANDARDDIRS="USE_THE_DEFAULT"
858  G2ARGS=  G2ARGS=
859  BASH=  BASH=
860  PWD=`pwd`  PWD=`pwd`
861  MAKE=make  test "x$MAKE" = x  &&  MAKE=make
862  AWK=awk  test "x$AWK" = x   &&  AWK=awk
863  THISHOSTNAME=`hostname`  THISHOST=`hostname`
864  THISCWD=`pwd`  THISCWD=`pwd`
865  THISDATE=`date`  THISDATE=`date`
866    THISUSER=`echo $USER`
867    THISVER=
868  MACHINE=`uname -a`  MACHINE=`uname -a`
869  EXECUTABLE=  EXECUTABLE=
870  EXEHOOK=  EXEHOOK=
# Line 806  TAMC_EXTRA= Line 893  TAMC_EXTRA=
893    
894  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
895  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
896  gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS"  gm_s2="FC CPP IEEE TS MPI JAM DUMPSTATE STANDARDDIRS"
897    
898  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
899  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 "
900  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
901  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"
902  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
903  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME"  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME"
904    
# Line 852  else Line 939  else
939      echo "none found"      echo "none found"
940  fi  fi
941    
942  #  echo "$0::$1:$2:$3:$4:$5:$6:$7:"  #echo "$0::$1:$2:$3:$4:$5:$6:$7:"
943  #OPTIONS=  #OPTIONS=
944  #n=0  #n=0
945  #for i ; do  #for i ; do
# Line 864  fi Line 951  fi
951  #done  #done
952  #parse_options  #parse_options
953  ac_prev=  ac_prev=
954  for ac_option in $@ ; do  for ac_option in "$@" ; do
955    
956      G2ARGS="$G2ARGS \"$ac_option\""      G2ARGS="$G2ARGS \"$ac_option\""
957    
# Line 986  for ac_option in $@ ; do Line 1073  for ac_option in $@ ; do
1073          -noieee | --noieee)          -noieee | --noieee)
1074              IEEE= ;;              IEEE= ;;
1075    
1076            -ts | --ts)
1077                TS=true ;;
1078    
1079          -mpi | --mpi)          -mpi | --mpi)
1080              MPI=true ;;              MPI=true ;;
1081          -mpi=* | --mpi=*)          -mpi=* | --mpi=*)
# Line 1009  for ac_option in $@ ; do Line 1099  for ac_option in $@ ; do
1099              ac_prev=TAMC_EXTRA ;;              ac_prev=TAMC_EXTRA ;;
1100          -tamc_extra=* | --tamc_extra=*)          -tamc_extra=* | --tamc_extra=*)
1101              TAMC_EXTRA=$ac_optarg ;;              TAMC_EXTRA=$ac_optarg ;;
1102            
1103            -ignoretime | -ignore_time | --ignoretime | --ignore_time)
1104                IGNORE_TIME="-DIGNORE_TIME" ;;
1105    
1106          -*)          -*)
1107              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
# Line 1024  for ac_option in $@ ; do Line 1117  for ac_option in $@ ; do
1117            
1118  done  done
1119    
1120    
1121  if test -f ./.genmakerc ; then  if test -f ./.genmakerc ; then
1122      echo      echo
1123      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
# Line 1036  if test -f ./.genmakerc ; then Line 1130  if test -f ./.genmakerc ; then
1130      echo      echo
1131  fi  fi
1132    
1133    #  Find the MITgcm ${ROOTDIR}
1134  if test "x${ROOTDIR}" = x ; then  if test "x${ROOTDIR}" = x ; then
1135      tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'`      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`
1136      if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then      if test "x$tmp" = "xbin" -a -d ../model -a -d ../eesup -a -d ../pkg ; then
1137          ROOTDIR=".."          ROOTDIR=".."
1138      else      else
# Line 1062  if test ! -d ${ROOTDIR} ; then Line 1157  if test ! -d ${ROOTDIR} ; then
1157      exit 1      exit 1
1158  fi  fi
1159    
1160    #  Find the MITgcm ${THISVER}
1161    if test -f "${ROOTDIR}/doc/tag-index" ; then
1162        THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1`
1163    fi
1164    
1165    if test "x$MAKEFILE" = x ; then
1166        MAKEFILE="Makefile"
1167    fi
1168    
1169  echo "  getting OPTFILE information:  "  echo "  getting OPTFILE information:  "
1170  if test "x${OPTFILE}" = x ; then  if test "x${OPTFILE}" = x ; then
1171      if test "x$MITGCM_OF" = x ; then      if test "x$MITGCM_OF" = x ; then
# Line 1091  if test "x$OPTFILE" != xNONE ; then Line 1195  if test "x$OPTFILE" != xNONE ; then
1195      fi      fi
1196  fi  fi
1197    
 #  Check for broken systems that cannot correctly distinguish *.F and *.f files  
 # check_for_broken_Ff  
   
1198  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:  "
1199  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1200      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" = x ; then
# Line 1121  if test "x${AD_OPTFILE}" != xNONE ; then Line 1222  if test "x${AD_OPTFILE}" != xNONE ; then
1222      fi      fi
1223  fi  fi
1224    
1225    #====================================================================
1226    #  Set default values if not set by the optfile
1227    #
1228  #  Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined.  If not,  #  Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined.  If not,
1229  #  either set defaults or complain and abort!  #  either set defaults or complain and abort!
1230  if test ! "x$BASH" = x ; then  if test ! "x$BASH" = x ; then
# Line 1207  if test ! "x$MPI" = x ; then Line 1311  if test ! "x$MPI" = x ; then
1311        DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI"        DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI"
1312  fi  fi
1313    
1314    if test ! "x$TS" = x ; then
1315          echo "  Turning on timing per timestep"
1316          DEFINES="$DEFINES -DTIME_PER_TIMESTEP"
1317    fi
1318    
1319  printf "\n===  Checking system libraries  ===\n"  printf "\n===  Checking system libraries  ===\n"
1320  printf "  Do we have the system() command using $FC...  "  printf "  Do we have the system() command using $FC...  "
1321  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1322        program hello        program hello
1323        call system('echo hi')        call system('echo hi')
1324        end        end
1325  EOF  EOF
1326  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1327  RETVAL=$?  RETVAL=$?
1328  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1329      HAVE_SYSTEM=t      HAVE_SYSTEM=t
# Line 1227  fi Line 1336  fi
1336  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1337    
1338  printf "  Do we have the fdate() command using $FC...  "  printf "  Do we have the fdate() command using $FC...  "
1339  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1340        program hello        program hello
1341        CHARACTER(128) string        CHARACTER(128) string
1342        string = ' '        string = ' '
# Line 1235  cat > genmake_tcomp.f <<EOF Line 1344  cat > genmake_tcomp.f <<EOF
1344        print *, string        print *, string
1345        end        end
1346  EOF  EOF
1347  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1348  RETVAL=$?  RETVAL=$?
1349  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1350      HAVE_FDATE=t      HAVE_FDATE=t
# Line 1248  fi Line 1357  fi
1357  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1358    
1359  printf "  Do we have the etime() command using $FC...  "  printf "  Do we have the etime() command using $FC...  "
1360  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1361        program hello        program hello
1362        REAL*4 ACTUAL, TARRAY(2)        REAL*4 ACTUAL, TARRAY(2)
1363        EXTERNAL ETIME        EXTERNAL ETIME
# Line 1257  cat > genmake_tcomp.f <<EOF Line 1366  cat > genmake_tcomp.f <<EOF
1366        print *, tarray        print *, tarray
1367        end        end
1368  EOF  EOF
1369  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1370  RETVAL=$?  RETVAL=$?
1371  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1372      HAVE_ETIME=t      HAVE_ETIME=t
# Line 1278  else Line 1387  else
1387  fi  fi
1388  rm -f genmake_t*  rm -f genmake_t*
1389    
1390    printf "  Can we use stat() through C calls...  "
1391    check_HAVE_STAT
1392    if test "x$HAVE_STAT" != x ; then
1393        echo "yes"
1394    else
1395        echo "no"
1396    fi
1397    rm -f genmake_t*
1398    
1399  printf "  Can we create NetCDF-enabled binaries...  "  printf "  Can we create NetCDF-enabled binaries...  "
1400  check_netcdf_libs  check_netcdf_libs
1401  if test "x$HAVE_NETCDF" != x ; then  if test "x$HAVE_NETCDF" != x ; then
# Line 1285  if test "x$HAVE_NETCDF" != x ; then Line 1403  if test "x$HAVE_NETCDF" != x ; then
1403  else  else
1404      echo "no"      echo "no"
1405  fi  fi
1406    DEFINES="$DEFINES $IGNORE_TIME"
1407    
1408  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
1409  printf "  Adding MODS directories:  "  printf "  Adding MODS directories:  "
# Line 1302  for d in $MODS ; do Line 1420  for d in $MODS ; do
1420  done  done
1421  echo  echo
1422    
 if test "x$MAKEFILE" = x ; then  
     MAKEFILE="Makefile"  
 fi  
1423  if test "x${PLATFORM}" = x ; then  if test "x${PLATFORM}" = x ; then
1424      PLATFORM=$p_PLATFORM      PLATFORM=$p_PLATFORM
1425  fi  fi
1426    
1427  if test "x${EXEDIR}" = x ; then  if test "x${EXEDIR}" = x ; then
1428      tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'`      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`
1429      if test "x$tmp" = "xbin" -a -d ../exe -a $ROOTDIR = .. ; then      if test "x$tmp" = "xbin" -a -d ../exe -a $ROOTDIR = .. ; then
1430          EXEDIR=../exe          EXEDIR=../exe
1431      else      else
# Line 1330  if test ! -d ${TOOLSDIR} ; then Line 1445  if test ! -d ${TOOLSDIR} ; then
1445      exit 1      exit 1
1446  fi  fi
1447  if test "x$S64" = x ; then  if test "x$S64" = x ; then
1448      S64='$(TOOLSDIR)/set64bitConst.sh'      echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.sh > /dev/null 2>&1
1449        RETVAL=$?
1450        if test "x${RETVAL}" = x0 ; then
1451            S64='$(TOOLSDIR)/set64bitConst.sh'
1452        else
1453            echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.csh > /dev/null 2>&1
1454            RETVAL=$?
1455            if test "x${RETVAL}" = x0 ; then
1456                S64='$(TOOLSDIR)/set64bitConst.csh'
1457            else
1458                cat <<EOF
1459    
1460    ERROR: neither of the two default scripts:
1461    
1462        ${TOOLSDIR}/set64bitConst.sh
1463        ${TOOLSDIR}/set64bitConst.csh
1464    
1465      are working so please check paths or specify (with \$S64) a
1466      working version of this script.
1467    
1468    EOF
1469                exit 1
1470            fi
1471        fi
1472  fi  fi
1473  THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'`  THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'`
1474    
# Line 1475  done Line 1613  done
1613  rm -f ./.tmp_pack  rm -f ./.tmp_pack
1614  echo "    packages are:  $PACKAGES"  echo "    packages are:  $PACKAGES"
1615    
1616    #  Check availability of NetCDF and then either build the MNC template
1617    #  files or delete mnc from the list of available packages.
1618    echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1
1619    RETVAL=$?
1620    if test "x$RETVAL" = x0 ; then
1621        if test "x$HAVE_NETCDF" != xt ; then
1622            cat <<EOF
1623    
1624    *********************************************************************
1625    WARNING: the "mnc" package was enabled but tests failed to compile
1626      NetCDF applications.  Please check that:
1627    
1628      1) NetCDF is correctly installed for this compiler and
1629      2) the LIBS variable (within the "optfile") specifies the correct
1630           NetCDF library to link against.
1631    
1632      Due to this failure, the "mnc" package is now DISABLED.
1633    *********************************************************************
1634    
1635    EOF
1636            PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`
1637            DISABLE="$DISABLE mnc"
1638        else
1639            ( cd $ROOTDIR"/pkg/mnc" && $MAKE testclean && $MAKE templates ) > make_mnc.errors 2>&1
1640            RETVAL=$?
1641            if test "x${RETVAL}" = x0 ; then
1642                rm -f make_mnc.errors
1643            else
1644                echo "Error: problem encountered while building source files in pkg/mnc:"
1645                cat make_mnc.errors 1>&2
1646                exit 1
1647            fi
1648        fi
1649    fi
1650    
1651  echo "  applying package dependency rules"  echo "  applying package dependency rules"
1652  ck=  ck=
1653  while test "x$ck" != xtt ; do  while test "x$ck" != xtt ; do
# Line 1559  for i in $PACKAGES ; do Line 1732  for i in $PACKAGES ; do
1732      fi      fi
1733  done  done
1734    
 #  Build MNC templates and check for ability to build and use NetCDF  
 echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1  
 RETVAL=$?  
 if test "x$RETVAL" = x0 ; then  
     ( cd $ROOTDIR"/pkg/mnc" && $MAKE templates ) > make_mnc.errors 2>&1  
     RETVAL=$?  
     if test "x${RETVAL}" = x0 ; then  
         rm -f make_mnc.errors  
     else  
         echo "Error: problem encountered while building source files in pkg/mnc:"  
         cat make_mnc.errors 1>&2  
         exit 1  
     fi  
     if test "x$HAVE_NETCDF" != xt ; then  
         cat <<EOF  
   
 WARNING: the "mnc" package has been enabled but tests failed to  
   compile and/or execute NetCDF applications.  Please check that:  
   
   1) NetCDF is installed for your compiler and  
   2) the LIBS variable (within the 'optfile") specifies the correct  
        NetCDF library to link against.  
     
 EOF  
     fi  
 fi  
   
1735  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
1736  PACKAGES_DOT_H=PACKAGES_CONFIG.h  PACKAGES_DOT_H=PACKAGES_CONFIG.h
1737  #  The following UGLY HACK sets multiple "#undef"s and it needs to go  #  The following UGLY HACK sets multiple "#undef"s and it needs to go
# Line 1605  for n in $names ; do Line 1751  for n in $names ; do
1751              fi              fi
1752          done          done
1753          if test "x$has_pack" = xf ; then          if test "x$has_pack" = xf ; then
1754              undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`              undef=`echo "ALLOW_$n" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1755              DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef"              DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef"
1756          fi          fi
1757      fi      fi
1758  done  done
1759  ENABLED_PACKAGES=  ENABLED_PACKAGES=
1760  for i in $PACKAGES ; do  for i in $PACKAGES ; do
1761      def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'`      def=`echo "ALLOW_$i" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1762      ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def"      ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def"
1763  #eh3 DEFINES="$DEFINES -D$def"  #eh3 DEFINES="$DEFINES -D$def"
1764    
# Line 1696  for i in $SOURCEDIRS ; do Line 1842  for i in $SOURCEDIRS ; do
1842          cat $i/$j >> ad_files          cat $i/$j >> ad_files
1843      done      done
1844  done  done
1845    if test ! "x"$FS = "x.f" ; then
1846        cat ad_files | sed -e "s/\.f/.$FS/g" > ad_files_f
1847        mv -f ad_files_f ad_files
1848    fi
1849    
1850  echo  echo
1851  echo "===  Creating the Makefile  ==="  echo "===  Creating the Makefile  ==="
# Line 1732  for d in $alldirs ; do Line 1881  for d in $alldirs ; do
1881                          ;;                          ;;
1882                    ./FC_NAMEMANGLE.h)                    ./FC_NAMEMANGLE.h)
1883                          ;;                          ;;
1884                      ./BUILD_INFO.h)
1885                            ;;
1886                    *)                    *)
1887                          touch .links.tmp/$sf                          touch .links.tmp/$sf
1888                          deplist="$deplist $sf"                          deplist="$deplist $sf"
1889                          ;;                          ;;
1890                  esac                  esac
1891                  extn=`echo $sf | $AWK -F '.' '{print $NF}'`                  extn=`echo $sf | $AWK -F. '{print $NF}'`
1892                  case $extn in                  case $extn in
1893                      F)                      F)
1894                          echo    " \\"  >> srclist.inc                          echo    " \\"  >> srclist.inc
# Line 1788  echo "#    $THISDATE" >> $MAKEFILE Line 1939  echo "#    $THISDATE" >> $MAKEFILE
1939  echo "# by the command:" >> $MAKEFILE  echo "# by the command:" >> $MAKEFILE
1940  echo "#    $0 $G2ARGS" >> $MAKEFILE  echo "#    $0 $G2ARGS" >> $MAKEFILE
1941  echo "# executed by:" >> $MAKEFILE  echo "# executed by:" >> $MAKEFILE
1942  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE  echo "#    ${THISUSER}@${THISHOST}:${THISCWD}" >> $MAKEFILE
1943    
1944  EXE_AD=$EXECUTABLE"_ad"  EXE_AD=$EXECUTABLE"_ad"
1945  EXE_FTL=$EXECUTABLE"_ftl"  EXE_FTL=$EXECUTABLE"_ftl"
# Line 1834  ENABLED_PACKAGES = ${ENABLED_PACKAGES} Line 1985  ENABLED_PACKAGES = ${ENABLED_PACKAGES}
1985  DISABLED_PACKAGES = ${DISABLED_PACKAGES}  DISABLED_PACKAGES = ${DISABLED_PACKAGES}
1986    
1987  # These files are created by Makefile  # These files are created by Makefile
1988  SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h  SPECIAL_FILES = ${PACKAGES_DOT_H} AD_CONFIG.h FC_NAMEMANGLE.h BUILD_INFO.h
1989    
1990  EOF  EOF
1991    
# Line 1850  MAKEDEPEND = ${MAKEDEPEND} Line 2001  MAKEDEPEND = ${MAKEDEPEND}
2001  # Special preprocessor (KAP on DECs, FPP on Crays)  # Special preprocessor (KAP on DECs, FPP on Crays)
2002  KPP = ${KPP}  KPP = ${KPP}
2003  # Fortran compiler  # Fortran compiler
2004  FC = ${FC} in  FC = ${FC}
2005  # Fortran compiler  # Fortran compiler
2006  F90C = ${F90C}  F90C = ${F90C}
2007  # C compiler  # C compiler
# Line 1877  CFLAGS = ${CFLAGS} Line 2028  CFLAGS = ${CFLAGS}
2028  NOOPTFILES = ${NOOPTFILES}  NOOPTFILES = ${NOOPTFILES}
2029  NOOPTFLAGS = ${NOOPTFLAGS}  NOOPTFLAGS = ${NOOPTFLAGS}
2030  # Flags and libraries needed for linking  # Flags and libraries needed for linking
2031  LIBS = ${LIBS} \$(XLIBS)  LIBS = ${LIBS}
2032  # Name of the Mekfile  # Name of the Mekfile
2033  MAKEFILE=${MAKEFILE}  MAKEFILE=${MAKEFILE}
2034    
# Line 1890  cat hlist.inc         >> $MAKEFILE Line 2041  cat hlist.inc         >> $MAKEFILE
2041  cat ad_flow_files.inc >> $MAKEFILE  cat ad_flow_files.inc >> $MAKEFILE
2042  echo >> $MAKEFILE  echo >> $MAKEFILE
2043  echo 'F77FILES =  $(SRCFILES:.F=.'$FS')'      >> $MAKEFILE  echo 'F77FILES =  $(SRCFILES:.F=.'$FS')'      >> $MAKEFILE
2044  echo 'F90FILES =  $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE  echo 'F90FILES =  $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE
2045  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE
2046  echo >> $MAKEFILE  echo >> $MAKEFILE
2047  echo '.SUFFIXES:' >> $MAKEFILE  echo '.SUFFIXES:' >> $MAKEFILE
# Line 1938  makefile: Line 2089  makefile:
2089  cleanlinks:  cleanlinks:
2090          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
2091    
2092  # Special targets ($SPECIAL_FILES) which are create by make  # Special targets (SPECIAL_FILES) which are create by make
2093  ${PACKAGES_DOT_H}:  ${PACKAGES_DOT_H}:
2094          @echo Creating \$@ ...          @echo Creating \$@ ...
2095          @$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) > \$@          @$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) > \$@
# Line 1949  FC_NAMEMANGLE.h: Line 2100  FC_NAMEMANGLE.h:
2100          @echo Creating \$@ ...          @echo Creating \$@ ...
2101          echo "$FC_NAMEMANGLE" > \$@          echo "$FC_NAMEMANGLE" > \$@
2102    
2103    BUILD_INFO.h:
2104            @echo Creating \$@ ...
2105    EOF
2106    
2107    test ! "x$THISVER" = x  && echo "       -echo \"#define THISVER '$THISVER'\" > \$@"   >> $MAKEFILE
2108    test ! "x$THISUSER" = x && echo "       -echo \"#define THISUSER '$THISUSER'\" >> \$@" >> $MAKEFILE
2109    test ! "x$THISDATE" = x && echo "       -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE
2110    test ! "x$THISHOST" = x && echo "       -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE
2111    
2112    cat >>$MAKEFILE <<EOF
2113    
2114  # The normal chain of rules is (  .F - .$FS - .o  )  # The normal chain of rules is (  .F - .$FS - .o  )
2115    
2116  %.o : %.F  ## This nullifies any default implicit rules concerning these two file types:
2117    ## %.o : %.F
2118    
2119  .F.$FS:  .F.$FS:
2120          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
# Line 2007  cat >>$MAKEFILE <<EOF Line 2170  cat >>$MAKEFILE <<EOF
2170    
2171  # ... AD ...  # ... AD ...
2172  adall: ad_taf  adall: ad_taf
2173  adtaf: ad_taf_output.f  adtaf: ad_taf_output.$FS
2174  adtamc: ad_tamc_output.f  adtamc: ad_tamc_output.$FS
2175    
2176  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ad_input_code.$FS: \$(AD_FILES) \$(HEADERFILES)
2177          @$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          @$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
2178          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
2179          -rm -f ad_config.template          -rm -f ad_config.template
2180          @make \$(F77FILES)          @make \$(F77FILES)
2181          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
2182          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.$FS
2183    
2184  ad_taf_output.f: ad_input_code.f  ad_taf_output.$FS: ad_input_code.$FS
2185          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
2186          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS
2187    
2188  adtafonly:  adtafonly:
2189          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
2190          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_taf_output.$FS
2191    
2192  ad_taf: ad_taf_output.o \$(OBJFILES)  ad_taf: ad_taf_output.o \$(OBJFILES)
2193          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
2194    
2195  ad_tamc_output.f: ad_input_code.f  ad_tamc_output.$FS: ad_input_code.$FS
2196          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS
2197          cat ad_input_code_ad.f | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.f          cat ad_input_code_ad.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ad_tamc_output.$FS
2198    
2199  ad_tamc: ad_tamc_output.o \$(OBJFILES)  ad_tamc: ad_tamc_output.o \$(OBJFILES)
2200          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
2201    
2202    adonlyfwd:
2203            patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff
2204    
2205    adtrick:
2206            patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff
2207    
2208  # ... FTL ...  # ... FTL ...
2209  ftlall: ftl_taf  ftlall: ftl_taf
2210  ftltaf: ftl_taf_output.f  ftltaf: ftl_taf_output.$FS
2211  ftltamc: ftl_tamc_output.f  ftltamc: ftl_tamc_output.$FS
2212    
2213  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES)
2214          @$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          @$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
2215          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
2216          -rm -f ftl_config.template          -rm -f ftl_config.template
2217          @make \$(F77FILES)          @make \$(F77FILES)
2218          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
2219          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS
2220    
2221  ftl_taf_output.f: ftl_input_code.f  ftl_taf_output.$FS: ftl_input_code.$FS
2222          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
2223          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS
2224    
2225  ftltafonly:  ftltafonly:
2226          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
2227          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.f          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_taf_output.$FS
2228    
2229  ftl_taf: ftl_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
2230          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
2231    
2232  ftl_tamc_output.f: ftl_input_code.f  ftl_tamc_output.$FS: ftl_input_code.$FS
2233          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS
2234          cat ftl_input_code_ftl.f | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.f          cat ftl_input_code_ftl.$FS | sed -f \$(TOOLSDIR)/adjoint_sed > ftl_tamc_output.$FS
2235    
2236  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
2237          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
2238    
2239    
2240  # ... SVD ...  # ... SVD ...
2241  svdtaf: ad_taf_output.f ftl_taf_output.f  svdtaf: ad_taf_output.$FS ftl_taf_output.$FS
2242  svdall: svd_taf          @echo "--->>> Only ran TAF to generate SVD code!    <<<---"
2243            @echo "--->>> Do make svdall afterwards to compile. <<<---"
2244    svdall: svd_touch svd_taf
2245    
2246  svd_taf: ad_taf_output.o ftl_taf_output.o \$(OBJFILES)  svd_taf: \$(OBJFILES)
2247          \$(LINK) -o mitgcmuv_svd \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o ftl_taf_output.o \$(LIBS)          \$(LINK) -o mitgcmuv_svd \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o ftl_taf_output.o \$(LIBS)
2248    
2249            @echo "--->>> Only COMPILE svd code! <<<---"
2250            @echo "--->>> Assumes you previously <<<---"
2251            @echo "--->>> did make svdtaf        <<<---"
2252    
2253    svd_touch:
2254            @echo "--->>> Only COMPILE svd code! <<<---"
2255            @echo "--->>> Assumes you previously <<<---"
2256            @echo "--->>> did make svdtaf        <<<---"
2257            touch ad_taf_output.$FS ftl_taf_output.$FS
2258            \$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS
2259            \$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS
2260            @$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
2261            cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h
2262            -rm -f ftl_config.template
2263    
2264  #=========================================  #=========================================
2265    

Legend:
Removed from v.1.93  
changed lines
  Added in v.1.128

  ViewVC Help
Powered by ViewVC 1.1.22