/[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.32 by edhill, Wed Nov 12 22:05:47 2003 UTC revision 1.41 by edhill, Thu Nov 20 00:25:43 2003 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/sh
2  #  #
3  # $Header$  # $Header$
4  #  #
# Line 76  find_possible_configs()  { Line 76  find_possible_configs()  {
76      PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`      PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'`
77      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`      OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")`
78      echo "  The platform appears to be:  $PLATFORM"      echo "  The platform appears to be:  $PLATFORM"
 #     if test "x$OFLIST" = x ; then  
 #       echo "  No pre-defined options files were found matching this platform"  
 #       echo "  but examples for other platforms can be found in:"  
 #       echo "    $ROOTDIR/tools/build_options"  
 #     else  
 #       echo "  Options files (located in $ROOTDIR/tools/build_options) that"  
 #       echo "  may work with this machine are:"  
 #       for i in $OFLIST ; do  
 #           echo "    $i"  
 #       done  
 #     fi  
79            
80      echo "test" > test      echo "test" > test
81      ln -s ./test link      ln -s ./test link
# Line 104  find_possible_configs()  { Line 93  find_possible_configs()  {
93          CPP="cpp -traditional -P"          CPP="cpp -traditional -P"
94      fi      fi
95    
96        # makedepend is not always available
97        if test "x${MAKEDEPEND}" = x ; then
98          which makedepend >& /dev/null
99          RETVAL=$?
100          if test "x${RETVAL}" = x1 ; then
101             echo "    makedepend was not found. Using xmakedpend instead."
102             MAKEDEPEND='$(TOOLSDIR)/xmakedepend'
103          fi
104        fi
105    
106      # look for possible fortran compilers      # look for possible fortran compilers
107      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"
108      p_FC=      p_FC=
# Line 206  get_pdepend_list()  { Line 205  get_pdepend_list()  {
205      cat $1 | sed -e 's/#.*$//g' \      cat $1 | sed -e 's/#.*$//g' \
206          | $AWK 'BEGIN{nn=0;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME["nn"]="$1"\nDNAME["nn"]="$i} }' \          | $AWK 'BEGIN{nn=0;} (NF>0){ for(i=2;i<=NF;i++){nn++; print "PNAME["nn"]="$1"\nDNAME["nn"]="$i} }' \
207          > ./.pd_tmp          > ./.pd_tmp
208      source ./.pd_tmp      . ./.pd_tmp
209      rm -f ./.pd_tmp      rm -f ./.pd_tmp
210    
211      echo -n "PNAME = "${}      echo -n "PNAME = "${}
# Line 215  get_pdepend_list()  { Line 214  get_pdepend_list()  {
214    
215  #  Explain usage  #  Explain usage
216  usage()  {  usage()  {
217      echo  cat <<EOF
218      echo "Usage: "$0" [OPTIONS]"  
219      echo "  where [OPTIONS] can be:"  Usage: "$0" [OPTIONS]
220      echo    where [OPTIONS] can be:
221      echo "    -help | --help | -h | --h"  
222      echo "    -nooptfile | --nooptfile"      -help | --help | -h | --h
223      echo "      -optfile NAME | --optfile NAME | -of NAME | --of NAME"            Print this help message and exit.
224      echo "      -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME"  
225      echo "    -pdepend NAME | --pdepend NAME"      -nooptfile | --nooptfile
226      echo "      -pdepend=NAME | --pdepend=NAME"        -optfile NAME | --optfile NAME | -of NAME | --of NAME
227      echo "    -pdefault NAME | --pdefault NAME"        -optfile=NAME | --optfile=NAME | -of=NAME | --of=NAME
228      echo "      -pdefault=NAME | --pdefault=NAME"            Use "NAME" as the optfile.  By default, an attempt will be
229      echo "    -make NAME | -m NAME"            made to find an appropriate "standard" optfile in the
230      echo "      --make=NAME | -m=NAME"            tools/build_options/ directory.
231      echo "    -makefile NAME | -mf NAME"  
232      echo "      --makefile=NAME | -mf=NAME"      -pdepend NAME | --pdepend NAME
233      echo "    -platform NAME | --platform NAME | -pl NAME | --pl NAME"        -pdepend=NAME | --pdepend=NAME
234      echo "      -platform=NAME | --platform=NAME | -pl=NAME | --pl=NAME"            Get package dependency information from "NAME".
235      echo "    -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME"  
236      echo "      -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME"      -pdefault NAME | --pdefault NAME
237      echo "    -mods NAME | --mods NAME | -mo NAME | --mo NAME"        -pdefault=NAME | --pdefault=NAME
238      echo "      -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME"            Get the default package list from "NAME".
239      echo "    -disable NAME | --disable NAME"  
240      echo "      -disable=NAME | --disable=NAME"      -make NAME | -m NAME
241      echo "    -enable NAME | --enable NAME"        --make=NAME | -m=NAME
242      echo "      -enable=NAME | --enable=NAME"            Use "NAME" for the MAKE program. The default is "make" but
243      echo "    -standarddirs NAME | --standarddirs NAME"            many platforms, "gmake" is the preferred choice.
244      echo "      -standarddirs=NAME | --standarddirs=NAME"  
245      echo "    -noopt NAME | --noopt NAME"      -makefile NAME | -mf NAME
246      echo "      -noopt=NAME | --noopt=NAME"        --makefile=NAME | -mf=NAME
247  #    echo "    -cpp NAME | --cpp NAME"            Call the makefile "NAME".  The default is "Makefile".
248  #    echo "      -cpp=NAME | --cpp=NAME"  
249      echo "    -fortran NAME | --fortran NAME | -fc NAME | --fc NAME"      -rootdir NAME | --rootdir NAME | -rd NAME | --rd NAME
250      echo "      -fc=NAME | --fc=NAME"        -rootdir=NAME | --rootdir=NAME | -rd=NAME | --rd=NAME
251      echo "    -[no]ieee | --[no]ieee"            Specify the location of the MITgcm ROOTDIR as "NAME".
252      echo "    -[no]mpi | --[no]mpi"            By default, genamke will try to find the location by
253      echo "    -[no]jam | --[no]jam"            looking in parent directories (up to the 5th parent).
254      echo  
255      echo "  and NAME is a string such as:"      -mods NAME | --mods NAME | -mo NAME | --mo NAME
256      echo        -mods=NAME | --mods=NAME | -mo=NAME | --mo=NAME
257      echo "    --enable pkg1   --enable 'pkg1 pkg2'   --enable 'pkg1 pkg2 pkg3'"            Here, "NAME" specifies a list of directories that are
258      echo "    -mods=dir1   -mods='dir1'   -mods='dir1 dir2 dir3'"            used for additional source code.  Files found in the
259      echo "    -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'"            "mods list" are given preference over files of the same
260      echo            name found elsewhere.
261      echo "  which, depending upon your shell, may need to be single-quoted"  
262      echo "  if it contains spaces, dashes, or other special characters."      -disable NAME | --disable NAME
263          -disable=NAME | --disable=NAME
264              Here "NAME" specifies a list of packages that we don't
265              want to use.  If this violates package dependencies,
266              genamke will exit with an error message.
267    
268        -enable NAME | --enable NAME
269          -enable=NAME | --enable=NAME
270              Here "NAME" specifies a list of packages that we wish
271              to specifically enable.  If this violates package
272              dependencies, genamke will exit with an error message.
273    
274        -standarddirs NAME | --standarddirs NAME
275          -standarddirs=NAME | --standarddirs=NAME
276              Here, "NAME" specifies a list of directories to be
277              used as the "standard" code.
278    
279        -fortran NAME | --fortran NAME | -fc NAME | --fc NAME
280          -fc=NAME | --fc=NAME
281              Use "NAME" as the fortran compiler.  By default, genmake
282              will search for a working compiler by trying a list of
283              "usual suspects" such as g77, f77, etc.
284    
285        -[no]ieee | --[no]ieee
286              Do or don't use IEEE numerics.  Note that this option
287              *only* works if it is supported by the OPTFILE that
288              is being used.
289    
290      While it is most often a single word, the "NAME" variables specified
291      above can in many cases be a space-delimited string such as:
292    
293        --enable pkg1   --enable 'pkg1 pkg2'   --enable 'pkg1 pkg2 pkg3'
294        -mods=dir1   -mods='dir1'   -mods='dir1 dir2 dir3'
295        -foptim='-Mvect=cachesize:512000,transform -xtypemap=real:64,double:64,integer:32'
296    
297      which, depending upon your shell, may need to be single-quoted.
298    
299      For more detailed genmake documentation, please see:
300    
301        http://mitgcm.org/devel_HOWTO/
302    
303    EOF
304    
305      exit 1      exit 1
306  }  }
307    
# Line 271  get_fortran_c_namemangling()  { Line 312  get_fortran_c_namemangling()  {
312      cat > genmake_test.c <<EOF      cat > genmake_test.c <<EOF
313  void tcall( char * string ) { tsub( string ); }  void tcall( char * string ) { tsub( string ); }
314  EOF  EOF
315      $MAKE genmake_test.o > genmake_test.log 2>&1      $MAKE genmake_test.o >> genmake_warnings 2>&1
316      RETVAL=$?      RETVAL=$?
317      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
         cat genmake_test.log >> genmake_errors  
318          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
319          echo          cat <<EOF>> genmake_errors
320          echo "WARNING: C test compile fails -- please see \"genmake_errors\""  
321          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"  WARNING: C test compile fails
322          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
323    WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
324    EOF
325          return 1          return 1
326      fi      fi
327      c_tcall=`nm genmake_test.o | grep tcall | cut -d ' ' -f 3`      c_tcall=`nm genmake_test.o | grep tcall | cut -d ' ' -f 3`
328      RETVAL=$?      RETVAL=$?
329      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
330          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
331          echo          cat <<EOF>> genmake_warnings
332          echo "WARNING: The \"nm\" command failed."  
333          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"  WARNING: The "nm" command failed.
334          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
335    WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here
336    EOF
337          return 1          return 1
338      fi      fi
339      cat > genmake_tcomp.f <<EOF      cat > genmake_tcomp.f <<EOF
# Line 298  EOF Line 342  EOF
342        call tsub( string )        call tsub( string )
343        end        end
344  EOF  EOF
345      $FC $FFLAGS $DEFINES -c genmake_tcomp.f > genmake_tcomp.log 2>&1      $FC $FFLAGS $DEFINES -c genmake_tcomp.f >> genmake_warnings 2>&1
346      RETVAL=$?      RETVAL=$?
347      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
         cat genmake_tcomp.log >> genmake_errors  
348          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
349          echo          cat <<EOF>> genmake_warnings
350          echo "WARNING: FORTRAN test compile fails -- please see \"genmake_errors\""  
351          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"  WARNING: FORTRAN test compile fails -- please see "genmake_errors"
352          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
353    WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
354    EOF
355          return 1          return 1
356      fi      fi
357      f_tcall=`nm genmake_tcomp.o | grep tcall | cut -d ' ' -f 3`      f_tcall=`nm genmake_tcomp.o | grep tcall | cut -d ' ' -f 3`
358      RETVAL=$?      RETVAL=$?
359      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
360          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
361          echo          cat <<EOF>> genmake_warnings
362          echo "WARNING: The \"nm\" command failed."  
363          echo "WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'"  WARNING: The "nm" command failed.
364          echo "WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here."  WARNING: We'll try to use: FC_NAMEMANGLE='$FC_NAMEMANGLE'
365    WARNING: Please contact <MITgcm-support@mitgcm.org> if you need help here.
366    EOF
367          return 1          return 1
368      fi      fi
369    
# Line 343  EOF Line 390  EOF
390      rm -f genmake_tcomp.* genmake_test.*      rm -f genmake_tcomp.* genmake_test.*
391  }  }
392    
393    
394    check_HAVE_CLOC()  {
395        get_fortran_c_namemangling
396        cat <<EOF > genmake_tc_1.c
397    $FC_NAMEMANGLE
398    #include <stdio.h>
399    #include <stdlib.h>
400    #include <unistd.h>
401    #include <assert.h>
402    #include <sys/time.h>
403    void FC_NAMEMANGLE(cloc) ( double *curtim )
404    {
405     struct timeval tv1;
406     gettimeofday(&tv1 , (void *)NULL );
407     *curtim =  (double)((tv1.tv_usec)+(tv1.tv_sec)*1.E6);
408     *curtim = *curtim/1.E6;
409    }
410    EOF
411        make genmake_tc_1.o >> genmake_tc.log 2>&1
412        RET_C=$?
413        cat <<EOF > genmake_tc_2.f
414          program hello
415          Real*8 wtime
416          external cloc
417          call cloc(wtime)
418          print *," HELLO WORLD", wtime
419          end program hello
420    EOF
421        $FC $FFLAGS -o genmake_tc genmake_tc_2.f genmake_tc_1.o >> genmake_tc.log 2>&1
422        RET_F=$?
423        test -x ./genmake_tc  &&  ./genmake_tc >> genmake_tc.log 2>&1
424        RETVAL=$?
425        if test "x$RETVAL" = x0 ; then
426            HAVE_CLOC=t
427            DEFINES="$DEFINES -DHAVE_CLOC"
428        fi
429        rm -f genmake_tc*
430    }
431    
432    
433  #  Set defaults here  #  Set defaults here
434  COMMANDL="$0 $@"  COMMANDL="$0 $@"
435    
# Line 378  NOOPTFLAGS= Line 465  NOOPTFLAGS=
465  HAVE_SYSTEM=  HAVE_SYSTEM=
466  HAVE_FDATE=  HAVE_FDATE=
467  FC_NAMEMANGLE=  FC_NAMEMANGLE=
468    HAVE_CLOC=
469    
470  MODS=  MODS=
471  TOOLSDIR=  TOOLSDIR=
# Line 416  TAMC_EXTRA= Line 504  TAMC_EXTRA=
504    
505    
506  #  The following state can be set directly by command-line switches  #  The following state can be set directly by command-line switches
507  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE NOOPT"  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE PLATFORM ROOTDIR MODS DISABLE ENABLE"
508  gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS"  gm_s2="FC IEEE MPI JAM DUMPSTATE STANDARDDIRS"
509    
510  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
# Line 434  gm_s12="TAF_EXTRA TAMC_EXTRA" Line 522  gm_s12="TAF_EXTRA TAMC_EXTRA"
522  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7"  gm_state="COMMANDL $gm_s1 $gm_s2 $gm_s3 $gm_s4 $gm_s5 $gm_s6 $gm_s7"
523  gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"  gm_state="$gm_state $gm_s10 $gm_s11 $gm_s12"
524    
525    cat <<EOF
526    
527    GENMAKE :
528    
529    A program for GENerating MAKEfiles for the MITgcm project.  For a
530    quick list of options, use "genmake -h" or for more detail see:
531    
532      http://mitgcm.org/devel_HOWTO/
533    
534    EOF
535    
 echo  
