/[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.142 by edhill, Thu Feb 9 20:19:20 2006 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 237  build_cyrus_makedepend()  { Line 248  build_cyrus_makedepend()  {
248      fi      fi
249  }  }
250    
251    
252    build_embed_encode()
253    {
254        printf "  building the embed-encode utility...  "
255        if test ! -e "$ROOTDIR/tools/embed_encode/encode_files" ; then
256            if test ! -d "$ROOTDIR/tools/embed_encode" ; then
257                echo
258                echo "    Error: can't locate \"$ROOTDIR/tools/embed_encode\""
259                echo
260                EMBED_SRC=f
261                return 1
262            fi
263            clist="cc gcc c89 $CC"
264            for ic in $clist ; do
265                comm="$ic -o encode_files encode_files.c"
266                ( cd $ROOTDIR/tools/embed_encode && $comm ) > /dev/null 2>&1
267                RETVAL=$?
268                if test "x$RETVAL" = x0 ; then
269                    echo "OK"
270                    DEFINES="$DEFINES -DHAVE_EMBED_SRC"
271                    return 0
272                fi
273            done
274            echo
275            echo "    Error: unable to build $ROOTDIR/embed_encode/encode_files"
276            echo "      so it has been disabled"
277            echo
278            EMBED_SRC=f
279            return 1
280        fi
281        echo "OK"
282        DEFINES="$DEFINES -DHAVE_EMBED_SRC"
283    }
284    
285    
286  # Guess possible config options for this host  # Guess possible config options for this host
287  find_possible_configs()  {  find_possible_configs()  {
288    
# Line 310  EOF Line 356  EOF
356    
357      #================================================================      #================================================================
358      #  look for possible FORTRAN compilers      #  look for possible FORTRAN compilers
359      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"
360      p_FC=      p_FC=
361      for c in $tmp ; do      for c in $tmp ; do
362          rm -f ./hello.f ./hello          rm -f ./hello.f ./hello
# Line 342  EOF Line 388  EOF
388      else      else
389          echo "  The possible FORTRAN compilers found in your path are:"          echo "  The possible FORTRAN compilers found in your path are:"
390          echo "   "$p_FC          echo "   "$p_FC
391          if test "x$FC" = x ; then      fi
392              FC=`echo $p_FC | $AWK '{print $1}'`  
393              echo "  Setting FORTRAN compiler to: "$FC      #  Use the first of the compilers found in the current PATH
394          fi      #  that has a correctly-named optfile
395        if test "x$OPTFILE" = x  -a  "x$FC" = x ; then
396            for i in $p_FC ; do
397                OPTFILE=$ROOTDIR"/tools/build_options/"$PLATFORM"_"$i
398                if test -r $OPTFILE ; then
399                    echo "  Setting OPTFILE to: "$OPTFILE
400                    break
401                fi
402            done
403      fi      fi
404    
405      if test "x$OPTFILE" = x ; then      if test "x$OPTFILE" = x ; then
# Line 516  Usage: "$0" [OPTIONS] Line 570  Usage: "$0" [OPTIONS]
570            *only* works if it is supported by the OPTFILE that            *only* works if it is supported by the OPTFILE that
571            is being used.            is being used.
572    
573        -ts | --ts
574              Produce timing information per timestep
575        -papis | --papis
576              Produce summary MFlop/s with PAPI per timestep
577        -foolad | --foolad
578              Fool the AD code generator
579        -papi | --papi
580              Performance analysis with PAPI
581        -hpmt | --hpmt
582              Performance analysis with the HPM Toolkit
583    
584        -gsl | --gsl
585              Use GSL to control floating point rounding and precision
586    
587      -mpi | --mpi      -mpi | --mpi
588            Include MPI header files and link to MPI libraries            Include MPI header files and link to MPI libraries
589      -mpi=PATH | --mpi=PATH      -mpi=PATH | --mpi=PATH
590            Include MPI header files and link to MPI libraries using MPI_ROOT            Include MPI header files and link to MPI libraries using MPI_ROOT
591            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
592            from $PATH/lib and use binaries from $PATH/bin.            from \$PATH/lib and use binaries from \$PATH/bin.
593    
594        -es | --es | -embed-source | --embed-source
595              Embed a tarball containing the full source code
596              (including the Makefile, etc.) used to build the
597              executable [off by default]
598    
599      -bash NAME      -bash NAME
600            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 654  WARNING: Please contact <MITgcm-support@
654  EOF  EOF
655          return 1          return 1
656      fi      fi
657      cat > genmake_tcomp.f <<EOF      cat > genmake_tcomp.$FS <<EOF
658        subroutine tcall( string )        subroutine tcall( string )
659        character*(*) string        character*(*) string
660        call tsub( string )        call tsub( string )
661        end        end
662  EOF  EOF
663      $FC $FFLAGS $DEFINES -c genmake_tcomp.f >> genmake_warnings 2>&1      $FC $FFLAGS -c genmake_tcomp.$FS >> genmake_warnings 2>&1
664      RETVAL=$?      RETVAL=$?
665      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
666          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
# Line 653  void FC_NAMEMANGLE(cloc) ( double *curti Line 726  void FC_NAMEMANGLE(cloc) ( double *curti
726   *curtim = *curtim/1.E6;   *curtim = *curtim/1.E6;
727  }  }
728  EOF  EOF
729      make genmake_tc_1.o >> genmake_tc.log 2>&1      make genmake_tc_1.o >> genmake_warnings 2>&1
730      RET_C=$?      RET_C=$?
731      cat <<EOF > genmake_tc_2.f      cat <<EOF > genmake_tc_2.$FS
732        program hello        program hello
733        Real*8 wtime        REAL*8 wtime
734        external cloc        external cloc
735        call cloc(wtime)        call cloc(wtime)
736        print *," HELLO WORLD", wtime        print *," HELLO WORLD", wtime
737        end program hello        end
738  EOF  EOF
739      $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
740      RET_F=$?      RET_F=$?
741      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_tc.log 2>&1      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1
742      RETVAL=$?      RETVAL=$?
743      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
744          HAVE_CLOC=t          HAVE_CLOC=t
# Line 675  EOF Line 748  EOF
748  }  }
749    
750    
751    check_HAVE_SIGREG()  {
752        get_fortran_c_namemangling
753        cat <<EOF > genmake_tc_1.c
754    $FC_NAMEMANGLE
755    #include <stdlib.h>
756    #include <stdio.h>
757    #include <signal.h>
758    #include <errno.h>
759    #include <ucontext.h>
760    
761    int * ip;
762    
763    static void killhandler(
764        unsigned int sn, siginfo_t  si, struct ucontext *sc )
765    {
766        *ip = *ip + 1;
767        return;
768    }
769    
770    void FC_NAMEMANGLE(sigreg) (int * aip)
771    {
772        struct sigaction s;
773        ip = aip;
774        s.sa_flags = SA_SIGINFO;
775        s.sa_sigaction = (void *)killhandler;
776        if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) {
777            printf("Sigaction returned error = %d\n", errno);
778            exit(0);
779        }
780        return;
781    }
782    EOF
783        make genmake_tc_1.o >> genmake_warnings 2>&1
784        RET_C=$?
785        cat <<EOF > genmake_tc_2.$FS
786          program hello
787          integer anint
788          common /iv/ anint
789          external sigreg
790          call sigreg(anint)
791          end
792    EOF
793        echo >> genmake_warnings
794        echo "running: check_HAVE_SIGREG()" >> genmake_warnings
795        cat genmake_tc_2.$FS >> genmake_warnings
796        COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
797        echo $COMM >> genmake_warnings
798        $COMM >> genmake_warnings 2>&1
799        RETVAL=$?
800        if test "x$RETVAL" = x0 ; then
801            HAVE_SIGREG=t
802            DEFINES="$DEFINES -DHAVE_SIGREG"
803        fi
804        rm -f genmake_tc*
805    }
806    
807    
808    check_HAVE_SETRLSTK()  {
809        get_fortran_c_namemangling
810        cat <<EOF > genmake_tc_1.c
811    $FC_NAMEMANGLE
812    #include <sys/time.h>
813    #include <sys/resource.h>
814    #include <unistd.h>
815    void FC_NAMEMANGLE(setrlstk) ()
816    {
817        struct rlimit rls;
818        rls.rlim_cur = RLIM_INFINITY;
819        rls.rlim_max = RLIM_INFINITY;
820        setrlimit(RLIMIT_STACK, &rls);
821        return;
822    }
823    EOF
824        make genmake_tc_1.o >> genmake_warnings 2>&1
825        RET_C=$?
826        cat <<EOF > genmake_tc_2.$FS
827          program hello
828          external setrlstk
829          call setrlstk()
830          end
831    EOF
832        echo >> genmake_warnings
833        echo "running: check_HAVE_SETRLSTK()" >> genmake_warnings
834        cat genmake_tc_2.$FS >> genmake_warnings
835        COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
836        echo $COMM >> genmake_warnings
837        $COMM >> genmake_warnings 2>&1
838        RETVAL=$?
839        if test "x$RETVAL" = x0 ; then
840            HAVE_SETRLSTK=t
841            DEFINES="$DEFINES -DHAVE_SETRLSTK"
842        fi
843        rm -f genmake_tc*
844    }
845    
846    
847    check_HAVE_STAT()  {
848        get_fortran_c_namemangling
849        cat <<EOF > genmake_tc_1.c
850    $FC_NAMEMANGLE
851    #include <stdio.h>
852    #include <stdlib.h>
853    #include <unistd.h>
854    #include <sys/stat.h>
855    #include <sys/types.h>
856    void FC_NAMEMANGLE(tfsize) ( int *nbyte )
857    {
858        char name[512];
859        struct stat astat;
860    
861        name[0] = 'a'; name[1] = '\0';
862        if (! stat(name, &astat))
863            *nbyte = (int)(astat.st_size);
864        else
865            *nbyte = -1;
866    }
867    EOF
868        make genmake_tc_1.o >> genmake_tc.log 2>&1
869        RET_C=$?
870        cat <<EOF > genmake_tc_2.$FS
871          program hello
872          integer nbyte
873          call tfsize(nbyte)
874          print *," HELLO WORLD", nbyte
875          end
876    EOF
877        echo >> genmake_warnings
878        echo "running: check_HAVE_STAT()" >> genmake_warnings
879        cat genmake_tc_2.$FS >> genmake_warnings
880        COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
881        echo $COMM >> genmake_warnings
882        $COMM >> genmake_tc.log 2>&1
883        RETVAL=$?
884        if test "x$RETVAL" = x0 ; then
885            HAVE_STAT=t
886            DEFINES="$DEFINES -DHAVE_STAT"
887        fi
888        rm -f genmake_tc*
889    }
890    
891    
892  check_netcdf_libs()  {  check_netcdf_libs()  {
893      echo "" > genmake_tnc.log      if test ! "x$SKIP_NETCDF_CHECK" = x ; then
894      cat <<EOF > genmake_tnc.for          return
895        fi
896        echo >> genmake_warnings
897        echo "running: check_netcdf_libs()" >> genmake_warnings
898        cat <<EOF > genmake_tnc.F
899        program fgennc        program fgennc
900  #include "netcdf.inc"  #include "netcdf.inc"
901    EOF
902        if test ! "x$MPI" = x ; then
903            echo '#include "mpif.h"' >> genmake_tnc.F
904        fi
905        cat <<EOF >> genmake_tnc.F
906        integer iret, ncid, xid        integer iret, ncid, xid
907        iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)        iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)
908        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
# Line 689  check_netcdf_libs()  { Line 912  check_netcdf_libs()  {
912        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
913        end        end
914  EOF  EOF
915      #echo "$CPP $DEFINES $INCLUDES"      echo "===  genmake_tnc.F  ===" > genmake_tnc.log
916      $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null  \      cat genmake_tnc.F >> genmake_tnc.log
917          &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f $LIBS >> genmake_tnc.log 2>&1      echo "===  genmake_tnc.F  ===" >> genmake_tnc.log
918        RET_CPP=f
919        COMM="$CPP $DEFINES $INCLUDES genmake_tnc.F"
920        echo "$COMM" >> genmake_tnc.log
921        $COMM > genmake_tnc.$FS 2>/dev/null  &&  RET_CPP=t
922        if test "x$RET_CPP" = xf ; then
923            echo "  WARNING: CPP failed to pre-process the netcdf test." \
924                >> genmake_tnc.log
925            echo "    Please check that \$INCLUDES is properly set." \
926                >> genmake_tnc.log
927        fi
928        echo "$FC $FFLAGS $FOPTIM -c genmake_tnc.$FS  \ " >> genmake_tnc.log
929        echo "  &&  $LINK -o genmake_tnc.o $LIBS" >> genmake_tnc.log
930        $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
931            &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1
932      RET_COMPILE=$?      RET_COMPILE=$?
933      test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1      cat genmake_tnc.log >> genmake_warnings
934      RETVAL=$?  
935      if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then      #EH3  Remove test program execution for machines that either disallow
936        #EH3  execution or cannot support it (eg. cross-compilers)
937        #EH3
938        #EH3 test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1
939        #EH3 RETVAL=$?
940        #EH3 if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then
941    
942        if test "x$RET_COMPILE" = x0 ; then
943          HAVE_NETCDF=t          HAVE_NETCDF=t
944      else      else
945          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
946          $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null  \          echo "try again with added '-lnetcdf'" > genmake_tnc.log
947              &&  $FC $FFLAGS $FOPTIM -o genmake_tnc genmake_tnc.f \          echo "$CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS \ " >> genmake_tnc.log
948              $LIBS -lnetcdf >> genmake_tnc_2.log 2>&1          echo " &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS \ " >> genmake_tnc.log
949            echo " &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf" >> genmake_tnc.log
950            $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null  \
951                &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
952                &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1
953          RET_COMPILE=$?          RET_COMPILE=$?
954          test -x ./genmake_tnc  &&  ./genmake_tnc >> genmake_tnc.log 2>&1          cat genmake_tnc.log >> genmake_warnings
955          RETVAL=$?          if test "x$RET_COMPILE" = x0 ; then
         if test "x$RET_COMPILE" = x0 -a "x$RETVAL" = x0 ; then  
