/[MITgcm]/MITgcm/tools/genmake
ViewVC logotype

Diff of /MITgcm/tools/genmake

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.52 by cnh, Mon Sep 10 15:58:26 2001 UTC revision 1.65 by adcroft, Wed Aug 7 19:57:48 2002 UTC
# Line 9  Line 9 
9  #   modified by aja 01/00  #   modified by aja 01/00
10    
11  # Default lists  # Default lists
12  set DISABLE = ( aim autodiff cal cost ctrl ecco exf grdchk )  set DISABLE = ( aim autodiff cal cost ctrl ecco exf grdchk flt ptracers )
13  set DEFINES = ( )  set DEFINES = ( )
14  set ENABLE  = ( )  set ENABLE  = ( )
15  set MODS  = ( )  set MODS  = ( )
# Line 78  while ($#allargs) Line 78  while ($#allargs)
78     echo "-enable overrides -disable, ie. a package listed in both is enabled"     echo "-enable overrides -disable, ie. a package listed in both is enabled"
79     exit     exit
80     breaksw     breaksw
  case -ieee:  
    set IEEE  
    breaksw  
81   case -enable=*:   case -enable=*:
82     set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)     set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)
83     breaksw     breaksw
84     case -cpp:
85     case -cpp=:
86       echo "To define CPP macros use -cpp=arg"
87       exit
88       breaksw
89     case -cpp=*:
90       set DEFINES = ( $DEFINES `echo $arg | sed 's/-cpp=//' | sed 's/,/ /g' `)
91       breaksw
92     case -ieee:
93       set IEEE
94       breaksw
95   case -mpi:   case -mpi:
96     echo "Enabling MPI options"     echo "Enabling MPI options"
97     set USEMPI     set USEMPI
# Line 92  while ($#allargs) Line 100  while ($#allargs)
100     set include_jam_libs     set include_jam_libs
101     echo "Including paths to JAM libraries"     echo "Including paths to JAM libraries"
102     breaksw     breaksw
103     case -fc:
104     case -fc=:
105       echo "To change the compiler (\$FC) you must specify one with -fc="
106       echo "eg. -fc=f90  or  -fc=g77"
107       exit
108       breaksw
109     case -fc*:
110       if ($?FC) then
111        echo Option -fc=... can only be specified once.; exit 1
112       endif
113       set FC = ( `echo $arg | sed 's/-fc=//' `)
114       breaksw
115   case -help:   case -help:
116     echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]"     echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]"
117  cat << EOF  cat << EOF
# Line 133  end Line 153  end
153  # If platform wasn't specified then determine platform type of the host  # If platform wasn't specified then determine platform type of the host
154  if (! $?platform) then  if (! $?platform) then
155   set platform = (`uname`)   set platform = (`uname`)
156    # This let's us distinguish between different Linux platforms
157     if ($platform == Linux) then
158      set machine = (`uname -m`)
159      set platform = ($platform'-'$machine)
160     endif
161  endif  endif
162  # If name of makefile wasn't specified then use default "Makefile"  # If name of makefile wasn't specified then use default "Makefile"
163  if (! $?mfile) set mfile = ( Makefile )  if (! $?mfile) set mfile = ( Makefile )
# Line 252  foreach dr ($PACKAGES) Line 277  foreach dr ($PACKAGES)
277      echo Adding pkg dir: $adr      echo Adding pkg dir: $adr
278      set SOURCEDIRS = ($SOURCEDIRS $adr)      set SOURCEDIRS = ($SOURCEDIRS $adr)
279      set INCLUDEDIRS = ($INCLUDEDIRS $adr)      set INCLUDEDIRS = ($INCLUDEDIRS $adr)
280        switch ($dr)
281          case ptracers:
282            set DEFINES = ($DEFINES '-DALLOW_PTRACERS'); breaksw
283          default:
284            breaksw
285        endsw
286    else    else
287      echo "                                      *" Package \"$dr\" NOT enabled.      echo "                                      *" Package \"$dr\" NOT enabled.
288      switch ($dr)      switch ($dr)
# Line 259  foreach dr ($PACKAGES) Line 290  foreach dr ($PACKAGES)
290          set DEFINES = ($DEFINES '-DDISABLE_MOM_FLUXFORM'); breaksw          set DEFINES = ($DEFINES '-DDISABLE_MOM_FLUXFORM'); breaksw
291        case mom_vecinv:        case mom_vecinv:
292          set DEFINES = ($DEFINES '-DDISABLE_MOM_VECINV'); breaksw          set DEFINES = ($DEFINES '-DDISABLE_MOM_VECINV'); breaksw
293          case generic_advdiff:
294            set DEFINES = ($DEFINES '-DDISABLE_GENERIC_ADVDIFF'); breaksw
295        default:        default:
296          breaksw          breaksw
297      endsw      endsw
# Line 276  foreach dr ($STANDARDDIRS) Line 309  foreach dr ($STANDARDDIRS)
309    set INCLUDEDIRS = ($INCLUDEDIRS $idr)    set INCLUDEDIRS = ($INCLUDEDIRS $idr)
310  end  end
311    
312    # Find possible compilers
313    if ($?FC) then
314     echo "$FC was specified as the compiler"
315    else
316     echo " "
317     switch ($platform)
318      case Linux*:
319       set likelysuspects=(ifc g77 pgf77 f77 f90 f95)
320       breaksw
321      default:
322       set likelysuspects=(f77)
323       breaksw
324     endsw
325     foreach fc ($likelysuspects)
326      set foundfc=`which $fc |& cat - `
327      if (-x $foundfc[1]) then
328       if ($?possiblefc) then
329        set possiblefc=($possiblefc $fc)
330       else
331        set possiblefc=$fc
332       endif
333      endif
334     end
335     if ($?possiblefc) then
336      set FC=$possiblefc[1]
337      echo Found these compilers: $possiblefc.  Using \"$FC\" as the compiler
338     else
339      echo "No compiler found\!"
340      echo I tried looking for \"$likelysuspects\" in your \$PATH but found none
341      echo I will continue anyway and see what happens.
342      set FC = ( 'f77' )
343    # exit 13
344     endif
345    endif
346    
347  # This is the generic configuration.  # This is the generic configuration.
348  # Platform specific options are chosen below  # Platform specific options are chosen below
349  set LN         = ( 'ln -s' )  set LN         = ( 'ln -s' )
350  set CPP        = ( '/lib/cpp -P' )  set CPP        = ( '/lib/cpp -P' )
351  set S64        = ( '\$(TOOLSDIR)/set64bitConst.sh' )  set S64        = ( '$(TOOLSDIR)/set64bitConst.sh' )
352  set KPP        = (  )  set KPP        = (  )
353  set FC         = ( 'f77' )  #set FC         = ( 'f77' )
354  set LINK       = ( 'f77' )  set LINK       = $FC
355    set MAKEDEPEND = ( 'makedepend' )
356  set INCLUDES   = ( -I. )  set INCLUDES   = ( -I. )
357  set FFLAGS     = (  )  set FFLAGS     = (  )
358  set FOPTIM     = (  )  set FOPTIM     = (  )
# Line 386  switch ($platform$USEMPI) Line 455  switch ($platform$USEMPI)
455    case SunOS:    case SunOS:
456      set LN         = ( '/usr/bin/ln -s' )      set LN         = ( '/usr/bin/ln -s' )
457      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
458      set S64        = ( cat )      set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
459      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
460      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -r8 -i4 -fsimple=0' )      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
461      set FOPTIM     = ( '-dalign -O3 -xarch=v9' )      set FOPTIM     = ( '-dalign -O3 -xarch=v9' )
462      set CFLAGS     = ( '-dalign -O3 -xarch=v9' )      set CFLAGS     = ( '-dalign -O3 -xarch=v9' )
463      set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )      set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
# Line 397  switch ($platform$USEMPI) Line 466  switch ($platform$USEMPI)
466    case SunOS+mpi:    case SunOS+mpi:
467      set LN         = ( '/usr/bin/ln -s' )      set LN         = ( '/usr/bin/ln -s' )
468      set CPP        = ( '/usr/ccs/lib/cpp -P' )      set CPP        = ( '/usr/ccs/lib/cpp -P' )
     set S64        = ( cat )  
