/[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.22.2.3 by adcroft, Thu Jan 25 17:56:33 2001 UTC revision 1.22.2.7 by adcroft, Mon Jan 29 16:40:22 2001 UTC
# Line 3  Line 3 
3  # $Header$  # $Header$
4  #  #
5  # Makefile generator for MITgcm UV codes  # Makefile generator for MITgcm UV codes
6  #   created by cnh 03/98  #   created  by cnh 03/98
7  #   adapted by aja 06/98  #   adapted  by aja 06/98
8    #   modified by aja 01/00
9    
10    # Default lists
11    set DISABLE = ( aim )
12    set ENABLE  = ( )
13    set MYMODS  = ( )
14    
15    # Grab variables/lists from .genmakerc
16    if (-r .genmakerc) source .genmakerc
17    
18  # Process command-line arguments  # Process command-line arguments
19  set allargs=( $argv )  set allargs=( $argv )
# Line 24  while ($#allargs) Line 33  while ($#allargs)
33     exit     exit
34     breaksw     breaksw
35   case -platform*:   case -platform*:
36       if ($?platform) then
37        echo Option -platform=dir can only be specified once.; exit 1
38       endif
39     set platform = ( `echo $arg | sed 's/-platform=//' `)     set platform = ( `echo $arg | sed 's/-platform=//' `)
40     breaksw     breaksw
41     case -rootdir:
42     case -rootdir=:
43       echo "To specify root directory you must specify one with -rootdir=dir"
44       echo "with NO space eg. -rootdir=../../..  or  -rootdir=/usr/people/joe/src"
45       exit
46       breaksw
47   case -rootdir=*:   case -rootdir=*:
48       if ($?ROOTDIR) then
49        echo "***" Warning: variable \$ROOTDIR is already set to $ROOTDIR
50        echo "***" Command line \"$arg\" will override this.
51       endif
52     set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)     set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)
53     breaksw     breaksw
54     case -mymods:
55     case -mymods=:
56       echo "To specify an additional source directory you must specify one with -mymods=dir"
57       echo "with NO space eg. -mymods=../code  or  -mymods=/usr/people/joe/src"
58       exit
59       breaksw
60   case -mymods=*:   case -mymods=*:
61     set MYMODS = ( `echo $arg | sed 's/-mymods=//' `)     set MYMODS = ( $MYMODS `echo $arg | sed 's/-mymods=//' | sed 's/,/ /' `)
62       breaksw
63     case -disable:
64     case -disable=:
65       echo "To disable packages from compilation use -disable=pkg1,pkg2"
66       echo "with NO spaces eg. -disable=kpp,gmredi or -disable=all (to enable all packages)"
67       exit
68       breaksw
69     case -disable=*:
70       set DISABLE = ( $DISABLE `echo $arg | sed 's/-disable=//' | sed 's/,/ /' `)
71       breaksw
72     case -enable:
73     case -enable=:
74       echo "To enable packages from compilation use -enable=pkg1,pkg2"
75       echo "with NO spaces eg. -enable=aim or -enable=all (to enable all packages)"
76       echo "-enable overrides -disable, ie. a package listed in both is enabled"
77       exit
78       breaksw
79     case -enable=*:
80       set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /' `)
81     breaksw     breaksw
82   case -mpi:   case -mpi:
83     echo "Enabling MPI options"     echo "Enabling MPI options"
# Line 56  end Line 103  end
103  # Default actions/options  # Default actions/options
104    
105  # If platform wasn't specified then determine platform type of the host  # If platform wasn't specified then determine platform type of the host
106  if ($?platform == 0) then  if (! $?platform) then
107   set platform = (`uname`)   set platform = (`uname`)
108  endif  endif
109  # If name of makefile wasn't specified then use default "Makefile"  # If name of makefile wasn't specified then use default "Makefile"
110  if ($?mfile == 0) set mfile = ( Makefile )  if (! $?mfile) set mfile = ( Makefile )
111    
112  set mach  = ( `uname -a` )  set mach  = ( `uname -a` )
113  echo Operating system: $mach  echo Operating system: $mach
114    
115    
116  # Directories for source, includes, binaries and executables  # Directories for source, includes, binaries and executables
 # Note  
 # o If you prefer/need everything under a single directory  
 #   copy everything in ../eesupp/src, ../model/src,  
 #   ../eesupp/inc and ../model/inc into a directory and then  
 #   edit the paths below to ./  