956              LIBS="$LIBS -lnetcdf"              LIBS="$LIBS -lnetcdf"
957              HAVE_NETCDF=t              HAVE_NETCDF=t
         else  
             cat genmake_tnc.log >> genmake_warnings  
958          fi          fi
959      fi      fi
960      rm -f genmake_tnc*      rm -f genmake_tnc*
# Line 728  PLATFORM= Line 973  PLATFORM=
973  LN=  LN=
974  S64=  S64=
975  KPP=  KPP=
976  FC=  #FC=
977  #CC=gcc  #CC=gcc
978  CPP=  #CPP=
979  LINK=  LINK=
980  DEFINES=  DEFINES=
981  PACKAGES=  PACKAGES=
982  ENABLE=  ENABLE=
983  DISABLE=  DISABLE=
984  MAKEFILE=  # MAKEFILE=
985  #MAKEDEPEND=  # MAKEDEPEND=
986  PDEPEND=  PDEPEND=
987  DUMPSTATE=t  DUMPSTATE=t
988  PDEFAULT=  PDEFAULT=
989  OPTFILE=  OPTFILE=
990  INCLUDES="-I."  INCLUDES="-I. $INCLUDES"
991  FFLAGS=  FFLAGS=
992  FOPTIM=  FOPTIM=
993  CFLAGS=  CFLAGS=
# Line 755  NOOPTFILES= Line 1000  NOOPTFILES=
1000  NOOPTFLAGS=  NOOPTFLAGS=
1001  MPI=  MPI=
1002  MPIPATH=  MPIPATH=
1003    TS=
1004    PAPIS=
1005    FOOLAD=
1006    PAPI=
1007    HPMT=
1008    GSL=
1009    HAVE_TEST_L=
1010    
1011  # DEFINES checked by test compilation  # DEFINES checked by test compilation or command-line
1012  HAVE_SYSTEM=  HAVE_SYSTEM=
1013  HAVE_FDATE=  HAVE_FDATE=
1014  FC_NAMEMANGLE=  FC_NAMEMANGLE=
1015  HAVE_CLOC=  HAVE_CLOC=
1016    HAVE_SETRLSTK=
1017    HAVE_STAT=
1018  HAVE_NETCDF=  HAVE_NETCDF=
1019  HAVE_ETIME=  HAVE_ETIME=
1020    IGNORE_TIME=
1021    
1022  MODS=  MODS=
1023  TOOLSDIR=  TOOLSDIR=
# Line 773  STANDARDDIRS="USE_THE_DEFAULT" Line 1028  STANDARDDIRS="USE_THE_DEFAULT"
1028  G2ARGS=  G2ARGS=
1029  BASH=  BASH=
1030  PWD=`pwd`  PWD=`pwd`
1031  MAKE=make  test "x$MAKE" = x  &&  MAKE=make
1032  AWK=awk  test "x$AWK" = x   &&  AWK=awk
1033  THISHOSTNAME=`hostname`  EMBED_SRC=
1034    THISHOST=`hostname`
1035  THISCWD=`pwd`  THISCWD=`pwd`
1036  THISDATE=`date`  THISDATE=`date`
1037    THISUSER=`echo $USER`
1038    THISVER=
1039  MACHINE=`uname -a`  MACHINE=`uname -a`
1040  EXECUTABLE=  EXECUTABLE=
1041  EXEHOOK=  EXEHOOK=
# Line 806  TAMC_EXTRA= Line 1064  TAMC_EXTRA=
1064    
1065  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
1066  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
1067  gm_s2="FC CPP IEEE MPI JAM DUMPSTATE STANDARDDIRS"  gm_s2="FC CPP IEEE TS PAPIS PAPI HPMT GSL MPI JAM DUMPSTATE STANDARDDIRS"
1068    
1069  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1070  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 "
1071  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
1072  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOSTNAME THISDATE MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"
1073  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
1074  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME"  gm_s7="HAVE_SYSTEM HAVE_FDATE FC_NAMEMANGLE HAVE_ETIME"
1075    
# Line 852  else Line 1110  else
1110      echo "none found"      echo "none found"
1111  fi  fi
1112    
1113  #  echo "$0::$1:$2:$3:$4:$5:$6:$7:"  #echo "$0::$1:$2:$3:$4:$5:$6:$7:"
1114  #OPTIONS=  #OPTIONS=
1115  #n=0  #n=0
1116  #for i ; do  #for i ; do
# Line 864  fi Line 1122  fi
1122  #done  #done
1123  #parse_options  #parse_options
1124  ac_prev=  ac_prev=
1125  for ac_option in $@ ; do  for ac_option in "$@" ; do
1126    
1127      G2ARGS="$G2ARGS \"$ac_option\""      G2ARGS="$G2ARGS \"$ac_option\""
1128    
# Line 986  for ac_option in $@ ; do Line 1244  for ac_option in $@ ; do
1244          -noieee | --noieee)          -noieee | --noieee)
1245              IEEE= ;;              IEEE= ;;
1246    
1247            -ts | --ts)
1248                TS=true ;;
1249            -papis | --papis)
1250                PAPIS=true ;;
1251            -foolad | --foolad)
1252                FOOLAD=true ;;
1253            -papi | --papi)
1254                PAPI=true ;;
1255            -hpmt | --hpmt)
1256                HPMT=true ;;
1257    
1258            -gsl | --gsl)
1259                GSL=true ;;
1260    
1261          -mpi | --mpi)          -mpi | --mpi)
1262              MPI=true ;;              MPI=true ;;
1263          -mpi=* | --mpi=*)          -mpi=* | --mpi=*)
# Line 1009  for ac_option in $@ ; do Line 1281  for ac_option in $@ ; do
1281              ac_prev=TAMC_EXTRA ;;              ac_prev=TAMC_EXTRA ;;
1282          -tamc_extra=* | --tamc_extra=*)          -tamc_extra=* | --tamc_extra=*)
1283              TAMC_EXTRA=$ac_optarg ;;              TAMC_EXTRA=$ac_optarg ;;
1284            
1285            -ignoretime | -ignore_time | --ignoretime | --ignore_time)
1286                IGNORE_TIME="-DIGNORE_TIME" ;;
1287    
1288            -es | --es | -embed-source | --embed-source)
1289                EMBED_SRC=t ;;
1290    
1291          -*)          -*)
1292              echo "Error: unrecognized option: "$ac_option              echo "Error: unrecognized option: "$ac_option
# Line 1024  for ac_option in $@ ; do Line 1302  for ac_option in $@ ; do
1302            
1303  done  done
1304    
1305    
1306  if test -f ./.genmakerc ; then  if test -f ./.genmakerc ; then
1307      echo      echo
1308      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 1315  if test -f ./.genmakerc ; then
1315      echo      echo
1316  fi  fi
1317    
1318    #  Find the MITgcm ${ROOTDIR}
1319  if test "x${ROOTDIR}" = x ; then  if test "x${ROOTDIR}" = x ; then
1320      tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'`      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`
1321      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
1322          ROOTDIR=".."          ROOTDIR=".."
1323      else      else
# Line 1062  if test ! -d ${ROOTDIR} ; then Line 1342  if test ! -d ${ROOTDIR} ; then
1342      exit 1      exit 1
1343  fi  fi
1344    
1345    #  Find the MITgcm ${THISVER}
1346    if test -f "${ROOTDIR}/doc/tag-index" ; then
1347        THISVER=`grep '^checkpoint' ${ROOTDIR}/doc/tag-index | head -1`
1348    fi
1349    
1350    if test "x$MAKEFILE" = x ; then
1351        MAKEFILE="Makefile"
1352    fi
1353    
1354  echo "  getting OPTFILE information:  "  echo "  getting OPTFILE information:  "
1355  if test "x${OPTFILE}" = x ; then  if test "x${OPTFILE}" = x ; then
1356      if test "x$MITGCM_OF" = x ; then      if test "x$MITGCM_OF" = x ; then
# Line 1091  if test "x$OPTFILE" != xNONE ; then Line 1380  if test "x$OPTFILE" != xNONE ; then
1380      fi      fi
1381  fi  fi
1382    
 #  Check for broken systems that cannot correctly distinguish *.F and *.f files  
 # check_for_broken_Ff  
   