536  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
537  gm_local="genmake_local"  gm_local="genmake_local"
538  for i in . $MODS ; do  for i in . $MODS ; do
539      if test -r $i/$gm_local ; then      if test -r $i/$gm_local ; then
540          source $i/$gm_local          . $i/$gm_local
541          break          break
542      fi      fi
543  done  done
544  echo -n "  getting local config information:  "  echo -n "  getting local config information:  "
545  if test -e $gm_local ; then  if test -e $gm_local ; then
546      echo "using $gm_local"      echo "using $gm_local"
547      source $gm_local      . $gm_local
548      # echo "DISABLE=$DISABLE"      # echo "DISABLE=$DISABLE"
549      # echo "ENABLE=$ENABLE"      # echo "ENABLE=$ENABLE"
550  else  else
# Line 514  for ac_option ; do Line 611  for ac_option ; do
611          -makefile=* | --makefile=* | -ma=* | --ma=*)          -makefile=* | --makefile=* | -ma=* | --ma=*)
612              MAKEFILE=$ac_optarg ;;              MAKEFILE=$ac_optarg ;;
613                    
614          -platform | --platform | -pl | --pl)          -platform | --platform | -pl | --pl | -platform=* | --platform=* | -pl=* | --pl=*)
615              ac_prev=PLATFORM ;;              echo "ERROR: The platform option has been removed.  Please specify"
616          -platform=* | --platform=* | -pl=* | --pl=*)              echo "  the build options using the \"optfile\" mechanism."
617              PLATFORM=$ac_optarg ;;              echo
618                usage
619                ;;
620                    
621          -rootdir | --rootdir | -rd | --rd)          -rootdir | --rootdir | -rd | --rd)
622              ac_prev=ROOTDIR ;;              ac_prev=ROOTDIR ;;
# Line 544  for ac_option ; do Line 643  for ac_option ; do
643          -standarddirs=* | --standarddirs=*)          -standarddirs=* | --standarddirs=*)
644              STANDARDDIRS=$ac_optarg ;;              STANDARDDIRS=$ac_optarg ;;
645    
         -noopt | --noopt)  
             ac_prev=NOOPT ;;  
         -noopt=* | --noopt=*)  
             NOOPT=$ac_optarg ;;  
           
