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

Annotation of /MITgcm/tools/genmake

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


Revision 1.89 - (hide annotations) (download)
Thu Oct 23 04:41:41 2003 UTC (20 years, 6 months ago) by edhill
Branch: MAIN
CVS Tags: HEAD
Changes since 1.88: +1 -1 lines
FILE REMOVED
 o added the [#include "AD_CONFIG.h"] statement to all files that need
   it for adjoint/tl #defines
 o re-worked the build logic in genmake2 to support AD_CONFIG.h
 o removed tools/genmake since it no longer works

1 cnh 1.1 #!/bin/csh -f
2     #
3 edhill 1.89 # $Header: /u/u3/gcmpack/MITgcm/tools/genmake,v 1.88 2003/10/20 06:25:16 dimitri Exp $
4 adcroft 1.58 # $Name: $
5 cnh 1.1 #
6     # Makefile generator for MITgcm UV codes
7 adcroft 1.23 # created by cnh 03/98
8     # adapted by aja 06/98
9     # modified by aja 01/00
10    
11     # Default lists
12 stephd 1.87 if (! $?DISABLE) set DISABLE = ( aim aim_v23 autodiff cal cost ctrl ecco exf grdchk flt land ptracers seaice therm_seaice bulk_force dic gchem cfc )
13 adcroft 1.79 if (! $?ENABLE) set ENABLE = ( )
14     if (! $?DEFINES) set DEFINES = ( )
15     if (! $?MODS) set MODS = ( )
16 adcroft 1.23
17     # Grab variables/lists from .genmakerc
18     if (-r .genmakerc) source .genmakerc
19 cnh 1.1
20     # Process command-line arguments
21     set allargs=( $argv )
22     while ($#allargs)
23     set arg = $allargs[1]
24     switch ($arg)
25 adcroft 1.9 case -makefile:
26     set mfile = ( Makefile )
27     breaksw
28     case -makefile=*:
29     set mfile = ( `echo $arg | sed 's/-makefile=//' `)
30 cnh 1.1 breaksw
31     case -platform:
32     case -platform=:
33     echo "To change platform you must specify one with -platform="
34     echo "eg. -platform=sparc or -platform=mips"
35     exit
36     breaksw
37     case -platform*:
38 adcroft 1.23 if ($?platform) then
39     echo Option -platform=dir can only be specified once.; exit 1
40     endif
41 cnh 1.1 set platform = ( `echo $arg | sed 's/-platform=//' `)
42     breaksw
43 adcroft 1.23 case -rootdir:
44     case -rootdir=:
45     echo "To specify root directory you must specify one with -rootdir=dir"
46     echo "with NO space eg. -rootdir=../../.. or -rootdir=/usr/people/joe/src"
47     exit
48     breaksw
49     case -rootdir=*:
50     if ($?ROOTDIR) then
51     echo "***" Warning: variable \$ROOTDIR is already set to $ROOTDIR
52     echo "***" Command line \"$arg\" will override this.
53     endif
54     set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)
55     breaksw
56     case -mods:
57     case -mods=:
58     echo "To specify an additional source directory you must specify one with -mods=dir"
59     echo "with NO space eg. -mods=../code or -mods=/usr/people/joe/src"
60     exit
61     breaksw
62     case -mods=*:
63 adcroft 1.24 set MODS = ( $MODS `echo $arg | sed 's/-mods=//' | sed 's/,/ /g' `)
64 adcroft 1.23 breaksw
65     case -disable:
66     case -disable=:
67     echo "To disable packages from compilation use -disable=pkg1,pkg2"
68     echo "with NO spaces eg. -disable=kpp,gmredi or -disable=all (to enable all packages)"
69     exit
70     breaksw
71     case -disable=*:
72 adcroft 1.24 set DISABLE = ( $DISABLE `echo $arg | sed 's/-disable=//' | sed 's/,/ /g' `)
73 adcroft 1.23 breaksw
74     case -enable:
75     case -enable=:
76     echo "To enable packages from compilation use -enable=pkg1,pkg2"
77     echo "with NO spaces eg. -enable=aim or -enable=all (to enable all packages)"
78     echo "-enable overrides -disable, ie. a package listed in both is enabled"
79     exit
80     breaksw
81 adcroft 1.63 case -enable=*:
82     set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)
83     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 adcroft 1.40 case -ieee:
93     set IEEE
94     breaksw
95 cnh 1.1 case -mpi:
96     echo "Enabling MPI options"
97     set USEMPI
98     breaksw
99 adcroft 1.12 case -jam:
100     set include_jam_libs
101     echo "Including paths to JAM libraries"
102     breaksw
103 heimbach 1.84 case -arpack:
104     echo "Enabling ARPACK libraries"
105     set USEARPACK
106     breaksw
107 adcroft 1.63 case -fc:
108     case -fc=:
109     echo "To change the compiler (\$FC) you must specify one with -fc="
110     echo "eg. -fc=f90 or -fc=g77"
111     exit
112     breaksw
113     case -fc*:
114     if ($?FC) then
115     echo Option -fc=... can only be specified once.; exit 1
116     endif
117     set FC = ( `echo $arg | sed 's/-fc=//' `)
118     breaksw
119 cnh 1.1 case -help:
120 heimbach 1.84 echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-arpack] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]"
121 adcroft 1.35 cat << EOF
122    
123     $0 is used to generate the Makefile in the current directory.
124    
125     Typical invocations are:
126     o from "bin": ../tools/genmake
127     o from "verification/expt/code": ../../../tools/genmake
128     o from "verification/expt/input": ../../../tools/genmake -mods=../code
129     o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm
130     or ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods
131    
132     Packages (collected modules of code) can be disabled to avoid unnecessary
133     compilation of unused code. For instance if you know you will not
134     use GM/Redi, KPP and OBCS and they are appropriate turned-off in the
135     configuration:
136     .../tools/genmake -disable=gmredi,kpp,obcs
137    
138     If you add some source files you can re-call the previous instance of
139     genmake with "make makefile".
140    
141     genmake also reads the file .genmakerc which can be used to configure
142     options (primarily the command-line options above) for particular experiments.
143     EOF
144 cnh 1.1 exit
145     breaksw
146     default:
147     echo "Unknown command-line option: " $arg
148     echo $0 "-help to show usage"
149     exit
150     breaksw
151     endsw
152     shift allargs
153     end
154 cnh 1.6
155 adcroft 1.23 # Default actions/options
156    
157     # If platform wasn't specified then determine platform type of the host
158     if (! $?platform) then
159 cnh 1.6 set platform = (`uname`)
160 adcroft 1.55 # This let's us distinguish between different Linux platforms
161     if ($platform == Linux) then
162     set machine = (`uname -m`)
163     set platform = ($platform'-'$machine)
164     endif
165 cnh 1.6 endif
166 adcroft 1.23 # If name of makefile wasn't specified then use default "Makefile"
167     if (! $?mfile) set mfile = ( Makefile )
168    
169 cnh 1.1 set mach = ( `uname -a` )
170     echo Operating system: $mach
171    
172     # Directories for source, includes, binaries and executables
173 adcroft 1.23 #
174     # If -rootdir wasn't specified then assume script is being run from bin
175     # but if it was supplied then we should place the executable in the build dir
176     if (! $?ROOTDIR) then
177 adcroft 1.26 set pwd=`pwd`
178 adcroft 1.29 if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then
179     set ROOTDIR = ( .. )
180 adcroft 1.26 endif
181     endif
182     # Scan for logical ROOTDIR
183     if (! $?ROOTDIR) then
184     foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..)
185     if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then
186     set ROOTDIR = $dr
187     echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\"
188     break
189     endif
190     end
191     endif
192     if (! $?ROOTDIR) then
193     echo Root directory was not specified and could not be determined.
194     echo Specify the root location of the model source with -rootdir=dir
195     exit 1
196 adcroft 1.23 endif
197     if (! -d $ROOTDIR) then
198     echo Root directory $ROOTDIR not found.;exit 1
199     endif
200     # If -mods wasn't specified then we will assume that we can find all the
201     # source code in the standard directories
202     if (! $?MODS) then
203     set SOURCEDIRS = ( )
204 adcroft 1.42 set INCLUDEDIRS = ( )
205 adcroft 1.23 else
206     set SOURCEDIRS = ( $MODS )
207 adcroft 1.42 set INCLUDEDIRS = ( $MODS )
208 adcroft 1.23 endif
209     if (! $?BUILDDIR) set BUILDDIR = ( . )
210     if (! -d $BUILDDIR) then
211     echo Build directory $BUILDDIR not found.;exit 1
212 adcroft 1.29 endif
213     if (! $?EXEDIR) then
214     set pwd=`pwd`
215     if ($pwd:t == bin & -d ../exe & $ROOTDIR == ..) then
216     set EXEDIR = ( ../exe )
217     else
218     set EXEDIR = ( . )
219     endif
220 adcroft 1.23 endif
221     if (! -d $EXEDIR) then
222     echo Executable directory $EXEDIR not found.;exit 1
223     endif
224     if (! $?TOOLSDIR) set TOOLSDIR = ( $ROOTDIR/tools )
225     if (! -d $TOOLSDIR) then
226     echo Tools directory $TOOLSDIR not found.;exit 1
227     endif
228     if (! $?EXECUTABLE) set EXECUTABLE = ( mitgcmuv )
229    
230 adcroft 1.35 # We have a special set of source files in eesupp/src which
231     # are generated from some template source files. We'll make them
232     # first so the appear as regular source code
233     if (-r $ROOTDIR/eesupp/src/Makefile) then
234     echo Making source files in eesupp from templates...
235     (cd $ROOTDIR/eesupp/src/; make) >& make_eesupp.errs
236     if ($status == 0) then
237     rm -f make_eesupp.errs
238     else
239     cat make_eesupp.errs
240     exit 2
241     endif
242     endif
243    
244 adcroft 1.23 # Now scan the standard source code tree
245     foreach dr ($SOURCEDIRS)
246     set adr=$dr
247     if (! -d $adr) then
248     echo mods directory $adr not found.; exit 1
249     endif
250 adcroft 1.35 echo Adding mods dir: $adr
251 adcroft 1.23 end
252     if (! $?PACKAGES) then
253 adcroft 1.35 set PACKAGES=()
254 adcroft 1.67 foreach pkg (`cd $ROOTDIR/pkg; find . -type d -print | grep -v CVS | sed 's:\./::' | grep -v "\." | sort`)
255 adcroft 1.35 if (-d $ROOTDIR/pkg/$pkg) set PACKAGES=($PACKAGES $pkg)
256     end
257 adcroft 1.23 endif
258     foreach dr ($PACKAGES)
259     set enable
260     foreach p ($DISABLE)
261 adcroft 1.31 if ($p != 'all' & ! -d $ROOTDIR/pkg/$p) then
262 adcroft 1.30 echo Specified package \"$p\" does not exist.
263     exit 1
264     endif
265 adcroft 1.23 if ($dr == $p) unset enable
266     if ($p == 'all') unset enable
267 adcroft 1.35 # The following allows entire trees to be disabled
268     if ($dr:h == $p) unset enable
269     if ($dr:h:h == $p) unset enable
270     if ($dr:h:h:h == $p) unset enable
271     if ($dr:h:h:h:h == $p) unset enable
272 adcroft 1.23 end
273     foreach p ($ENABLE)
274     if ($dr == $p) set enable
275     end
276     if ($?enable) then
277     set adr=$ROOTDIR/pkg/$dr
278     if (! -d $adr) then
279     echo Source directory $adr not found.; exit 1
280     endif
281 adcroft 1.35 echo Adding pkg dir: $adr
282 adcroft 1.23 set SOURCEDIRS = ($SOURCEDIRS $adr)
283     set INCLUDEDIRS = ($INCLUDEDIRS $adr)
284 adcroft 1.62 switch ($dr)
285     case ptracers:
286     set DEFINES = ($DEFINES '-DALLOW_PTRACERS'); breaksw
287     default:
288     breaksw
289     endsw
290 adcroft 1.23 else
291 adcroft 1.35 echo " *" Package \"$dr\" NOT enabled.
292 adcroft 1.44 switch ($dr)
293     case mom_fluxform:
294     set DEFINES = ($DEFINES '-DDISABLE_MOM_FLUXFORM'); breaksw
295     case mom_vecinv:
296 adcroft 1.50 set DEFINES = ($DEFINES '-DDISABLE_MOM_VECINV'); breaksw
297 adcroft 1.54 case generic_advdiff:
298     set DEFINES = ($DEFINES '-DDISABLE_GENERIC_ADVDIFF'); breaksw
299 adcroft 1.66 case debug:
300     set DEFINES = ($DEFINES '-DDISABLE_DEBUGMODE'); breaksw
301 adcroft 1.44 default:
302     breaksw
303     endsw
304 adcroft 1.23 endif
305 adcroft 1.30 end
306 jmc 1.33 if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model)
307 adcroft 1.30 foreach dr ($STANDARDDIRS)
308     set adr=$ROOTDIR/$dr/src
309     if (! -d $adr) then
310     echo Source directory $adr not found.; exit 1
311     endif
312 adcroft 1.35 echo Adding src dir: $adr
313 adcroft 1.30 set SOURCEDIRS = ($SOURCEDIRS $adr)
314     set idr = `echo $adr | sed 's/src/inc/'`
315     set INCLUDEDIRS = ($INCLUDEDIRS $idr)
316 adcroft 1.23 end
317 cnh 1.1
318 adcroft 1.63 # Find possible compilers
319     if ($?FC) then
320     echo "$FC was specified as the compiler"
321     else
322     echo " "
323 adcroft 1.64 switch ($platform)
324     case Linux*:
325 adcroft 1.68 set likelysuspects=(g77 ifc pgf77 f77 f90 f95)
326 adcroft 1.64 breaksw
327     default:
328     set likelysuspects=(f77)
329     breaksw
330     endsw
331 adcroft 1.63 foreach fc ($likelysuspects)
332     set foundfc=`which $fc |& cat - `
333     if (-x $foundfc[1]) then
334     if ($?possiblefc) then
335     set possiblefc=($possiblefc $fc)
336     else
337     set possiblefc=$fc
338     endif
339     endif
340     end
341     if ($?possiblefc) then
342     set FC=$possiblefc[1]
343     echo Found these compilers: $possiblefc. Using \"$FC\" as the compiler
344     else
345     echo "No compiler found\!"
346     echo I tried looking for \"$likelysuspects\" in your \$PATH but found none
347 adcroft 1.65 echo I will continue anyway and see what happens.
348     set FC = ( 'f77' )
349     # exit 13
350 adcroft 1.63 endif
351     endif
352    
353 cnh 1.1 # This is the generic configuration.
354     # Platform specific options are chosen below
355 adcroft 1.23 set LN = ( 'ln -s' )
356 cnh 1.1 set CPP = ( '/lib/cpp -P' )
357 cnh 1.53 set S64 = ( '$(TOOLSDIR)/set64bitConst.sh' )
358 cnh 1.1 set KPP = ( )
359 adcroft 1.63 #set FC = ( 'f77' )
360     set LINK = $FC
361 heimbach 1.61 set MAKEDEPEND = ( 'makedepend' )
362 adcroft 1.42 set INCLUDES = ( -I. )
363 cnh 1.1 set FFLAGS = ( )
364     set FOPTIM = ( )
365 adcroft 1.51 set CFLAGS = ( )
366 cnh 1.1 set KFLAGS1 = ( )
367     set KFLAGS2 = ( )
368     set LIBS = ( )
369     set KPPFILES = ( )
370 jmc 1.76 if (! $?NOOPTFILES ) set NOOPTFILES = ( )
371     if (! $?NOOPTFLAGS ) set NOOPTFLAGS = ( )
372 cnh 1.1 set RMFILES = ( )
373    
374     # We often want to use different compile/link options is using MPI
375     if ($?USEMPI) then
376     set USEMPI = ( '+mpi' )
377     set DEFINES = ( ${DEFINES} '-DALLOW_USE_MPI -DALWAYS_USE_MPI' )
378     else
379     set USEMPI
380     # set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' )
381     endif
382    
383 heimbach 1.84 if ($?USEARPACK) then
384     set USEARPACK = ( '+arpack' )
385     set LIBS = ( '-L/usr/lib -larpack -llapack' )
386     else
387     set USEARPACK
388     endif
389    
390 cnh 1.1 # Platform specific options
391 heimbach 1.84 switch ($platform$USEMPI$USEARPACK)
392 adcroft 1.39 case OSF1+mpi:
393 heimbach 1.75 #ph: e.g. halem.gsfc.nasa.gov
394 adcroft 1.39 echo "Configuring for DEC Alpha with MPI"
395     set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
396 heimbach 1.75 #ph: -lkmp_osfp10 not needed on some/many platforms
397 cnh 1.6 case OSF1:
398 cnh 1.1 echo "Configuring for DEC Alpha"
399     set CPP = ( '/usr/bin/cpp -P' )
400 adcroft 1.10 set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' )
401 heimbach 1.75 set MAKEDEPEND = ( mkdep -f depend.out )
402     #ph: makedepend not available on some/many DEC Alpha's; use mkdep instead
403 adcroft 1.39 set KPP = ( )
404     set KPPFILES = ( )
405     set KFLAGS1 = ( )
406 cnh 1.1 set FC = ( 'f77' )
407 cnh 1.25 set FFLAGS = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' )
408 cnh 1.1 set FOPTIM = ( '-O5 -fast -tune host -inline all' )
409 heimbach 1.75 #ph: -O5 probably too aggressive in conjunction with adjoint code
410 cnh 1.1 set NOOPTFLAGS = ( '-O0' )
411 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
412 cnh 1.1 set RMFILES = ( '*.p.out' )
413     breaksw
414 cnh 1.6 case IRIX64+mpi:
415 cnh 1.1 echo "Configuring for SGI Mips with MPI"
416 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
417 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
418     set FC = ( 'mpif77' )
419     set LINK = ( 'mpif77' )
420 adcroft 1.11 set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
421 cnh 1.1 set FOPTIM = ( '-O3' )
422     set RMFILES = ( 'rii_files' )
423     breaksw
424 cnh 1.6 case IRIX64:
425 cnh 1.1 echo "Configuring for SGI Mips"
426 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
427 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
428 adcroft 1.35 set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' )
429 adcroft 1.11 set FOPTIM = ( '-O3' )
430 dimitri 1.73 if ($?IEEE) set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -static' )
431     if ($?IEEE) set FOPTIM = ( '-O0 -OPT:IEEE_arithmetic=1 -OPT:IEEE_NaN_inf=ON' )
432 cnh 1.1 set RMFILES = ( 'rii_files' )
433     breaksw
434 heimbach 1.20 case o2:
435     case IRIX:
436     echo "Configuring for SGI O2 running IRIX 6.5"
437     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
438     set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
439     set FOPTIM = ( '-O2' )
440     set NOOPTFLAGS = ( '-O0' )
441     breaksw
442     case o2+mpi:
443     case IRIX+mpi:
444     echo "Configuring for SGI O2 running IRIX 6.5 with MPI"
445     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
446     set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
447     set FOPTIM = ( '-O2' )
448     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
449     set NOOPTFLAGS = ( '-O0' )
450     set LIBS = ( '-lmpi' )
451     breaksw
452     case o2k+mpi:
453     echo "Configuring for SGI Origin2000 running IRIX 6.5"
454     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
455     set INCLUDES = ( '-I/usr/include' )
456     set FFLAGS = ( '-n32 -extend_source -bytereclen' )
457 dimitri 1.73 set FOPTIM = ( '-O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed' )
458 heimbach 1.20 set LIBS = ( '-lmpi -lscs' )
459 dimitri 1.73 breaksw
460     case o2k_noopt:
461     case o2k_noopt+mpi:
462     echo "Configuring for SGI Origin2000 running IRIX 6.5"
463     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
464     set INCLUDES = ( '-I/usr/include' )
465     set FFLAGS = ( '-n32 -extend_source -bytereclen' )
466     set FOPTIM = ( '-O0' )
467     set LIBS = ( '-lmpi' )
468 dimitri 1.74 breaksw
469     case ames_dbg+mpi:
470     echo "Configuring for SGI Origin2000 running IRIX 6.5"
471     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
472     set INCLUDES = ( '-I/usr/include -I/opt/mpt/1.6.1.beta/usr/include' )
473     set FFLAGS = ( '-n32 -extend_source -bytereclen' )
474     set LIBS = ( '-lmpi -lscs' )
475     set FC = ( 'f90' )
476     set LINK = ( 'f90' )
477     breaksw
478     case ames_opt+mpi:
479     echo "Configuring for SGI Origin2000 running IRIX 6.5"
480     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
481     set INCLUDES = ( '-I/usr/include -I/opt/mpt/1.6.1.beta/usr/include' )
482     set FFLAGS = ( '-n32 -extend_source -bytereclen' )
483     set FOPTIM = ( '-O3 -OPT:Olimit=0:roundoff=3:div_split=ON:alias=typed' )
484     set LIBS = ( '-lmpi -lscs' )
485     set FC = ( 'f90' )
486     set LINK = ( 'f90' )
487 heimbach 1.20 breaksw
488     case onyx:
489     case onyx+mpi:
490     echo "Configuring for SGI ONYX running IRIX64"
491     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
492     set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
493     set FOPTIM = ( '-O2' )
494     set NOOPTFLAGS = ( '-O0' )
495     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
496     set LIBS = ( '-lmpi' )
497     breaksw
498 cnh 1.6 case SunOS:
499 adcroft 1.23 set LN = ( '/usr/bin/ln -s' )
500 cnh 1.6 set CPP = ( '/usr/ccs/lib/cpp -P' )
501 heimbach 1.61 set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
502 cnh 1.52 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
503 heimbach 1.60 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
504 adcroft 1.51 set FOPTIM = ( '-dalign -O3 -xarch=v9' )
505     set CFLAGS = ( '-dalign -O3 -xarch=v9' )
506     set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
507     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F ini_cori.F mon_printstats_rl.F mon_printstats_rs.F aim_aim2dyn.F aim_dyn2aim.F aim_aim2dyn_exchanges.F aim_external_fields_load.F aim_calc_diags.F aim_external_forcing.F aim_do_atmos_physics.F aim_write_diags.F aim_do_inphys.F ')
508 cnh 1.6 breaksw
509     case SunOS+mpi:
510 adcroft 1.23 set LN = ( '/usr/bin/ln -s' )
511 cnh 1.1 set CPP = ( '/usr/ccs/lib/cpp -P' )
512 cnh 1.52 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4 -D_d=E' )
513 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
514     set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
515 heimbach 1.60 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar -xtypemap=real:64,double:64,integer:32 -fsimple=0' )
516 adcroft 1.51 set FOPTIM = ( '-dalign -O3 -xarch=v9' )
517     set NOOPTFLAGS = ( '-dalign -O0 -xarch=v9' )
518 cnh 1.6 '-lsocket -lnsl' )
519 heimbach 1.47 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F ini_cori.F mon_printstats_rl.F mon_printstats_rs.F')
520 mlosch 1.77 breaksw
521     case SunFire+mpi:
522     set FC = ( 'mpf77' )
523     set LINK = ( 'mpf77' )
524     set LN = ( '/usr/bin/ln -s' )
525     set CPP = ( '/usr/ccs/lib/cpp -P' )
526     set MAKEDEPEND = ( ${TOOLSDIR}/xmakedepend )
527     set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
528     set INCLUDES = ( '-I/opt/SUNWhpc/include' )
529     set LIBS = ( '-lmpi -lthread -lsocket -lnsl' )
530     set FFLAGS = ( '-e -u -noautopar ' \
531     '-xtypemap=real:64,double:64,integer:32 -fsimple=0' )
532     set FOPTIM = ( '-dalign -O4 -xarch=native' )
533     set CFLAGS = ( '-dalign -xO4 -xarch=native' )
534     set NOOPTFLAGS = ( '-dalign -O0 -xarch=native' )
535 cnh 1.3 breaksw
536 cnh 1.6 case IRIX32:
537 cnh 1.3 echo "Configuring for SGI ONYX running IRIX64"
538 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
539 cnh 1.3 set INCLUDES = ( '-I/usr/include' )
540     set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
541     set FOPTIM = ( '-O2' )
542     set NOOPTFLAGS = ( '-O0' )
543     set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
544 heimbach 1.20 'external_fields_load.F' )
545 cnh 1.3 set LIBS = ( '-lmpi' )
546     breaksw
547 adcroft 1.11 case HP-UX+mpi:
548     set FC = ( 'mpif77' )
549     set LINK = ( 'mpif77' )
550     set INCLUDES = ( '-I/opt/mpi/include' )
551 cnh 1.6 case HP-UX:
552 cnh 1.3 echo "Configuring for HP Exemplar"
553     set CPP = ( '/usr/ccs/lbin/cpp -P' )
554 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' )
555 cnh 1.3 set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \
556     '+Okernel_threads' )
557     set FOPTIM = ( '+O2' )
558 cnh 1.6 set NOOPTFLAGS = ( '+O0' )
559 cnh 1.3 set NOOPTFILES = ( 'barrier.F different_multiple.F' \
560 heimbach 1.20 'external_fields_load.F' )
561 dimitri 1.83 breaksw
562     case Linux-ia64+mpi:
563     echo "Configuring with MPI"
564     case Linux-ia64:
565     echo "Configuring for " $platform
566     set LN = ( '/bin/ln -s' )
567     set CPP = ( '/lib/cpp -traditional -P' )
568     set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
569     set FC = ( 'efc' )
570 dimitri 1.88 # set FFLAGS = ( '-WB -Vaxlib -u -w' )
571 dimitri 1.85 # set FOPTIM = ( '-O2 -ftz' )
572 dimitri 1.88 set FFLAGS = ( '-132 -i4 -w95 -W0 -WB' )
573 dimitri 1.85 set FOPTIM = ( '-O3 -mp' )
574 dimitri 1.83 set LINK = ( 'efc' )
575 dimitri 1.88 # set LIBS = ( '-lmpi -lscs -lpthread' )
576     set LIBS = ( '-lPEPCF90 -lmpi' )
577 cnh 1.1 breaksw
578 adcroft 1.55 case Linux-alpha+mpi:
579     echo "Configuring with MPI"
580     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
581     set INCLUDES = ( '-I/usr/local/include' )
582     case Linux-alpha:
583     echo "Configuring for " $platform
584     set LN = ( '/bin/ln -s' )
585     set CPP = ( '/lib/cpp -traditional -P' )
586     set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
587     set FC = ( 'g77' )
588     set FFLAGS = ( ' ' )
589     if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
590     set FOPTIM = ( '-ffast-math -fexpensive-optimizations -fomit-frame-pointer -O3' )
591     set LINK = ( 'g77' )
592     breaksw
593     case Linux*+pgi+mpi:
594 adcroft 1.15 if ($?include_jam_libs) then
595 adcroft 1.35 set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
596     set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' )
597 adcroft 1.15 else
598     set INCLUDES = ( '-I/usr/local/include' )
599     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
600     endif
601 adcroft 1.55 case Linux*+pgi:
602     echo "Configuring for " $platform
603 adcroft 1.23 set LN = ( '/bin/ln -s' )
604 adcroft 1.14 set CPP = ( '/lib/cpp -traditional -P' )
605 adcroft 1.10 set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
606 cnh 1.6 set FC = ( 'pgf77' )
607 adcroft 1.23 set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
608 cnh 1.6 set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
609     set LINK = ( 'pgf77' )
610 adcroft 1.56 breaksw
611     case Linux*+mpi:
612     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
613     set INCLUDES = ( '-I/usr/local/include' )
614     case Linux*:
615     echo "Configuring for " $platform
616     set LN = ( '/bin/ln -s' )
617     set CPP = ( '/lib/cpp -traditional -P' )
618 adcroft 1.63 switch ($FC)
619     case g77:
620     set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
621     set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' )
622     if ($?IEEE) set FFLAGS = ( $FFLAGS '-ffloat-store' )
623     set FOPTIM = ( '-O3 -malign-double -funroll-loops' )
624 jmc 1.76 set NOOPTFLAGS = ( '-O0' )
625 adcroft 1.63 breaksw
626     case pgf77:
627     set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
628     set FC = ( 'pgf77' )
629     set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
630     set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
631     breaksw
632     case ifc:
633     set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
634     set FFLAGS = ( '-132 -r8 -i4 -w95 -W0 -WB' )
635     if ($?IEEE) set FFLAGS = ( $FFLAGS '-mp' )
636     set FOPTIM = ( '-O3 -align' )
637     #P3 set FOPTIM = ( $FOPTIM '-tpp6 -xWKM' )
638     #P4 set FOPTIM = ( $FOPTIM '-tpp7 -xWKM' )
639 heimbach 1.84 set LIBS = ( ${LIBS} '-lPEPCF90' )
640 adcroft 1.63 breaksw
641     default:
642     echo Error: Linux compiler not recognized: \$FC=$FC
643     exit
644     breaksw
645     endsw
646 adcroft 1.13 breaksw
647     case T3E:
648     case sn6312:
649 adcroft 1.55 echo "Configuring for T3E"
650 adcroft 1.13 set CPP = ( '/opt/ctl/bin/cpp -P')
651     set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
652     set FC = ( 'f90' )
653     set LINK = ( 'f90' )
654     set FFLAGS = ( '-O 2,fusion' )
655 heimbach 1.18 breaksw
656     case T90:
657     case sn7113:
658 adcroft 1.55 echo "Configuring for T90"
659 heimbach 1.18 set FC = ( 'f90' )
660     set LINK = ( 'f90' )
661 adcroft 1.23 set LN = ( '/bin/ln -s' )
662 heimbach 1.19 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
663     set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
664     set FFLAGS = ( '-m3 -Rabc -N 132')
665 heimbach 1.18 set FOPTIM = ( '-O0' )
666     set NOOPTFLAGS = ( '-O0' )
667 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
668 heimbach 1.18 breaksw
669     case SV1:
670     case sn3002:
671     set FC = ( 'f90' )
672     set LINK = ( 'f90' )
673 adcroft 1.23 set LN = ( '/bin/ln -s' )
674 heimbach 1.19 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
675     set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
676     set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132')
677 heimbach 1.18 set FOPTIM = ( '-O0' )
678     set NOOPTFLAGS = ( '-O0' )
679 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
680 cheisey 1.70 breaksw
681     case cg01+pgi:
682     set LN = ( '/bin/ln -s' )
683     set CPP = ( '/lib/cpp -traditional -P' )
684     set INCLUDES = ( '-I/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/include' )
685     set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
686     set FC = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
687     set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
688     # set LIBS = ( '-L/home/cnh/src/gm-1.4/libgm')
689     set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
690     set LINK = ( '/usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpif77' )
691 heimbach 1.57 breaksw
692     case SP3:
693     # originally from A. Biastoch, SIO.
694 heimbach 1.75 # e.g. horizon.npaci.edu
695 heimbach 1.57 echo "Configuring for IBM SP POWER3"
696     set SOURCEDIRS = ( ./ $SOURCEDIRS )
697     set LN = ( 'ln -s' )
698     set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
699     set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' )
700     # set CPP = ( '/lib/cpp' )
701     set FC = ( 'mpxlf95' )
702     set LINK = ( 'mpxlf95' )
703     set FLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
704     '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
705     set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
706     '-bmaxdata:0x80000000 ' )
707     set LDFLAGS = ( '-O3 -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1' \
708 heimbach 1.75 '-bmaxdata:0x80000000' )
709     set LIBS = ( ' -L/usr/local/apps/mass -lmass' )
710     # set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
711     # set FOPTIM = ( '-O3' )
712     # set NOOPTFLAGS = ( '-O0' )
713     # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
714     # 'external_fields_load.F' )
715     set RMFILES = ( 'rii_files' )
716     breaksw
717     case SP4:
718     #ph: e.g. bluesky.ucar.edu, marcellus.navo.hpc.mil
719     echo "Configuring for IBM SP POWER4"
720     set SOURCEDIRS = ( ./ $SOURCEDIRS )
721     set LN = ( 'ln -s' )
722     set DEFINES = ( ${DEFINES} '-DTARGET_PWR3 -DTARGET_SGI -DWORDLENGTH=4' )
723     set INCLUDES = ( '-I/usr/lpp/ppe.poe/include' )
724     # set CPP = ( '/lib/cpp' )
725     set FC = ( 'mpxlf95' )
726     set LINK = ( 'mpxlf95' )
727     set FLAGS = ( '-O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
728     '-bmaxdata:0x80000000 -bloadmap:mitgcmuv.map' )
729     set FFLAGS = ( '-qfixed=132 -O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
730     '-bmaxdata:0x80000000 ' )
731     set LDFLAGS = ( '-O3 -qarch=pwr4 -qtune=pwr4 -qcache=auto -qmaxmem=-1' \
732 heimbach 1.57 '-bmaxdata:0x80000000' )
733 heimbach 1.61 set LIBS = ( ' -L/usr/local/apps/mass -lmass' )
734 heimbach 1.57 # set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
735     # set FOPTIM = ( '-O3' )
736     # set NOOPTFLAGS = ( '-O0' )
737     # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
738     # 'external_fields_load.F' )
739     set RMFILES = ( 'rii_files' )
740 heimbach 1.78 breaksw
741     case aer-linux-cluster+mpi
742     echo "Configuring for " $platform
743     set LN = ( '/bin/ln -s' )
744     set CPP = ( '/lib/cpp -traditional -P' )
745     set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
746     set FC = ( '/opt/mpich/bin/mpif77' )
747     set LINK = ( '/opt/mpich/bin/mpif77' )
748     set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
749     set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
750     set LIBS = ( '-L/opt/mpich/lib/ -lfmpich -lmpich' )
751     set INCLUDES = ( '-I/opt/mpich/include' )
752 heimbach 1.84 breaksw
753     case gfdl-sgi-o3k
754     echo "Configuring for " $platform
755     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
756     set FFLAGS = ( 'extend_source -mp -mpio -bytereclen -mips4 -r8 -static' )
757     set FOPTIM = ( '-O3' )
758     set LIBS = ( '-lmpi' )
759     set INCLUDES = ( '-I/opt/mpt/1510/usr/include' )
760     breaksw
761     default:
762     echo "Error: platform not recognized: uname -p = " $platform$USEMPI
763     exit
764 cnh 1.6 breaksw
765 cnh 1.1 default:
766     echo "Error: platform not recognized: uname -p = " $platform$USEMPI
767     exit
768     breaksw
769     endsw
770    
771     ###############################################################################
772     ## ##
773     ## Everything below here should not need to be changed. Platform specific ##
774     ## changes and code specific changes should be configured above this line. ##
775     ## ##
776     ###############################################################################
777    
778     # Convert lists of directories into command-line options
779     foreach inc ($INCLUDEDIRS)
780     set INCLUDES = ($INCLUDES -I$inc)
781     end
782 adcroft 1.23
783     # Search for source code
784     rm -rf .links.tmp;mkdir .links.tmp
785     echo "# This section creates symbolic links" > srclinks.tmp
786     echo "" >> srclinks.tmp
787     echo -n 'SRCFILES = ' > srclist.inc
788     echo -n 'CSRCFILES = ' > csrclist.inc
789 adcroft 1.41 echo -n 'HEADERFILES = ' > hlist.inc
790 adcroft 1.42 foreach dr ($SOURCEDIRS $INCLUDEDIRS .)
791 adcroft 1.23 set deplist=( )
792     foreach srcfile (`cd $dr; ls *.[hcF]`)
793     if (! -r .links.tmp/$srcfile) then
794     if (-f $dr/$srcfile) then
795     switch ($srcfile:e)
796     case F:
797     touch .links.tmp/$srcfile
798     set deplist=($deplist $srcfile)
799     echo ' \' >> srclist.inc
800     echo -n " " $srcfile >> srclist.inc
801     breaksw
802     case c:
803     touch .links.tmp/$srcfile
804     set deplist=($deplist $srcfile)
805     echo ' \' >> csrclist.inc
806     echo -n " " $srcfile >> csrclist.inc
807     breaksw
808     case h:
809 adcroft 1.41 touch .links.tmp/$srcfile
810     set deplist=($deplist $srcfile)
811     echo ' \' >> hlist.inc
812     echo -n " " $srcfile >> hlist.inc
813 adcroft 1.23 breaksw
814     endsw
815     endif
816     endif
817     end
818     if ($#deplist != 0) then
819     echo "# These files are linked from $dr" >> srclinks.tmp
820     echo $deplist':' >> srclinks.tmp
821     echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp
822     endif
823 cnh 1.1 end
824 adcroft 1.23 rm -rf .links.tmp
825     echo "" >> srclist.inc
826     echo "" >> csrclist.inc
827 adcroft 1.41 echo "" >> hlist.inc
828 cnh 1.1
829     set THISHOSTNAME = ( `hostname` )
830     set THISCWD = ( `pwd` )
831     set THISDATE = ( `date` )
832    
833 adcroft 1.23 if (-r $mfile) mv -f $mfile $mfile.bak
834 cnh 1.1 ###########################################
835     ## This is the template for the makefile ##
836     ###########################################
837     echo Creating makefile: $mfile
838     echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}
839 adcroft 1.23 echo "# This makefile was generated automatically on" >> ${mfile}
840 cnh 1.1 echo "# $THISDATE" >> ${mfile}
841     echo "# by the command:" >> ${mfile}
842     echo "# ${0} $argv" >> ${mfile}
843     echo "# executed by:" >> ${mfile}
844     echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> ${mfile}
845     cat >> ${mfile} <<EOF
846     #
847     # BUILDDIR : Directory where object files are written
848     # SOURCEDIRS : Directories containing the source (.F) files
849     # INCLUDEDIRS : Directories containing the header-source (.h) files
850     # EXEDIR : Directory where executable that is generated is written
851     # EXECUTABLE : Full path of executable binary
852     #
853     # CPP : C-preprocessor command
854     # INCLUDES : Directories searched for header files
855     # DEFINES : Macro definitions for CPP
856 heimbach 1.61 # MAKEDEPEND : Dependency generator
857 cnh 1.1 # KPP : Special preprocessor command (specific to platform)
858     # KFLAGS : Flags for KPP
859     # FC : Fortran compiler command
860     # FFLAGS : Configuration/debugging options for FC
861     # FOPTIM : Optimization options for FC
862     # LINK : Command for link editor program
863     # LIBS : Library flags /or/ additional optimization/debugging flags
864    
865 adcroft 1.23 ROOTDIR = ${ROOTDIR}
866     BUILDDIR = ${BUILDDIR}
867     SOURCEDIRS = ${SOURCEDIRS}
868 cnh 1.1 INCLUDEDIRS = ${INCLUDEDIRS}
869 adcroft 1.23 EXEDIR = ${EXEDIR}
870     EXECUTABLE = \$(EXEDIR)/${EXECUTABLE}
871     TOOLSDIR = ${TOOLSDIR}
872 cnh 1.1
873 adcroft 1.12 EOF
874    
875    
876     # JAM libraries on Hyades
877     if ($?include_jam_libs) then
878     cat >> ${mfile} <<EOF
879     # extra stuff for Hyades ............................................
880     HYADES_DIR = /u/u0/cnh/jam-lib/software
881 adcroft 1.16 HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
882 adcroft 1.35 HYADES_DIR = /usr/local/jamlib/current/dual_proc
883 adcroft 1.12 WORK_DIR = \$(HYADES_DIR)
884     DEPOSIT_DIR = linux_bin
885    
886     STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR)
887     STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \
888     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \
889     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \
890     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o
891    
892     JAMOBJDIR = jam/\$(DEPOSIT_DIR)
893     JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \
894     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \
895     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \
896     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \
897     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o
898    
899     JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR)
900     JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o
901    
902     XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ)
903    
904     # ..................................................................
905    
906     EOF
907     endif
908    
909    
910     cat >> ${mfile} <<EOF
911 cnh 1.1 # Unix ln (link)
912     LN = ${LN}
913     # C preprocessor
914 cnh 1.52 CPP = cat \$< | ${S64} | ${CPP}
915 heimbach 1.61 # Dependency generator
916     MAKEDEPEND = ${MAKEDEPEND}
917 cnh 1.1 # Special preprocessor (KAP on DECs, FPP on Crays)
918     KPP = ${KPP}
919     # Fortran compiler
920     FC = ${FC}
921     # Link editor
922     LINK = ${LINK}
923    
924     # Defines for CPP
925     DEFINES = ${DEFINES}
926     # Includes for CPP
927     INCLUDES = ${INCLUDES}
928     # Flags for KPP
929     KFLAGS1 = ${KFLAGS1}
930     KFLAGS2 = ${KFLAGS2}
931     # Optim./debug for FC
932     FFLAGS = ${FFLAGS}
933     FOPTIM = ${FOPTIM}
934 adcroft 1.51 # Flags for CC
935     CFLAGS = ${CFLAGS}
936 cnh 1.1 # Files that should not be optimized
937     NOOPTFILES = ${NOOPTFILES}
938     NOOPTFLAGS = ${NOOPTFLAGS}
939     # Flags and libraries needed for linking
940 adcroft 1.15 LIBS = ${LIBS} \$(XLIBS)
941 cnh 1.1
942     EOF
943    
944 heimbach 1.19 cat srclist.inc >> ${mfile}
945     cat csrclist.inc >> ${mfile}
946 adcroft 1.41 cat hlist.inc >> ${mfile}
947 heimbach 1.19 echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile}
948     echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
949    
950 adcroft 1.43 rm -f srclist.inc csrclist.inc hlist.inc flist.tmp clist.tmp
951 cnh 1.1
952     cat >> ${mfile} <<EOF
953    
954     .SUFFIXES:
955 cnh 1.5 .SUFFIXES: .o .f .p .F .c
956 cnh 1.1
957     all: \$(EXECUTABLE)
958     \$(EXECUTABLE): \$(OBJFILES)
959     \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
960     depend:
961     @make links
962 heimbach 1.61 \$(MAKEDEPEND) -o .f \$(DEFINES) \$(INCLUDES) \$(SRCFILES)
963 adcroft 1.32
964 adcroft 1.41 links: \$(SRCFILES) \$(CSRCFILES) \$(HEADERFILES)
965 heimbach 1.46
966     small_f: \$(F77FILES)
967 heimbach 1.19
968 adcroft 1.45 output.txt: \$(EXECUTABLE)
969 adcroft 1.48 @printf 'running ... '
970 adcroft 1.45 @\$(EXECUTABLE) > \$@
971 heimbach 1.19
972 cnh 1.1 clean:
973 adcroft 1.63 -rm -rf *.o *.f *.p ${RMFILES} work.{pc,pcl}
974 cnh 1.6 Clean:
975     @make clean
976 adcroft 1.32 @make cleanlinks
977 adcroft 1.23 -rm -f Makefile.bak
978 adcroft 1.12 CLEAN:
979     @make Clean
980 adcroft 1.28 -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
981     -find \$(EXEDIR) -name "*.data" -exec rm {} \;
982 adcroft 1.80 -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
983 adcroft 1.23 -rm -f \$(EXECUTABLE)
984 adcroft 1.32
985     makefile:
986     ${0} $argv
987     cleanlinks:
988     -find . -type l -exec rm {} \;
989 cnh 1.1
990     # The normal chain of rules is ( .F - .f - .o )
991     .F.f:
992 cnh 1.6 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
993 cnh 1.1 .f.o:
994     \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
995 adcroft 1.51 .c.o:
996     \$(CC) \$(CFLAGS) -c \$<
997 cnh 1.1
998     # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
999     .F.p:
1000 cnh 1.6 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
1001 cnh 1.1 .p.f:
1002     \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
1003     EOF
1004    
1005     # Make list of "exceptions" that need ".p" files
1006     foreach sf ($KPPFILES)
1007     set fname=( ${sf:t} )
1008     echo "${fname:r}.f: ${fname:r}.p" >> ${mfile}
1009     end
1010     foreach sf ($NOOPTFILES)
1011     set fname=( ${sf:t} )
1012     echo "${fname:r}.o: ${fname:r}.f" >> ${mfile}
1013     echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile}
1014     end
1015 adcroft 1.23 echo "" >> ${mfile}
1016    
1017     # Add rules for links
1018     cat srclinks.tmp >> ${mfile}
1019     rm -f srclinks.tmp
1020    
1021     echo "" >> ${mfile}
1022 cnh 1.1 echo "# DO NOT DELETE" >> ${mfile}
1023    
1024     exit

  ViewVC Help
Powered by ViewVC 1.1.22