1383  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:  "
1384  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1385      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 1407  if test "x${AD_OPTFILE}" != xNONE ; then
1407      fi      fi
1408  fi  fi
1409    
1410    #====================================================================
1411    #  Set default values if not set by the optfile
1412    #
1413  #  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,
1414  #  either set defaults or complain and abort!  #  either set defaults or complain and abort!
1415  if test ! "x$BASH" = x ; then  if test ! "x$BASH" = x ; then
# Line 1197  Error: The command "ln -s" failed -- ple Line 1486  Error: The command "ln -s" failed -- ple
1486  EOF  EOF
1487      exit 1      exit 1
1488  fi  fi
1489    test -L genmake_tlink > /dev/null 2>&1
1490    RETVAL=$?
1491    if test "x$RETVAL" = x0 ; then
1492        HAVE_TEST_L=t
1493    fi
1494  rm -f genmake_test_ln genmake_tlink  rm -f genmake_test_ln genmake_tlink
1495    
1496  #  Check for broken *.F/*.f handling and fix if possible  #  Check for broken *.F/*.f handling and fix if possible
# Line 1207  if test ! "x$MPI" = x ; then Line 1501  if test ! "x$MPI" = x ; then
1501        DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI"        DEFINES="$DEFINES -DALLOW_USE_MPI -DALWAYS_USE_MPI"
1502  fi  fi
1503    
1504    if test ! "x$TS" = x ; then
1505          echo "  Turning on timing per timestep"
1506          if test ! "x$FOOLAD" = x ; then
1507                DEFINES="$DEFINES -DTIME_PER_TIMESTEP_SFP"
1508          else
1509                DEFINES="$DEFINES -DTIME_PER_TIMESTEP"
1510          fi
1511    fi
1512    if test ! "x$PAPIS" = x ; then
1513          echo "  Turning on PAPI flop summary per timestep"
1514          echo "  Please make sure PAPIINC, PAPILIB are defined"
1515          if test ! "x$FOOLAD" = x ; then
1516                DEFINES="$DEFINES -DUSE_PAPI_FLOPS_SFP"
1517          else
1518                DEFINES="$DEFINES -DUSE_PAPI_FLOPS"
1519          fi
1520          INCLUDES="$INCLUDES $PAPIINC"
1521          LIBS="$LIBS $PAPILIB"
1522    fi
1523    if test ! "x$PAPI" = x ; then
1524          if test ! "x$PAPIS" = x ; then
1525              echo "  PAPI performance analysis and flop summary per timestep cannot co-exist!"
1526              echo "  Sticking with PAPI flop summary per timestep!"
1527          else
1528              echo "  Turning on performance analysis with PAPI"
1529              echo "  Please make sure PAPIINC, PAPILIB are defined"
1530              DEFINES="$DEFINES -DUSE_PAPI"
1531              INCLUDES="$INCLUDES $PAPIINC"
1532              LIBS="$LIBS $PAPILIB"
1533          fi
1534    fi
1535    if test ! "x$HPMT" = x ; then
1536          if test ! "x$PAPI" = x ; then
1537              echo "  PAPI and the HPM Toolkit cannot co-exist!"
1538              echo "  Sticking with PAPI!"
1539          else
1540              echo "  Turning on performance analysis with the HPM Toolkit"
1541              echo "  Please make sure HPMTINC, HPMTLIB are defined"
1542              DEFINES="$DEFINES -DUSE_LIBHPM"
1543              INCLUDES="$INCLUDES $HPMTINC"
1544              LIBS="$LIBS $HPMTLIB"
1545          fi
1546    fi
1547    if test ! "x$GSL" = x ; then
1548          echo "  Turning on use of GSL to control floating point calculations"
1549          echo "  Please make sure GSLINC, GSLLIB are defined"
1550          DEFINES="$DEFINES -DUSE_GSL_IEEE"
1551          INCLUDES="$INCLUDES $GSLINC"
1552          LIBS="$LIBS $GSLLIB"
1553    fi
1554    
1555  printf "\n===  Checking system libraries  ===\n"  printf "\n===  Checking system libraries  ===\n"
1556  printf "  Do we have the system() command using $FC...  "  printf "  Do we have the system() command using $FC...  "
1557  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1558        program hello        program hello
1559        call system('echo hi')        call system('echo hi')
1560        end        end
1561  EOF  EOF
1562  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1563  RETVAL=$?  RETVAL=$?
1564  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1565      HAVE_SYSTEM=t      HAVE_SYSTEM=t
# Line 1227  fi Line 1572  fi
1572  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1573    
1574  printf "  Do we have the fdate() command using $FC...  "  printf "  Do we have the fdate() command using $FC...  "
1575  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1576        program hello        program hello
1577        CHARACTER(128) string        CHARACTER*(128) string
1578        string = ' '        string = ' '
1579        call fdate( string )        call fdate( string )
1580        print *, string        print *, string
1581        end        end
1582  EOF  EOF
1583  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1584  RETVAL=$?  RETVAL=$?
1585  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1586      HAVE_FDATE=t      HAVE_FDATE=t
# Line 1248  fi Line 1593  fi
1593  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1594    
1595  printf "  Do we have the etime() command using $FC...  "  printf "  Do we have the etime() command using $FC...  "
1596  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1597        program hello        program hello
1598        REAL*4 ACTUAL, TARRAY(2)        REAL*4 ACTUAL, TARRAY(2)
1599        EXTERNAL ETIME        EXTERNAL ETIME
# Line 1257  cat > genmake_tcomp.f <<EOF Line 1602  cat > genmake_tcomp.f <<EOF
1602        print *, tarray        print *, tarray
1603        end        end
1604  EOF  EOF
1605  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1606  RETVAL=$?  RETVAL=$?
1607  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1608      HAVE_ETIME=t      HAVE_ETIME=t
# Line 1275  if test "x$HAVE_CLOC" != x ; then Line 1620  if test "x$HAVE_CLOC" != x ; then
1620      echo "yes"      echo "yes"
1621  else  else
1622      echo "no"      echo "no"
1623        if test "x$EMBED_SRC" = xt ; then
1624            echo "    WARNING: you requested file embedding but it has"
1625            echo "      been disabled since C code cannot be called"
1626            EMBED_SRC=
1627        fi
1628    fi
1629    rm -f genmake_t*
1630    
1631    printf "  Can we unlimit the stack size using $FC...  "
1632    check_HAVE_SETRLSTK
1633    if test "x$HAVE_SETRLSTK" != x ; then
1634        echo "yes"
1635    else
1636        echo "no"
1637    fi
1638    rm -f genmake_t*
1639    
1640    printf "  Can we register a signal handler using $FC...  "
1641    check_HAVE_SIGREG
1642    if test "x$HAVE_SIGREG" != x ; then
1643        echo "yes"
1644    else
1645        echo "no"
1646    fi
1647    rm -f genmake_t*
1648    
1649    printf "  Can we use stat() through C calls...  "
1650    check_HAVE_STAT
1651    if test "x$HAVE_STAT" != x ; then
1652        echo "yes"
1653    else
1654        echo "no"
1655  fi  fi
1656  rm -f genmake_t*  rm -f genmake_t*
1657    
# Line 1285  if test "x$HAVE_NETCDF" != x ; then Line 1662  if test "x$HAVE_NETCDF" != x ; then
1662  else  else
1663      echo "no"      echo "no"
1664  fi  fi
1665    DEFINES="$DEFINES $IGNORE_TIME"
1666    
1667    if test "x$EMBED_SRC" = xt ; then
1668        build_embed_encode
1669    fi
1670    if test "x$EMBED_SRC" = xt ; then
1671        ENABLE="$ENABLE embed_files"
1672    fi
1673    
1674    
1675  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
# Line 1302  for d in $MODS ; do Line 1687  for d in $MODS ; do
1687  done  done
1688  echo  echo
1689    
 if test "x$MAKEFILE" = x ; then  
     MAKEFILE="Makefile"  
 fi  