646  #           -cpp | --cpp)  #           -cpp | --cpp)
647  #               ac_prev=cpp ;;  #               ac_prev=cpp ;;
648  #           -cpp=* | --cpp=*)  #           -cpp=* | --cpp=*)
# Line 564  for ac_option ; do Line 658  for ac_option ; do
658          -noieee | --noieee)          -noieee | --noieee)
659              IEEE= ;;              IEEE= ;;
660                    
661          -mpi | --mpi)  #       -jam | --jam)
662              MPI=true ;;  #           JAM=1 ;;
663          -nompi | --nompi)  #       -nojam | --nojam)
664              MPI= ;;  #           JAM=0 ;;
           
         -jam | --jam)  
             JAM=1 ;;  
         -nojam | --nojam)  
             JAM=0 ;;  
665                    
666          -ds | --ds)          -ds | --ds)
667              DUMPSTATE=t ;;              DUMPSTATE=t ;;
# Line 651  fi Line 740  fi
740  if test "x$OPTFILE" != xNONE ; then  if test "x$OPTFILE" != xNONE ; then
741      if test -f "$OPTFILE" -a -r "$OPTFILE" ; then      if test -f "$OPTFILE" -a -r "$OPTFILE" ; then
742          echo "    using OPTFILE=\"$OPTFILE\""          echo "    using OPTFILE=\"$OPTFILE\""
743          source "$OPTFILE"          . "$OPTFILE"
744          RETVAL=$?          RETVAL=$?
745          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
746              echo -n "Error: failed to source OPTFILE \"$OPTFILE\""              echo -n "Error: failed to source OPTFILE \"$OPTFILE\""
# Line 678  fi Line 767  fi
767  if test "x${AD_OPTFILE}" != xNONE ; then  if test "x${AD_OPTFILE}" != xNONE ; then
768      if test -f "$AD_OPTFILE" -a -r "$AD_OPTFILE" ; then      if test -f "$AD_OPTFILE" -a -r "$AD_OPTFILE" ; then
769          echo "    using AD_OPTFILE=\"$AD_OPTFILE\""          echo "    using AD_OPTFILE=\"$AD_OPTFILE\""
770          source "$AD_OPTFILE"          . "$AD_OPTFILE"
771          RETVAL=$?          RETVAL=$?
772          if test "x$RETVAL" != x0 ; then          if test "x$RETVAL" != x0 ; then
773              echo -n "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""              echo -n "Error: failed to source AD_OPTFILE \"$AD_OPTFILE\""
# Line 694  if test "x${AD_OPTFILE}" != xNONE ; then Line 783  if test "x${AD_OPTFILE}" != xNONE ; then
783      fi      fi
784  fi  fi
785    
786  #  Check that FC, LINK, CPP, and S64 are defined.  If not, complain  #  Check that FC, LINK, CPP, S64, LN, and MAKE are defined.  If not,
787  #  and abort!  #  either set defaults or complain and abort!
788  if test "x$FC" = x ; then  if test "x$FC" = x ; then
789      cat <<EOF 1>&2      cat <<EOF 1>&2
790    
# Line 712  fi Line 801  fi
801  if test "x$CPP" = x ; then  if test "x$CPP" = x ; then
802      CPP="cpp"      CPP="cpp"
803  fi  fi
804    if test "x$MAKE" = x ; then
805        MAKE="make"
806    fi
807  echo "#define A a" | $CPP > test_cpp 2>&1  echo "#define A a" | $CPP > test_cpp 2>&1
808  RETVAL=$?  RETVAL=$?
809  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
# Line 731  fi Line 823  fi
823  if test "x$MAKEDEPEND" = x ; then  if test "x$MAKEDEPEND" = x ; then
824      MAKEDEPEND=makedepend      MAKEDEPEND=makedepend
825  fi  fi
826    if test "x$LN" = x ; then
827        LN="ln -s"
828    fi
829    echo "test" > genmake_test_ln
830    $LN genmake_test_ln genmake_tlink
831    RETVAL=$?
832    if test "x$RETVAL" != x0 ; then
833        cat <<EOF 1>&2
834    
835    Error: The command "ln -s" failed -- please specify a working soft-link
836      command in the optfile.
837    
838    EOF
839        exit 1
840    fi
841    rm -f genmake_test_ln genmake_tlink
842    
843    
844  printf "\n===  Checking system libraries  ===\n"  printf "\n===  Checking system libraries  ===\n"
# Line 773  else Line 881  else
881  fi  fi
882  rm -f genmake_tcomp*  rm -f genmake_tcomp*
883    
884  echo "  The name mangling convention for $FC is...  "  echo -n "  Can we call simple C routines (here, \"cloc()\") using $FC...  "
885  #FC_NAMEMANGLE="#define FC_NAMEMANGLE(X) X ## _"  check_HAVE_CLOC
886  if test "x$FC_NAMEMANGLE" = x ; then  if test "x$HAVE_CLOC" != x ; then
887      get_fortran_c_namemangling      echo "yes"
888    else
889        echo "no"
890  fi  fi
 echo "    '$FC_NAMEMANGLE'"  