469      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )      set DEFINES    = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
470      set INCLUDES   = ( '-I/usr/local/mpi/include' )      set INCLUDES   = ( '-I/usr/local/mpi/include' )
471      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \      set LIBS       = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
472      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -r8 -i4 -fsimple=0' )      set FFLAGS     = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
473      set FOPTIM     = ( '-dalign -O3 -xarch=v9' )      set FOPTIM     = ( '-dalign -O3 -xarch=v9' )
474      set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )      set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
475                         '-lsocket -lnsl' )                         '-lsocket -lnsl' )
# Line 433  switch ($platform$USEMPI) Line 501  switch ($platform$USEMPI)
501      set NOOPTFILES = ( 'barrier.F different_multiple.F' \      set NOOPTFILES = ( 'barrier.F different_multiple.F' \
502                         'external_fields_load.F' )                         'external_fields_load.F' )
503      breaksw      breaksw
504    case Linux+mpi:    case Linux-alpha+mpi:
505        echo "Configuring with MPI"
506      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )      set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
507      set INCLUDES   = ( '-I/usr/local/include' )      set INCLUDES   = ( '-I/usr/local/include' )
508    case Linux:    case Linux-alpha:
509        echo "Configuring for " $platform
510      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
511      set CPP        = ( '/lib/cpp  -traditional -P' )      set CPP        = ( '/lib/cpp  -traditional -P' )
512      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
513      set FC         = ( 'g77' )      set FC         = ( 'g77' )
514      set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )      set FFLAGS     = ( ' ' )
515      if ($?IEEE) set FFLAGS     = ( $FFLAGS '-ffloat-store' )      if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
516      set FOPTIM     = ( '-O3 -malign-double -funroll-loops' )      set FOPTIM     = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' )
517      set LINK       = ( 'g77' )      set LINK       = ( 'g77' )
518      breaksw      breaksw
519    case Linux+pgi+mpi:    case Linux*+pgi+mpi:
520      if ($?include_jam_libs) then      if ($?include_jam_libs) then
521       set INCLUDES   = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )       set INCLUDES   = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
522       set LIBS       = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' )       set LIBS       = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' )
# Line 454  switch ($platform$USEMPI) Line 524  switch ($platform$USEMPI)
524       set INCLUDES   = ( '-I/usr/local/include' )       set INCLUDES   = ( '-I/usr/local/include' )
525       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )       set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
526      endif      endif
527    case Linux+pgi:    case Linux*+pgi:
528        echo "Configuring for " $platform
529      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
530      set CPP        = ( '/lib/cpp -traditional -P' )      set CPP        = ( '/lib/cpp -traditional -P' )
531      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
# Line 463  switch ($platform$USEMPI) Line 534  switch ($platform$USEMPI)
534      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
535      set LINK       = ( 'pgf77' )      set LINK       = ( 'pgf77' )
536      breaksw      breaksw
537      case Linux*+mpi:
538        set LIBS       = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
539        set INCLUDES   = ( '-I/usr/local/include' )
540      case Linux*:
541        echo "Configuring for " $platform
542        set LN         = ( '/bin/ln -s' )
543        set CPP        = ( '/lib/cpp  -traditional -P' )
544        switch ($FC)
545         case g77:
546          set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
547          set FFLAGS     = ( '-Wimplicit -Wunused -Wuninitialized' )
548          if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
549          set FOPTIM     = ( '-O3 -malign-double -funroll-loops' )
550          breaksw
551         case pgf77:
552          set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
553          set FC         = ( 'pgf77' )
554          set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
555          set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
556          breaksw
557         case ifc:
558          set DEFINES    = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
559          set FFLAGS     = ( '-132 -r8 -i4 -w95 -W0 -WB' )
560          if ($?IEEE) set FFLAGS     = ( $FFLAGS '-mp' )
561          set FOPTIM     = ( '-O3 -align' )
562    #P3   set FOPTIM     = ( $FOPTIM '-tpp6 -xWKM' )
563    #P4   set FOPTIM     = ( $FOPTIM '-tpp7 -xWKM' )
564          set LIBS       = ( '-lPEPCF90' )
565          breaksw
566         default:
567          echo Error: Linux compiler not recognized: \$FC=$FC
568          exit
569          breaksw
570        endsw      
571        breaksw
572    case T3E:    case T3E:
573    case sn6312:    case sn6312:
574        echo "Configuring for T3E"
575      set CPP        = ( '/opt/ctl/bin/cpp -P')      set CPP        = ( '/opt/ctl/bin/cpp -P')
576      set DEFINES    = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
577      set FC         = ( 'f90' )      set FC         = ( 'f90' )
# Line 473  switch ($platform$USEMPI) Line 580  switch ($platform$USEMPI)
580      breaksw      breaksw
581    case T90:    case T90:
582    case sn7113:    case sn7113:
583        echo "Configuring for T90"
584      set FC         = ( 'f90' )      set FC         = ( 'f90' )
585      set LINK       = ( 'f90' )      set LINK       = ( 'f90' )
586      set LN         = ( '/bin/ln -s' )      set LN         = ( '/bin/ln -s' )
# Line 495  switch ($platform$USEMPI) Line 603  switch ($platform$USEMPI)
603      set NOOPTFLAGS = ( '-O0' )      set NOOPTFLAGS = ( '-O0' )
604      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')      set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
605      breaksw      breaksw
606      case SP3:
607    # originally from A. Biastoch, SIO.
608        echo "Configuring for IBM SP POWER3"
609        set SOURCEDIRS  = ( ./ $SOURCEDIRS )
610        set LN         = ( 'ln -s' )
611        set DEFINES    = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
612        set INCLUDES   = ( '-I/usr/lpp/ppe.poe/include' )
613    #    set CPP        = ( '/lib/cpp' )
614        set FC         = ( 'mpxlf95' )
615        set LINK       = ( 'mpxlf95' )
616        set FLAGS      = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
617                               '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
618        set FFLAGS     = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
619                               '-bmaxdata:0x80000000 ' )
620        set LDFLAGS    = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
621                               '-bmaxdata:0x80000000' )
622        set LIBS       = ( ' -L/usr/local/apps/mass -lmass' )
623    #   set FFLAGS     = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
624    #    set FOPTIM     = ( '-O3' )
625    #   set NOOPTFLAGS = ( '-O0' )
626    #   set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
627    #                      'external_fields_load.F' )
628        set RMFILES    = ( 'rii_files' )
629        breaksw
630    default:    default:
631      echo "Error: platform not recognized: uname -p = " $platform$USEMPI      echo "Error: platform not recognized: uname -p = " $platform$USEMPI
632      exit      exit
# Line 586  cat >> ${mfile} <<EOF Line 718  cat >> ${mfile} <<EOF
718  # CPP          : C-preprocessor command  # CPP          : C-preprocessor command
719  # INCLUDES     : Directories searched for header files  # INCLUDES     : Directories searched for header files
720  # DEFINES      : Macro definitions for CPP  # DEFINES      : Macro definitions for CPP
721    # MAKEDEPEND   : Dependency generator
722  # KPP          : Special preprocessor command (specific to platform)  # KPP          : Special preprocessor command (specific to platform)
723  # KFLAGS       : Flags for KPP  # KFLAGS       : Flags for KPP
724  # FC           : Fortran compiler command  # FC           : Fortran compiler command
# Line 644  cat >> ${mfile} <<EOF Line 777  cat >> ${mfile} <<EOF
777  LN = ${LN}  LN = ${LN}
778  # C preprocessor  # C preprocessor
779  CPP = cat \$< | ${S64} | ${CPP}  CPP = cat \$< | ${S64} | ${CPP}
780    # Dependency generator
781    MAKEDEPEND = ${MAKEDEPEND}
782  # Special preprocessor (KAP on DECs, FPP on Crays)  # Special preprocessor (KAP on DECs, FPP on Crays)
783  KPP = ${KPP}  KPP = ${KPP}
784  # Fortran compiler  # Fortran compiler
# Line 689  all: \$(EXECUTABLE) Line 824  all: \$(EXECUTABLE)
824          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)          \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
825  depend:  depend:
826          @make links          @make links
827          makedepend -o .f \$(INCLUDES) \$(SRCFILES)          \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
828    
829  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)  links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)
830    
# Line 700  output.txt: \$(EXECUTABLE) Line 835  output.txt: \$(EXECUTABLE)
835          @\$(EXECUTABLE) > \$@          @\$(EXECUTABLE) > \$@
836    
837  clean:  clean:
838          -rm -rf *.o *.f *.p ${RMFILES}          -rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl}
839  Clean:  Clean:
840          @make clean          @make clean
841          @make cleanlinks          @make cleanlinks

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.65

  ViewVC Help
Powered by ViewVC 1.1.22