1690  if test "x${PLATFORM}" = x ; then  if test "x${PLATFORM}" = x ; then
1691      PLATFORM=$p_PLATFORM      PLATFORM=$p_PLATFORM
1692  fi  fi
1693    
1694  if test "x${EXEDIR}" = x ; then  if test "x${EXEDIR}" = x ; then
1695      tmp=`echo $PWD | sed -e 's/\// /g' | awk '{print $NR}'`      tmp=`echo $PWD | sed -e 's/\// /g' | $AWK '{print $NR}'`
1696      if test "x$tmp" = "xbin" -a -d ../exe -a $ROOTDIR = .. ; then      if test "x$tmp" = "xbin" -a -d ../exe -a $ROOTDIR = .. ; then
1697          EXEDIR=../exe          EXEDIR=../exe
1698      else      else
# Line 1330  if test ! -d ${TOOLSDIR} ; then Line 1712  if test ! -d ${TOOLSDIR} ; then
1712      exit 1      exit 1
1713  fi  fi
1714  if test "x$S64" = x ; then  if test "x$S64" = x ; then
1715      S64='$(TOOLSDIR)/set64bitConst.sh'      echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.sh > /dev/null 2>&1
1716        RETVAL=$?
1717        if test "x${RETVAL}" = x0 ; then
1718            S64='$(TOOLSDIR)/set64bitConst.sh'
1719        else
1720            echo "3.0 _d 3" | ${TOOLSDIR}/set64bitConst.csh > /dev/null 2>&1
1721            RETVAL=$?
1722            if test "x${RETVAL}" = x0 ; then
1723                S64='$(TOOLSDIR)/set64bitConst.csh'
1724            else
1725                cat <<EOF
1726    
1727    ERROR: neither of the two default scripts:
1728    
1729        ${TOOLSDIR}/set64bitConst.sh
1730        ${TOOLSDIR}/set64bitConst.csh
1731    
1732      are working so please check paths or specify (with \$S64) a
1733      working version of this script.
1734    
1735    EOF
1736                exit 1
1737            fi
1738        fi
1739  fi  fi
1740  THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'`  THIS_SCRIPT=`echo ${0} | sed 's:'$TOOLSDIR':\$(TOOLSDIR):'`
1741    
# Line 1475  done Line 1880  done
1880  rm -f ./.tmp_pack  rm -f ./.tmp_pack
1881  echo "    packages are:  $PACKAGES"  echo "    packages are:  $PACKAGES"
1882    
1883    #  Check availability of NetCDF and then either build the MNC template
1884    #  files or delete mnc from the list of available packages.
1885    echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1
1886    RETVAL=$?
1887    if test "x$RETVAL" = x0 ; then
1888        if test "x$HAVE_NETCDF" != xt ; then
1889            cat <<EOF
1890    
1891    *********************************************************************
1892    WARNING: the "mnc" package was enabled but tests failed to compile
1893      NetCDF applications.  Please check that:
1894    
1895      1) NetCDF is correctly installed for this compiler and
1896      2) the LIBS variable (within the "optfile") specifies the correct
1897           NetCDF library to link against.
1898    
1899      Due to this failure, the "mnc" package is now DISABLED.
1900    *********************************************************************
1901    
1902    EOF
1903            PACKAGES=`echo $PACKAGES | sed -e 's/mnc//g'`
1904            DISABLE="$DISABLE mnc"
1905        else
1906            ( cd $ROOTDIR"/pkg/mnc" && $MAKE testclean && $MAKE templates ) > make_mnc.errors 2>&1
1907            RETVAL=$?
1908            if test "x${RETVAL}" = x0 ; then
1909                rm -f make_mnc.errors
1910            else
1911                echo "Error: problem encountered while building source files in pkg/mnc:"
1912                cat make_mnc.errors 1>&2
1913                exit 1
1914            fi
1915        fi
1916    fi
1917    
1918  echo "  applying package dependency rules"  echo "  applying package dependency rules"
1919  ck=  ck=
1920  while test "x$ck" != xtt ; do  while test "x$ck" != xtt ; do
# Line 1559  for i in $PACKAGES ; do Line 1999  for i in $PACKAGES ; do
1999      fi      fi
2000  done  done
2001    
 #  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  
   