891  echo "$FC_NAMEMANGLE" > FC_NAMEMANGLE.h.template  echo "$FC_NAMEMANGLE" > FC_NAMEMANGLE.h.template
892  cmp FC_NAMEMANGLE.h FC_NAMEMANGLE.h.template > /dev/null 2>&1  cmp FC_NAMEMANGLE.h FC_NAMEMANGLE.h.template > /dev/null 2>&1
893  RETVAL=$?  RETVAL=$?
894  if test "x$RETVAL" != x0 ; then  if test "x$RETVAL" != x0 ; then
895      mv -f FC_NAMEMANGLE.h.template FC_NAMEMANGLE.h      mv -f FC_NAMEMANGLE.h.template FC_NAMEMANGLE.h
896  fi  fi
897    rm -f genmake_t*
898    
899    
900  printf "\n===  Setting defaults  ===\n"  printf "\n===  Setting defaults  ===\n"
# Line 839  EXECUTABLE=${EXECUTABLE:-mitgcmuv} Line 949  EXECUTABLE=${EXECUTABLE:-mitgcmuv}
949  #  they appear as regular source code  #  they appear as regular source code
950  if test -r $ROOTDIR"/eesupp/src/Makefile" ; then  if test -r $ROOTDIR"/eesupp/src/Makefile" ; then
951      echo "  Making source files in eesupp from templates"      echo "  Making source files in eesupp from templates"
952      $MAKE -C $ROOTDIR"/eesupp/src/" > make_eesupp.errors 2>&1      ( cd $ROOTDIR"/eesupp/src/" && $MAKE ) > make_eesupp.errors 2>&1
953      RETVAL=$?      RETVAL=$?
954      if test "x${RETVAL}" = x0 ; then      if test "x${RETVAL}" = x0 ; then
955          rm -f make_eesupp.errors          rm -f make_eesupp.errors
# Line 876  if test ! "x${RETVAL}" = x0 ; then Line 986  if test ! "x${RETVAL}" = x0 ; then
986      echo "Error: unable to parse package dependencies -- please check PDEPEND=\"$PDEPEND\""      echo "Error: unable to parse package dependencies -- please check PDEPEND=\"$PDEPEND\""
987      exit 1      exit 1
988  fi  fi
989  source ./.pd_tmp  . ./.pd_tmp
990  rm -f ./.pd_tmp  rm -f ./.pd_tmp
991    
992  #  Search for default packages.  Note that a "$ROOTDIR/pkg/pkg_groups"  #  Search for default packages.  Note that a "$ROOTDIR/pkg/pkg_groups"
993  #  file should eventually be added so that, for convenience, one can  #  file should eventually be added so that, for convenience, one can
994  #  specify groups of packages using names like "ocean" and "atmosphere".  #  specify groups of packages using names like "ocean" and "atmosphere".
995  echo  -n "  checking default package list:  "  echo "  checking default package list:  "
996  if test "x${PDEFAULT}" = x ; then  if test "x${PDEFAULT}" = x ; then
997      for i in "." $MODS ; do      for i in "." $MODS ; do
998          if test -r $i"/packages.conf" ; then          if test -r $i"/packages.conf" ; then
# Line 895  if test "x${PDEFAULT}" = x ; then Line 1005  if test "x${PDEFAULT}" = x ; then
1005      PDEFAULT="$ROOTDIR/pkg/pkg_default"      PDEFAULT="$ROOTDIR/pkg/pkg_default"
1006  fi  fi
1007  if test "x${PDEFAULT}" = xNONE ; then  if test "x${PDEFAULT}" = xNONE ; then
1008      echo "default packages file disabled"      echo "    default packages file disabled"
1009  else  else
1010      if test ! -r $PDEFAULT ; then      if test ! -r $PDEFAULT ; then
         echo ""  