117  #  #
118  # If -rootdir wasn't specified then assume script is being run from bin  # If -rootdir wasn't specified then assume script is being run from bin
119  # but if it was supplied then we should place the executable in the build dir  # but if it was supplied then we should place the executable in the build dir
120  if ($?ROOTDIR == 0) then  if (! $?ROOTDIR) then
121    set ROOTDIR = ( .. )    set ROOTDIR = ( .. )
122  else  else
123    if ($?EXEDIR == 0) set EXEDIR = ( ./ )    if (! $?EXEDIR) set EXEDIR = ( . )
124    endif
125    if (! -d $ROOTDIR) then
126      echo Root directory $ROOTDIR not found.;exit 1
127  endif  endif
128  if ($?MYMODS == 0) then  # If -mymods wasn't specified then we will assume that we can find all the
129   set SOURCEDIRS  = ( $ROOTDIR/{eesupp,model,diags}/src/ $ROOTDIR/pkg/[a-z]*/ )  # source code in the standard directories
130   set INCLUDEDIRS = ( ./ $ROOTDIR/{eesupp,model,diags}/inc/ $ROOTDIR/pkg/[a-z]*/ )  if (! $?MYMODS) then
131     set SOURCEDIRS  = ( )
132     set INCLUDEDIRS = ( . )
133  else  else
134   set SOURCEDIRS  = ( $MYMODS/ $ROOTDIR/{eesupp,model,diags}/src/ $ROOTDIR/pkg/[a-z]*/ )   set SOURCEDIRS  = ( $MYMODS )
135   set INCLUDEDIRS = ( ./ $MYMODS/ $ROOTDIR/{eesupp,model,diags}/inc/ $ROOTDIR/pkg/[a-z]*/ )   set INCLUDEDIRS = ( . $MYMODS )
136  endif  endif
137  if ($?BUILDDIR == 0) set BUILDDIR = ( ./ )  if (! $?BUILDDIR) set BUILDDIR = ( . )
138  if ($?EXEDIR == 0) set EXEDIR = ( $ROOTDIR/exe/ )  if (! -d $BUILDDIR) then
139  if ($?EXECUTABLE == 0) set EXECUTABLE  = ( mitgcmuv )    echo Build directory $BUILDDIR not found.;exit 1
140  if ($?TOOLSDIR == 0) set TOOLSDIR = ( $ROOTDIR/tools/ )  endif
141    if (! $?EXEDIR) set EXEDIR = ( $ROOTDIR/exe )
142    if (! -d $EXEDIR) then
143      echo Executable directory $EXEDIR not found.;exit 1
144    endif
145    if (! $?TOOLSDIR) set TOOLSDIR = ( $ROOTDIR/tools )
146    if (! -d $TOOLSDIR) then
147      echo Tools directory $TOOLSDIR not found.;exit 1
148    endif
149    if (! $?EXECUTABLE) set EXECUTABLE  = ( mitgcmuv )
150    
151    # Now scan the standard source code tree
152    foreach dr ($SOURCEDIRS)
153      set adr=$dr
154      if (! -d $adr) then
155        echo Mymods directory $adr not found.; exit 1
156      endif
157      echo Adding mymods directory $adr
158    end
159    if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model diags)
160    foreach dr ($STANDARDDIRS)
161      set adr=$ROOTDIR/$dr/src
162      if (! -d $adr) then
163        echo Source directory $adr not found.; exit 1
164      endif
165      echo Adding source directory $adr
166      set SOURCEDIRS = ($SOURCEDIRS $adr)
167      set INCLUDEDIRS = ($INCLUDEDIRS $adr:s/src/inc/)
168    end
169    if (! $?PACKAGES) then
170      set PACKAGES=(`cd $ROOTDIR/pkg; ls -1 | grep -v CVS`)
171    endif
172    foreach dr ($PACKAGES)
173      set enable
174      foreach p ($DISABLE)
175       if ($dr == $p) unset enable
176       if ($p == 'all') unset enable
177      end
178      foreach p ($ENABLE)
179       if ($dr == $p) set enable
180      end
181      if ($?enable) then
182        set adr=$ROOTDIR/pkg/$dr
183        if (! -d $adr) then
184          echo Source directory $adr not found.; exit 1
185        endif
186        echo Adding package directory $adr
187        set SOURCEDIRS = ($SOURCEDIRS $adr)
188        set INCLUDEDIRS = ($INCLUDEDIRS $adr)
189      else
190        echo "*" Package \"$dr\" has not been enabled.
191      endif
192    end
193    
194  # This is the generic configuration.  # This is the generic configuration.
195  # Platform specific options are chosen below  # Platform specific options are chosen below
# Line 269  switch ($platform$USEMPI) Line 368  switch ($platform$USEMPI)
368      set CPP        = ( '/lib/cpp -traditional -P' )      set CPP        = ( '/lib/cpp -traditional -P' )
369      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )      set DEFINES    = ( ${DEFINES} '-DWORDLENGTH=4' )
370      set FC         = ( 'pgf77' )      set FC         = ( 'pgf77' )
371      set FFLAGS     = ( '-byteswapio' )      set FFLAGS     = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
372      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )      set FOPTIM     = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
373      set LINK       = ( 'pgf77' )      set LINK       = ( 'pgf77' )
374      breaksw      breaksw
# Line 361  foreach dr ($SOURCEDIRS) Line 460  foreach dr ($SOURCEDIRS)
460   if ($#deplist != 0) then   if ($#deplist != 0) then
461    echo "# These files are linked from $dr" >> srclinks.tmp    echo "# These files are linked from $dr" >> srclinks.tmp
462    echo $deplist':' >> srclinks.tmp    echo $deplist':' >> srclinks.tmp
463    echo '\t$(LN) '$dr'$@ $@' >> srclinks.tmp    echo '\t$(LN) '$dr'/$@ $@' >> srclinks.tmp
464   endif   endif
465  end  end
466  rm -rf .links.tmp  rm -rf .links.tmp
# Line 373  set THISHOSTNAME = ( `hostname` ) Line 472  set THISHOSTNAME = ( `hostname` )
472  set THISCWD = ( `pwd` )  set THISCWD = ( `pwd` )
473  set THISDATE = ( `date` )  set THISDATE = ( `date` )
474    
475    if (-r $mfile) mv -f $mfile $mfile.bak
476  ###########################################  ###########################################
477  ## This is the template for the makefile ##  ## This is the template for the makefile ##
478  ###########################################  ###########################################
479  echo Creating makefile: $mfile  echo Creating makefile: $mfile
480  echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}  echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}
481  echo "# This makefile was generated automatically pn" >> ${mfile}  echo "# This makefile was generated automatically on" >> ${mfile}
482  echo "#    $THISDATE" >> ${mfile}  echo "#    $THISDATE" >> ${mfile}
483  echo "# by the command:" >> ${mfile}  echo "# by the command:" >> ${mfile}
484  echo "#    ${0} $argv" >> ${mfile}  echo "#    ${0} $argv" >> ${mfile}
# Line 408  BUILDDIR    = ${BUILDDIR} Line 508  BUILDDIR    = ${BUILDDIR}
508  SOURCEDIRS  = ${SOURCEDIRS}  SOURCEDIRS  = ${SOURCEDIRS}
509  INCLUDEDIRS = ${INCLUDEDIRS}  INCLUDEDIRS = ${INCLUDEDIRS}
510  EXEDIR      = ${EXEDIR}  EXEDIR      = ${EXEDIR}
511  EXECUTABLE  = \$(EXEDIR)${EXECUTABLE}  EXECUTABLE  = \$(EXEDIR)/${EXECUTABLE}
512  TOOLSDIR    = ${TOOLSDIR}  TOOLSDIR    = ${TOOLSDIR}
513    
514  EOF  EOF
# Line 504  clean: Line 604  clean:
604  Clean:  Clean:
605          @make clean          @make clean
606          -find . -type l -exec rm {} \;          -find . -type l -exec rm {} \;
607          -rm Makefile.bak          -rm -f Makefile.bak
608  CLEAN:  CLEAN:
609          @make Clean          @make Clean
610          -find \$(ROOTDIR)/verification/*/input/ -name "*.meta" -exec rm {} \;          -find \$(ROOTDIR) -name "*.meta" -exec rm {} \;
611          -find \$(ROOTDIR)/verification/*/input/ -name "*.data" -exec rm {} \;          -find \$(ROOTDIR) -name "*.data" -exec rm {} \;
612          -rm \$(EXECUTABLE)          -rm -f \$(EXECUTABLE)
613    
614  # The normal chain of rules is (  .F - .f - .o  )  # The normal chain of rules is (  .F - .f - .o  )
615  .F.f:  .F.f:

Legend:
Removed from v.1.22.2.3  
changed lines
  Added in v.1.22.2.7

  ViewVC Help
Powered by ViewVC 1.1.22