2002  # Create a list of #define and #undef to enable/disable packages  # Create a list of #define and #undef to enable/disable packages
2003  PACKAGES_DOT_H=PACKAGES_CONFIG.h  PACKAGES_DOT_H=PACKAGES_CONFIG.h
2004  #  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 2018  for n in $names ; do
2018              fi              fi
2019          done          done
2020          if test "x$has_pack" = xf ; then          if test "x$has_pack" = xf ; then
2021              undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'`              undef=`echo "ALLOW_$n" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
2022              DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef"              DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef"
2023          fi          fi
2024      fi      fi
2025  done  done
2026  ENABLED_PACKAGES=  ENABLED_PACKAGES=
2027  for i in $PACKAGES ; do  for i in $PACKAGES ; do
2028      def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'`      def=`echo "ALLOW_$i" | sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
2029      ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def"      ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def"
2030  #eh3 DEFINES="$DEFINES -D$def"  #eh3 DEFINES="$DEFINES -D$def"
2031    
# Line 1696  for i in $SOURCEDIRS ; do Line 2109  for i in $SOURCEDIRS ; do
2109          cat $i/$j >> ad_files          cat $i/$j >> ad_files
2110      done      done
2111  done  done
2112    if test ! "x"$FS = "x.f" ; then
2113        cat ad_files | sed -e "s/\.f/.$FS/g" > ad_files_f
2114        mv -f ad_files_f ad_files
2115    fi
2116    
2117  echo  echo
2118  echo "===  Creating the Makefile  ==="  echo "===  Creating the Makefile  ==="
# Line 1707  for i in $INCLUDEDIRS ; do Line 2123  for i in $INCLUDEDIRS ; do
2123      fi      fi
2124  done  done
2125    
2126    if test ! "x$DIVA" = x ; then
2127        echo "  Creating the pseudo-MPI include directory"
2128        INCLUDES="-I./mpi_headers $INCLUDES"
2129        rm -rf ./mpi_headers
2130        mkdir -p ./mpi_headers
2131    
2132        if test "x$MPIINCLUDEDIR" = x ; then
2133            if test "x$MPIHOME" = x ; then
2134                MPIHOME='/usr'
2135            fi
2136            MPIINCLUDEDIR='$MPIHOME/include'
2137        fi
2138        
2139        if test -r $MPIINCLUDEDIR/mpif.h ; then
2140            for i in $MPI_HEADER_FILES; do
2141                cp -p $MPIINCLUDEDIR/$i ./mpi_headers
2142            done
2143    
2144            perl -i -pe 's/MPI_DISPLACEMENT_CURRENT=-1_8/MPI_DISPLACEMENT_CURRENT=-1/g' mpi_headers/mpif.h
2145        else
2146            echo " We cannot create a copy of mpif.h!"
2147            exit -1
2148        fi
2149    fi
2150    
2151  echo "  Determining the list of source and include files"  echo "  Determining the list of source and include files"
2152  rm -rf .links.tmp  rm -rf .links.tmp
2153  mkdir .links.tmp  mkdir .links.tmp
2154    touch .links.tmp/foo
2155    if test ! -r ".links.tmp/foo" ; then
2156        echo
2157        echo "ERROR : something is wrong with your directory permissions or"
2158        echo "   your user file-creation mask (\"umask\") since creating a"
2159        echo "   sub-dir, touch-ing a file within it, and then reading it is"
2160        echo "   not working.  Please try setting your umask to something"
2161        echo "   sane such as:"
2162        echo
2163        echo "      umask 0002"
2164        echo
2165        echo "   and please verify that you have the proper permissions for"
2166        echo "   creating sub-directories and then reading files created"
2167        echo "   within them."
2168        echo
2169        exit 1
2170    fi
2171    rm -f .links.tmp/foo
2172  echo "# This section creates symbolic links" > srclinks.tmp  echo "# This section creates symbolic links" > srclinks.tmp
2173  echo "" >> srclinks.tmp  echo "" >> srclinks.tmp
2174  printf 'SRCFILES = '    > srclist.inc  printf 'SRCFILES = '    > srclist.inc
# Line 1725  for d in $alldirs ; do Line 2184  for d in $alldirs ; do
2184      for sf in $sfiles ; do      for sf in $sfiles ; do
2185          if test ! -r ".links.tmp/$sf" ; then          if test ! -r ".links.tmp/$sf" ; then
2186              if test -f "$d/$sf" ; then              if test -f "$d/$sf" ; then
2187                    ignore_f=f
2188                  case $d/$sf in                  case $d/$sf in
2189                    ./$PACKAGES_DOT_H)                    ./$PACKAGES_DOT_H)
2190                            ignore_f=t
2191                          ;;                          ;;
2192                    ./AD_CONFIG.h)                    ./AD_CONFIG.h)
2193                            ignore_f=t
2194                          ;;                          ;;
2195                    ./FC_NAMEMANGLE.h)                    ./FC_NAMEMANGLE.h)
2196                            ignore_f=t
2197                          ;;                          ;;
2198                    *)                    ./BUILD_INFO.h)
2199                          touch .links.tmp/$sf                          ignore_f=t
                         deplist="$deplist $sf"  
                         ;;  
                 esac  
                 extn=`echo $sf | $AWK -F '.' '{print $NF}'`  
                 case $extn in  
                     F)  
                         echo    " \\"  >> srclist.inc  
                         printf " $sf" >> srclist.inc  
                         ;;  
                     F90)  
                         echo    " \\"  >> f90srclist.inc  
                         printf " $sf" >> f90srclist.inc  