1011          echo "Warning:  can't read default packages from PDEFAULT=\"$PDEFAULT\""          echo "Warning:  can't read default packages from PDEFAULT=\"$PDEFAULT\""
1012      else      else
1013          echo "  using PDEFAULT=\"$PDEFAULT\""          echo "    using PDEFAULT=\"$PDEFAULT\""
1014          #  Strip the comments and add all the names          #  Strip the comments and add all the names
1015          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`          def=`cat $PDEFAULT | sed -e 's/#.*$//g' | $AWK '(NF>0){print $0}'`
1016          RETVAL=$?          RETVAL=$?
# Line 1470  ad_taf_output.f: ad_input_code.f Line 1579  ad_taf_output.f: ad_input_code.f
1579          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f          \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1580          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f          cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f
1581    
1582    adtafonly:
1583            \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f
1584            cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f
1585    
1586  ad_taf: ad_taf_output.o \$(OBJFILES)  ad_taf: ad_taf_output.o \$(OBJFILES)
1587          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_AD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o \$(LIBS)
1588    
# Line 1496  ftl_taf_output.f: ftl_input_code.f Line 1609  ftl_taf_output.f: ftl_input_code.f
1609          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f          \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1610          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f          cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f
1611    
1612    ftltafonly:
1613            \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f
1614            cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f
1615    
1616  ftl_taf: ftl_taf_output.o \$(OBJFILES)  ftl_taf: ftl_taf_output.o \$(OBJFILES)
1617          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)          \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS)
1618    
# Line 1508  ftl_tamc: ftl_tamc_output.o \$(OBJFILES) Line 1625  ftl_tamc: ftl_tamc_output.o \$(OBJFILES)
1625    
1626    
1627  # ... SVD ...  # ... SVD ...
1628  svd: svd_taf  svdtaf: ad_taf_output.f ftl_taf_output.f
1629  svd_taf_f: svd_taf_output.f  svdall: svd_taf
   
 svd_input_code.f: \$(SRCFILES)  
         cmp svd_config.template AD_CONFIG.h || cat svd_config.template > AD_CONFIG.h  
         @make \$(F77FILES)  
         @make \$(AD_FLOW_FILES)  
         cat \$(AD_FLOW_FILES) \$(AD_FILES) > svd_input_code.f  
   
 svd_taf_output.f: svd_input_code.f  
         \$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) svd_input_code.f  
         cat svd_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f  
1630    
1631  svd_taf: svd_taf_output.o \$(OBJFILES)  svd_taf: ad_taf_output.o ftl_taf_output.o \$(OBJFILES)
1632          \$(LINK) -o ${EXE_SVD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS)          \$(LINK) -o mitgcmuv_svd \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ad_taf_output.o ftl_taf_output.o \$(LIBS)
1633    
1634    
1635  #=========================================  #=========================================

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.22