2200                          ;;                          ;;
2201                      c)                    ./EMBEDDED_FILES.h)
2202                          echo    " \\"  >> csrclist.inc                          ignore_f=t
                         printf " $sf" >> csrclist.inc  
2203                          ;;                          ;;
2204                      h)                    *)
2205                          echo    " \\"  >> hlist.inc                          #  For the local directory *ONLY*,
2206                          printf " $sf" >> hlist.inc                          #  ignore all soft-links
2207                          ;;                          if test "x$HAVE_TEST_L" = xt -a "x$d" = x. -a -L $sf ; then
2208                      flow)                              ignore_f=t
2209                          echo    " \\"  >> ad_flow_files.inc                          else
2210                          printf " $sf" >> ad_flow_files.inc                              touch .links.tmp/$sf
2211                                deplist="$deplist $sf"
2212                            fi
2213                          ;;                          ;;
2214                  esac                  esac
2215                    if test "x$ignore_f" = xf ; then
2216                        extn=`echo $sf | $AWK -F. '{print $NF}'`
2217                        case $extn in
2218                            F)
2219                                echo    " \\"  >> srclist.inc
2220                                printf " $sf" >> srclist.inc
2221                                ;;
2222                            F90)
2223                                echo    " \\"  >> f90srclist.inc
2224                                printf " $sf" >> f90srclist.inc
2225                                ;;
2226                            c)
2227                                echo    " \\"  >> csrclist.inc
2228                                printf " $sf" >> csrclist.inc
2229                                ;;
2230                            h)
2231                                echo    " \\"  >> hlist.inc
2232                                printf " $sf" >> hlist.inc
2233                                ;;
2234                            flow)
2235                                echo    " \\"  >> ad_flow_files.inc
2236                                printf " $sf" >> ad_flow_files.inc
2237                                ;;
2238                        esac
2239                    fi
2240              fi              fi
2241          fi          fi
2242      done      done
# Line 1788  echo "#    $THISDATE" >> $MAKEFILE Line 2265  echo "#    $THISDATE" >> $MAKEFILE
2265  echo "# by the command:" >> $MAKEFILE  echo "# by the command:" >> $MAKEFILE
2266  echo "#    $0 $G2ARGS" >> $MAKEFILE  echo "#    $0 $G2ARGS" >> $MAKEFILE
2267  echo "# executed by:" >> $MAKEFILE  echo "# executed by:" >> $MAKEFILE
2268  echo "#    $USER@${THISHOSTNAME}:${THISCWD}" >> $MAKEFILE  echo "#    ${THISUSER}@${THISHOST}:${THISCWD}" >> $MAKEFILE
2269    
2270  EXE_AD=$EXECUTABLE"_ad"  EXE_AD=$EXECUTABLE"_ad"
2271  EXE_FTL=$EXECUTABLE"_ftl"  EXE_FTL=$EXECUTABLE"_ftl"
# Line 1834  ENABLED_PACKAGES = ${ENABLED_PACKAGES} Line 2311  ENABLED_PACKAGES = ${ENABLED_PACKAGES}
2311  DISABLED_PACKAGES = ${DISABLED_PACKAGES}  DISABLED_PACKAGES = ${DISABLED_PACKAGES}
2312    
2313  # These files are created by Makefile  # These files are created by Makefile
2314  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
   
2315  EOF  EOF
2316    
2317  #  Note: figure out some way to add Hyades JAM libraries here  if test "x$EMBED_SRC" = xt ; then
2318        echo "EMBEDDED_FILES = EMBEDDED_FILES.h" >>$MAKEFILE
2319    else
2320        echo "EMBEDDED_FILES = " >>$MAKEFILE
2321    fi
2322    
2323    #  Note: figure out some way to add Hyades JAM libraries here
2324  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
2325  # Unix ln (link)  # Unix ln (link)
2326  LN = ${LN}  LN = ${LN}
# Line 1850  MAKEDEPEND = ${MAKEDEPEND} Line 2331  MAKEDEPEND = ${MAKEDEPEND}
2331  # Special preprocessor (KAP on DECs, FPP on Crays)  # Special preprocessor (KAP on DECs, FPP on Crays)
2332  KPP = ${KPP}  KPP = ${KPP}
2333  # Fortran compiler  # Fortran compiler
2334  FC = ${FC} in  FC = ${FC}
2335  # Fortran compiler  # Fortran compiler
2336  F90C = ${F90C}  F90C = ${F90C}
2337  # C compiler  # C compiler
# Line 1877  CFLAGS = ${CFLAGS} Line 2358  CFLAGS = ${CFLAGS}
2358  NOOPTFILES = ${NOOPTFILES}  NOOPTFILES = ${NOOPTFILES}
2359  NOOPTFLAGS = ${NOOPTFLAGS}  NOOPTFLAGS = ${NOOPTFLAGS}
2360  # Flags and libraries needed for linking  # Flags and libraries needed for linking
2361  LIBS = ${LIBS} \$(XLIBS)  LIBS = ${LIBS}
2362  # Name of the Mekfile  # Name of the Mekfile
2363  MAKEFILE=${MAKEFILE}  MAKEFILE=${MAKEFILE}
2364    
# Line 1890  cat hlist.inc         >> $MAKEFILE Line 2371  cat hlist.inc         >> $MAKEFILE
2371  cat ad_flow_files.inc >> $MAKEFILE  cat ad_flow_files.inc >> $MAKEFILE
2372  echo >> $MAKEFILE  echo >> $MAKEFILE
2373  echo 'F77FILES =  $(SRCFILES:.F=.'$FS')'      >> $MAKEFILE  echo 'F77FILES =  $(SRCFILES:.F=.'$FS')'      >> $MAKEFILE
2374  echo 'F90FILES =  $(F90SRCFILES:.F=.'$FS90')' >> $MAKEFILE  echo 'F90FILES =  $(F90SRCFILES:.F90=.'$FS90')' >> $MAKEFILE
2375  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE  echo 'OBJFILES =  $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o) $(F90SRCFILES:.F90=.o)' >> $MAKEFILE
2376  echo >> $MAKEFILE  echo >> $MAKEFILE
2377  echo '.SUFFIXES:' >> $MAKEFILE  echo '.SUFFIXES:' >> $MAKEFILE
# Line 1901  rm -f ad_flow_files.inc Line 2382  rm -f ad_flow_files.inc
2382  cat >>$MAKEFILE <<EOF  cat >>$MAKEFILE <<EOF
2383    
2384  all: \$(EXECUTABLE)  all: \$(EXECUTABLE)
2385  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES)  \$(EXECUTABLE): \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(OBJFILES) \$(EMBEDDED_FILES)
2386          @echo Creating \$@ ...          @echo Creating \$@ ...
2387          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
2388  depend:  depend:
# Line 1910  depend: Line 2391  depend:
2391          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)          \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE)
2392          -rm -f makedepend.out          -rm -f makedepend.out
2393    
2394    lib: libmitgcmuv.a
2395    
2396    libmitgcmuv.a: \$(OBJFILES)
2397            ar rcv libmitgcmuv.a \$(OBJFILES)
2398    
2399  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(SPECIAL_FILES)
2400    
2401  small_f: \$(F77FILES) \$(F90FILES)  small_f: \$(F77FILES) \$(F90FILES)
# Line 1938  makefile: Line 2424  makefile:
2424  cleanlinks:  cleanlinks:
2425          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
2426    
2427  # Special targets ($SPECIAL_FILES) which are create by make  # Special targets (SPECIAL_FILES) which are create by make
2428  ${PACKAGES_DOT_H}:  ${PACKAGES_DOT_H}:
2429          @echo Creating \$@ ...          @echo Creating \$@ ...
2430          @$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 2435  FC_NAMEMANGLE.h:
2435          @echo Creating \$@ ...          @echo Creating \$@ ...
2436          echo "$FC_NAMEMANGLE" > \$@          echo "$FC_NAMEMANGLE" > \$@
2437    
2438    BUILD_INFO.h:
2439            @echo Creating \$@ ...
2440    EOF
2441    
2442    test ! "x$THISVER" = x  && echo "       -echo \"#define THISVER '$THISVER'\" > \$@"   >> $MAKEFILE
2443    test ! "x$THISUSER" = x && echo "       -echo \"#define THISUSER '$THISUSER'\" >> \$@" >> $MAKEFILE
2444    test ! "x$THISDATE" = x && echo "       -echo \"#define THISDATE '$THISDATE'\" >> \$@" >> $MAKEFILE
2445    test ! "x$THISHOST" = x && echo "       -echo \"#define THISHOST '$THISHOST'\" >> \$@" >> $MAKEFILE
2446    
2447    if test "x$EMBED_SRC" = xt ; then
2448        cat >>$MAKEFILE <<EOF
2449    
2450    decode_files.o : EMBEDDED_FILES.h
2451    
2452    ##  \$(F77FILES)
2453    all_fF.tar.gz : \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile
2454            @echo Creating \$@ ...
2455            -tar -hcf all_fF.tar \$(SPECIAL_FILES) \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES) \$(F90SRCFILES) \$(F77FILES) Makefile
2456            -rm -f all_fF.tar.gz
2457            -gzip all_fF.tar
2458    
2459    EMBEDDED_FILES.h : all_fF.tar.gz
2460            @echo Creating \$@ ...
2461            -\${ROOTDIR}/tools/embed_encode/encode_files EMBEDDED_FILES.h all_fF.tar.gz
2462    
2463    EOF
2464    fi
2465    
2466    cat >>$MAKEFILE <<EOF
2467    
2468  # The normal chain of rules is (  .F - .$FS - .o  )  # The normal chain of rules is (  .F - .$FS - .o  )
2469    
2470  %.o : %.F  ## This nullifies any default implicit rules concerning these two file types:
2471    ## %.o : %.F
2472    
2473  .F.$FS:  .F.$FS:
2474          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
# Line 1962  FC_NAMEMANGLE.h: Line 2479  FC_NAMEMANGLE.h:
2479  .$FS90.o:  .$FS90.o:
2480          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<
2481  .c.o:  .c.o:
2482          \$(CC) \$(CFLAGS) -c \$<          \$(CC) \$(CFLAGS) \$(DEFINES) \$(INCLUDES) -c \$<
2483    
2484  # Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain  # Special exceptions that use the ( .F - .p - .$FS - .o ) rule-chain
2485  .F.p:  .F.p:
# Line 2007  cat >>$MAKEFILE <<EOF Line 2524  cat >>$MAKEFILE <<EOF
2524    
2525  # ... AD ...  # ... AD ...
2526  adall: ad_taf  adall: ad_taf
2527  adtaf: ad_taf_output.f  adtaf: ad_taf_output.$FS
2528  adtamc: ad_tamc_output.f  adtamc: ad_tamc_output.$FS
2529    
2530  ad_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ad_input_code.$FS: \$(AD_FILES) \$(HEADERFILES)
2531          @$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
2532          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
2533          -rm -f ad_config.template          -rm -f ad_config.template
2534          @make \$(F77FILES)          @make \$(F77FILES)
2535          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
2536          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.$FS
2537    
2538  ad_taf_output.f: ad_input_code.f  ad_taf_output.$FS: ad_input_code.$FS
2539          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
2540          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
2541    
2542  adtafonly:  adtafonly:
2543          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.$FS
2544          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
2545    
2546  ad_taf: ad_taf_output.o \$(OBJFILES)  ad_taf: ad_taf_output.o \$(OBJFILES)
2547          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
2548    
2549  ad_tamc_output.f: ad_input_code.f  ad_tamc_output.$FS: ad_input_code.$FS
2550          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f          \$(TAMC) \$(AD_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.$FS
2551          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
2552    
2553  ad_tamc: ad_tamc_output.o \$(OBJFILES)  ad_tamc: ad_tamc_output.o \$(OBJFILES)
2554          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_tamc_output.o \$(LIBS)
2555    
2556    adonlyfwd:
2557            patch < \$(TOOLSDIR)/ad_taf_output.f.onlyfwd.diff
2558    
2559    adtrick:
2560            patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff
2561    
2562  # ... FTL ...  # ... FTL ...
2563  ftlall: ftl_taf  ftlall: ftl_taf
2564  ftltaf: ftl_taf_output.f  ftltaf: ftl_taf_output.$FS
2565  ftltamc: ftl_tamc_output.f  ftltamc: ftl_tamc_output.$FS
2566    
2567  ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES)  ftl_input_code.$FS: \$(AD_FILES) \$(HEADERFILES)
2568          @$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
2569          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
2570          -rm -f ftl_config.template          -rm -f ftl_config.template
2571          @make \$(F77FILES)          @make \$(F77FILES)
2572          @make \$(AD_FLOW_FILES)          @make \$(AD_FLOW_FILES)
2573          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f          cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS
2574    
2575  ftl_taf_output.f: ftl_input_code.f  ftl_taf_output.$FS: ftl_input_code.$FS
2576          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
2577          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
2578    
2579  ftltafonly:  ftltafonly:
2580          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.$FS
2581          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
2582    
2583  ftl_taf: ftl_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
2584          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
2585    
2586  ftl_tamc_output.f: ftl_input_code.f  ftl_tamc_output.$FS: ftl_input_code.$FS
2587          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f          \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.$FS
2588          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
2589    
2590  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
2591          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS)
2592    
2593    
2594  # ... SVD ...  # ... SVD ...
2595  svdtaf: ad_taf_output.f ftl_taf_output.f  svdtaf: ad_taf_output.$FS ftl_taf_output.$FS
2596  svdall: svd_taf          @echo "--->>> Only ran TAF to generate SVD code!    <<<---"
2597            @echo "--->>> Do make svdall afterwards to compile. <<<---"
2598    svdall: svd_touch svd_taf
2599    
2600  svd_taf: ad_taf_output.o ftl_taf_output.o \$(OBJFILES)  svd_taf: \$(OBJFILES)
2601          \$(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)
2602    
2603            @echo "--->>> Only COMPILE svd code! <<<---"
2604            @echo "--->>> Assumes you previously <<<---"
2605            @echo "--->>> did make svdtaf        <<<---"
2606    
2607    svd_touch:
2608            @echo "--->>> Only COMPILE svd code! <<<---"
2609            @echo "--->>> Assumes you previously <<<---"
2610            @echo "--->>> did make svdtaf        <<<---"
2611            touch ad_taf_output.$FS ftl_taf_output.$FS
2612            \$(FC) \$(FFLAGS) \$(FOPTIM) -c ad_taf_output.$FS
2613            \$(FC) \$(FFLAGS) \$(FOPTIM) -c ftl_taf_output.$FS
2614            @$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
2615            cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h
2616            -rm -f ftl_config.template
2617    
2618  #=========================================  #=========================================
2619    

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

  ViewVC Help
Powered by ViewVC 1.1.22