/[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.36 - (hide annotations) (download)
Mon Jun 4 19:47:32 2001 UTC (22 years, 9 months ago) by adcroft
Branch: MAIN
Changes since 1.35: +4 -4 lines
Added ini_spherical_polar_grid.F to NOOPTFILES for new SUNs.

1 cnh 1.1 #!/bin/csh -f
2     #
3 adcroft 1.36 # $Header: /u/gcmpack/models/MITgcmUV/tools/genmake,v 1.35 2001/05/29 14:01:40 adcroft Exp $
4     # $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 heimbach 1.34 set DISABLE = ( aim autodiff cal cost ctrl ecco exf )
13 adcroft 1.23 set ENABLE = ( )
14     set MODS = ( )
15    
16     # Grab variables/lists from .genmakerc
17     if (-r .genmakerc) source .genmakerc
18 cnh 1.1
19     # Process command-line arguments
20     set allargs=( $argv )
21     while ($#allargs)
22     set arg = $allargs[1]
23     switch ($arg)
24 adcroft 1.9 case -makefile:
25     set mfile = ( Makefile )
26     breaksw
27     case -makefile=*:
28     set mfile = ( `echo $arg | sed 's/-makefile=//' `)
29 cnh 1.1 breaksw
30     case -platform:
31     case -platform=:
32     echo "To change platform you must specify one with -platform="
33     echo "eg. -platform=sparc or -platform=mips"
34     exit
35     breaksw
36     case -platform*:
37 adcroft 1.23 if ($?platform) then
38     echo Option -platform=dir can only be specified once.; exit 1
39     endif
40 cnh 1.1 set platform = ( `echo $arg | sed 's/-platform=//' `)
41     breaksw
42 adcroft 1.23 case -rootdir:
43     case -rootdir=:
44     echo "To specify root directory you must specify one with -rootdir=dir"
45     echo "with NO space eg. -rootdir=../../.. or -rootdir=/usr/people/joe/src"
46     exit
47     breaksw
48     case -rootdir=*:
49     if ($?ROOTDIR) then
50     echo "***" Warning: variable \$ROOTDIR is already set to $ROOTDIR
51     echo "***" Command line \"$arg\" will override this.
52     endif
53     set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)
54     breaksw
55     case -mods:
56     case -mods=:
57     echo "To specify an additional source directory you must specify one with -mods=dir"
58     echo "with NO space eg. -mods=../code or -mods=/usr/people/joe/src"
59     exit
60     breaksw
61     case -mods=*:
62 adcroft 1.24 set MODS = ( $MODS `echo $arg | sed 's/-mods=//' | sed 's/,/ /g' `)
63 adcroft 1.23 breaksw
64     case -disable:
65     case -disable=:
66     echo "To disable packages from compilation use -disable=pkg1,pkg2"
67     echo "with NO spaces eg. -disable=kpp,gmredi or -disable=all (to enable all packages)"
68     exit
69     breaksw
70     case -disable=*:
71 adcroft 1.24 set DISABLE = ( $DISABLE `echo $arg | sed 's/-disable=//' | sed 's/,/ /g' `)
72 adcroft 1.23 breaksw
73     case -enable:
74     case -enable=:
75     echo "To enable packages from compilation use -enable=pkg1,pkg2"
76     echo "with NO spaces eg. -enable=aim or -enable=all (to enable all packages)"
77     echo "-enable overrides -disable, ie. a package listed in both is enabled"
78     exit
79     breaksw
80     case -enable=*:
81 adcroft 1.24 set ENABLE = ( $ENABLE `echo $arg | sed 's/-enable=//' | sed 's/,/ /g' `)
82 adcroft 1.23 breaksw
83 cnh 1.1 case -mpi:
84     echo "Enabling MPI options"
85     set USEMPI
86     breaksw
87 adcroft 1.12 case -jam:
88     set include_jam_libs
89     echo "Including paths to JAM libraries"
90     breaksw
91 cnh 1.1 case -help:
92 adcroft 1.35 echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi] [-jam] [-disable=pkg1[,pkg2,...]] [-enable=pkg1[,pkg2,...]] [-mods=dir1[,dir2,...]] [-rootdir=dir]"
93     cat << EOF
94    
95     $0 is used to generate the Makefile in the current directory.
96    
97     Typical invocations are:
98     o from "bin": ../tools/genmake
99     o from "verification/expt/code": ../../../tools/genmake
100     o from "verification/expt/input": ../../../tools/genmake -mods=../code
101     o from a scratch directory: ~/mitgcm/tools/genmake -rootdir=~/mitgcm
102     or ~/mitgcm/tools/genmake -rootdir=~/mitgcm -mods=~/mymods
103    
104     Packages (collected modules of code) can be disabled to avoid unnecessary
105     compilation of unused code. For instance if you know you will not
106     use GM/Redi, KPP and OBCS and they are appropriate turned-off in the
107     configuration:
108     .../tools/genmake -disable=gmredi,kpp,obcs
109    
110     If you add some source files you can re-call the previous instance of
111     genmake with "make makefile".
112    
113     genmake also reads the file .genmakerc which can be used to configure
114     options (primarily the command-line options above) for particular experiments.
115     EOF
116 cnh 1.1 exit
117     breaksw
118     default:
119     echo "Unknown command-line option: " $arg
120     echo $0 "-help to show usage"
121     exit
122     breaksw
123     endsw
124     shift allargs
125     end
126 cnh 1.6
127 adcroft 1.23 # Default actions/options
128    
129     # If platform wasn't specified then determine platform type of the host
130     if (! $?platform) then
131 cnh 1.6 set platform = (`uname`)
132     endif
133 adcroft 1.23 # If name of makefile wasn't specified then use default "Makefile"
134     if (! $?mfile) set mfile = ( Makefile )
135    
136 cnh 1.1 set mach = ( `uname -a` )
137     echo Operating system: $mach
138    
139     # Directories for source, includes, binaries and executables
140 adcroft 1.23 #
141     # If -rootdir wasn't specified then assume script is being run from bin
142     # but if it was supplied then we should place the executable in the build dir
143     if (! $?ROOTDIR) then
144 adcroft 1.26 set pwd=`pwd`
145 adcroft 1.29 if ($pwd:t == bin & -d ../model & -d ../eesupp & -d ../pkg) then
146     set ROOTDIR = ( .. )
147 adcroft 1.26 endif
148     endif
149     # Scan for logical ROOTDIR
150     if (! $?ROOTDIR) then
151     foreach dr (. .. ../.. ../../.. ../../../.. ../../../../..)
152     if (-d $dr/model & -d $dr/eesupp & -d $dr/pkg) then
153     set ROOTDIR = $dr
154     echo ROOTDIR was not specified. Setting ROOTDIR = \"$ROOTDIR\"
155     break
156     endif
157     end
158     endif
159     if (! $?ROOTDIR) then
160     echo Root directory was not specified and could not be determined.
161     echo Specify the root location of the model source with -rootdir=dir
162     exit 1
163 adcroft 1.23 endif
164     if (! -d $ROOTDIR) then
165     echo Root directory $ROOTDIR not found.;exit 1
166     endif
167     # If -mods wasn't specified then we will assume that we can find all the
168     # source code in the standard directories
169     if (! $?MODS) then
170     set SOURCEDIRS = ( )
171     set INCLUDEDIRS = ( . )
172     else
173     set SOURCEDIRS = ( $MODS )
174     set INCLUDEDIRS = ( . $MODS )
175     endif
176     if (! $?BUILDDIR) set BUILDDIR = ( . )
177     if (! -d $BUILDDIR) then
178     echo Build directory $BUILDDIR not found.;exit 1
179 adcroft 1.29 endif
180     if (! $?EXEDIR) then
181     set pwd=`pwd`
182     if ($pwd:t == bin & -d ../exe & $ROOTDIR == ..) then
183     set EXEDIR = ( ../exe )
184     else
185     set EXEDIR = ( . )
186     endif
187 adcroft 1.23 endif
188     if (! -d $EXEDIR) then
189     echo Executable directory $EXEDIR not found.;exit 1
190     endif
191     if (! $?TOOLSDIR) set TOOLSDIR = ( $ROOTDIR/tools )
192     if (! -d $TOOLSDIR) then
193     echo Tools directory $TOOLSDIR not found.;exit 1
194     endif
195     if (! $?EXECUTABLE) set EXECUTABLE = ( mitgcmuv )
196    
197 adcroft 1.35 # We have a special set of source files in eesupp/src which
198     # are generated from some template source files. We'll make them
199     # first so the appear as regular source code
200     if (-r $ROOTDIR/eesupp/src/Makefile) then
201     echo Making source files in eesupp from templates...
202     (cd $ROOTDIR/eesupp/src/; make) >& make_eesupp.errs
203     if ($status == 0) then
204     rm -f make_eesupp.errs
205     else
206     cat make_eesupp.errs
207     exit 2
208     endif
209     endif
210    
211 adcroft 1.23 # Now scan the standard source code tree
212     foreach dr ($SOURCEDIRS)
213     set adr=$dr
214     if (! -d $adr) then
215     echo mods directory $adr not found.; exit 1
216     endif
217 adcroft 1.35 echo Adding mods dir: $adr
218 adcroft 1.23 end
219     if (! $?PACKAGES) then
220 adcroft 1.35 set PACKAGES=()
221     foreach pkg (`cd $ROOTDIR/pkg; find . -type d | grep -v CVS | sed 's:\./::' | grep -v "\." | sort`)
222     if (-d $ROOTDIR/pkg/$pkg) set PACKAGES=($PACKAGES $pkg)
223     end
224 adcroft 1.23 endif
225     foreach dr ($PACKAGES)
226     set enable
227     foreach p ($DISABLE)
228 adcroft 1.31 if ($p != 'all' & ! -d $ROOTDIR/pkg/$p) then
229 adcroft 1.30 echo Specified package \"$p\" does not exist.
230     exit 1
231     endif
232 adcroft 1.23 if ($dr == $p) unset enable
233     if ($p == 'all') unset enable
234 adcroft 1.35 # The following allows entire trees to be disabled
235     if ($dr:h == $p) unset enable
236     if ($dr:h:h == $p) unset enable
237     if ($dr:h:h:h == $p) unset enable
238     if ($dr:h:h:h:h == $p) unset enable
239 adcroft 1.23 end
240     foreach p ($ENABLE)
241     if ($dr == $p) set enable
242     end
243     if ($?enable) then
244     set adr=$ROOTDIR/pkg/$dr
245     if (! -d $adr) then
246     echo Source directory $adr not found.; exit 1
247     endif
248 adcroft 1.35 echo Adding pkg dir: $adr
249 adcroft 1.23 set SOURCEDIRS = ($SOURCEDIRS $adr)
250     set INCLUDEDIRS = ($INCLUDEDIRS $adr)
251     else
252 adcroft 1.35 echo " *" Package \"$dr\" NOT enabled.
253 adcroft 1.23 endif
254 adcroft 1.30 end
255 jmc 1.33 if (! $?STANDARDDIRS) set STANDARDDIRS=(eesupp model)
256 adcroft 1.30 foreach dr ($STANDARDDIRS)
257     set adr=$ROOTDIR/$dr/src
258     if (! -d $adr) then
259     echo Source directory $adr not found.; exit 1
260     endif
261 adcroft 1.35 echo Adding src dir: $adr
262 adcroft 1.30 set SOURCEDIRS = ($SOURCEDIRS $adr)
263     set idr = `echo $adr | sed 's/src/inc/'`
264     set INCLUDEDIRS = ($INCLUDEDIRS $idr)
265 adcroft 1.23 end
266 cnh 1.1
267     # This is the generic configuration.
268     # Platform specific options are chosen below
269 adcroft 1.23 set LN = ( 'ln -s' )
270 cnh 1.1 set CPP = ( '/lib/cpp -P' )
271     set KPP = ( )
272     set FC = ( 'f77' )
273     set LINK = ( 'f77' )
274     set DEFINES = ( )
275     set INCLUDES = ( )
276     set FFLAGS = ( )
277     set FOPTIM = ( )
278     set KFLAGS1 = ( )
279     set KFLAGS2 = ( )
280     set LIBS = ( )
281     set KPPFILES = ( )
282     set NOOPTFILES = ( )
283     set NOOPTFLAGS = ( )
284     set RMFILES = ( )
285    
286     # We often want to use different compile/link options is using MPI
287     if ($?USEMPI) then
288     set USEMPI = ( '+mpi' )
289     set DEFINES = ( ${DEFINES} '-DALLOW_USE_MPI -DALWAYS_USE_MPI' )
290     else
291     set USEMPI
292     # set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' )
293     endif
294    
295     # Platform specific options
296     switch ($platform$USEMPI)
297 cnh 1.6 case OSF1:
298     case OSF1+mpi:
299 cnh 1.1 echo "Configuring for DEC Alpha"
300     set CPP = ( '/usr/bin/cpp -P' )
301 adcroft 1.10 set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' )
302 cnh 1.1 set KPP = ( 'kapf' )
303 cnh 1.4 set KPPFILES = ( 'main.F' )
304 cnh 1.1 set KFLAGS1 = ( '-scan=132 -noconc -cmp=' )
305     set FC = ( 'f77' )
306 cnh 1.25 set FFLAGS = ( '-convert big_endian -r8 -extend_source -automatic -call_shared -notransform_loops -align dcommons' )
307 cnh 1.1 set FOPTIM = ( '-O5 -fast -tune host -inline all' )
308     set NOOPTFLAGS = ( '-O0' )
309     set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
310 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
311 cnh 1.1 set RMFILES = ( '*.p.out' )
312     breaksw
313 cnh 1.6 case IRIX64+mpi:
314 cnh 1.1 echo "Configuring for SGI Mips with MPI"
315 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
316 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
317     set FC = ( 'mpif77' )
318     set LINK = ( 'mpif77' )
319 adcroft 1.11 set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
320 cnh 1.1 set FOPTIM = ( '-O3' )
321     set RMFILES = ( 'rii_files' )
322     breaksw
323 cnh 1.6 case IRIX64:
324 cnh 1.1 echo "Configuring for SGI Mips"
325 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
326 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
327 adcroft 1.35 set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4 -r8 -static' )
328 adcroft 1.11 set FOPTIM = ( '-O3' )
329     # set NOOPTFLAGS = ( '-O0' )
330     # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
331 heimbach 1.20 # 'external_fields_load.F' )
332 cnh 1.1 set RMFILES = ( 'rii_files' )
333     breaksw
334 heimbach 1.20 case o2:
335     case IRIX:
336     echo "Configuring for SGI O2 running IRIX 6.5"
337     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
338     set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
339     set FOPTIM = ( '-O2' )
340     set NOOPTFLAGS = ( '-O0' )
341     breaksw
342     case o2+mpi:
343     case IRIX+mpi:
344     echo "Configuring for SGI O2 running IRIX 6.5 with MPI"
345     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
346     set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
347     set FOPTIM = ( '-O2' )
348     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
349     set NOOPTFLAGS = ( '-O0' )
350     set LIBS = ( '-lmpi' )
351     breaksw
352     case o2k+mpi:
353     echo "Configuring for SGI Origin2000 running IRIX 6.5"
354     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
355     set INCLUDES = ( '-I/usr/include' )
356     set FFLAGS = ( '-n32 -extend_source -bytereclen' )
357     set FOPTIM = ( '-O2' )
358     set NOOPTFILES = ( 'calc_mom_rhs.F' )
359     set NOOPTFLAGS = ( '-O1' )
360     set LIBS = ( '-lmpi -lscs' )
361     breaksw
362     case onyx:
363     case onyx+mpi:
364     echo "Configuring for SGI ONYX running IRIX64"
365     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
366     set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
367     set FOPTIM = ( '-O2' )
368     set NOOPTFLAGS = ( '-O0' )
369     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
370     set LIBS = ( '-lmpi' )
371     breaksw
372 cnh 1.6 case SunOS:
373 adcroft 1.23 set LN = ( '/usr/bin/ln -s' )
374 cnh 1.6 set CPP = ( '/usr/ccs/lib/cpp -P' )
375 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
376 cnh 1.6 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar')
377 heimbach 1.20 set FOPTIM = ( '-fast -O3' )
378 cnh 1.6 set NOOPTFLAGS = ( '-O0' )
379 adcroft 1.36 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F')
380 cnh 1.6 breaksw
381     case SunOS+mpi:
382 adcroft 1.23 set LN = ( '/usr/bin/ln -s' )
383 cnh 1.1 set CPP = ( '/usr/ccs/lib/cpp -P' )
384 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
385 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
386     set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar')
387 heimbach 1.20 set FOPTIM = ( '-fast -O3' )
388 cnh 1.1 set NOOPTFLAGS = ( '-O0' )
389     set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
390 cnh 1.6 '-lsocket -lnsl' )
391 adcroft 1.36 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F ini_spherical_polar_grid.F')
392 cnh 1.3 breaksw
393 cnh 1.6 case IRIX32:
394 cnh 1.3 echo "Configuring for SGI ONYX running IRIX64"
395 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
396 cnh 1.3 set INCLUDES = ( '-I/usr/include' )
397     set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
398     set FOPTIM = ( '-O2' )
399     set NOOPTFLAGS = ( '-O0' )
400     set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
401 heimbach 1.20 'external_fields_load.F' )
402 cnh 1.3 set LIBS = ( '-lmpi' )
403     breaksw
404 adcroft 1.11 case HP-UX+mpi:
405     set FC = ( 'mpif77' )
406     set LINK = ( 'mpif77' )
407     set INCLUDES = ( '-I/opt/mpi/include' )
408 cnh 1.6 case HP-UX:
409 cnh 1.3 echo "Configuring for HP Exemplar"
410     set CPP = ( '/usr/ccs/lbin/cpp -P' )
411 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' )
412 cnh 1.3 set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \
413     '+Okernel_threads' )
414     set FOPTIM = ( '+O2' )
415 cnh 1.6 set NOOPTFLAGS = ( '+O0' )
416 cnh 1.3 set NOOPTFILES = ( 'barrier.F different_multiple.F' \
417 heimbach 1.20 'external_fields_load.F' )
418 cnh 1.1 breaksw
419 adcroft 1.9 case Linux+mpi:
420     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
421 adcroft 1.14 set INCLUDES = ( '-I/usr/local/include' )
422 cnh 1.6 case Linux:
423 adcroft 1.23 set LN = ( '/bin/ln -s' )
424 adcroft 1.14 set CPP = ( '/lib/cpp -traditional -P' )
425 adcroft 1.11 set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
426 cnh 1.6 set FC = ( 'g77' )
427 adcroft 1.14 set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' )
428     set FOPTIM = ( '-O3 -malign-double -funroll-loops ' )
429 cnh 1.6 set LINK = ( 'g77' )
430     breaksw
431 adcroft 1.14 case Linux+pgi+mpi:
432 adcroft 1.15 if ($?include_jam_libs) then
433 adcroft 1.35 set INCLUDES = ( '-I/usr/local/mpich-1.2.1/pgi_fortran_binding/include' )
434     set LIBS = ( '-L/usr/local/mpich-1.2.1/pgi_fortran_binding/lib/ -lfmpich -lmpich' )
435 adcroft 1.15 else
436     set INCLUDES = ( '-I/usr/local/include' )
437     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
438     endif
439 cnh 1.6 case Linux+pgi:
440 adcroft 1.23 set LN = ( '/bin/ln -s' )
441 adcroft 1.14 set CPP = ( '/lib/cpp -traditional -P' )
442 adcroft 1.10 set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
443 cnh 1.6 set FC = ( 'pgf77' )
444 adcroft 1.23 set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
445 cnh 1.6 set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
446     set LINK = ( 'pgf77' )
447 adcroft 1.13 breaksw
448     case T3E:
449     case sn6312:
450     set CPP = ( '/opt/ctl/bin/cpp -P')
451     set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
452     set FC = ( 'f90' )
453     set LINK = ( 'f90' )
454     set FFLAGS = ( '-O 2,fusion' )
455 heimbach 1.18 breaksw
456     case T90:
457     case sn7113:
458     set FC = ( 'f90' )
459     set LINK = ( 'f90' )
460 adcroft 1.23 set LN = ( '/bin/ln -s' )
461 heimbach 1.19 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
462     set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
463     set FFLAGS = ( '-m3 -Rabc -N 132')
464 heimbach 1.18 set FOPTIM = ( '-O0' )
465     set NOOPTFLAGS = ( '-O0' )
466 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
467 heimbach 1.18 breaksw
468     case SV1:
469     case sn3002:
470     set FC = ( 'f90' )
471     set LINK = ( 'f90' )
472 adcroft 1.23 set LN = ( '/bin/ln -s' )
473 heimbach 1.19 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
474     set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
475     set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132')
476 heimbach 1.18 set FOPTIM = ( '-O0' )
477     set NOOPTFLAGS = ( '-O0' )
478 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
479 cnh 1.6 breaksw
480 cnh 1.1 default:
481     echo "Error: platform not recognized: uname -p = " $platform$USEMPI
482     exit
483     breaksw
484     endsw
485    
486     ###############################################################################
487     ## ##
488     ## Everything below here should not need to be changed. Platform specific ##
489     ## changes and code specific changes should be configured above this line. ##
490     ## ##
491     ###############################################################################
492    
493     # Convert lists of directories into command-line options
494     foreach inc ($INCLUDEDIRS)
495     set INCLUDES = ($INCLUDES -I$inc)
496     end
497 adcroft 1.23
498     # Search for source code
499     rm -rf .links.tmp;mkdir .links.tmp
500     echo "# This section creates symbolic links" > srclinks.tmp
501     echo "" >> srclinks.tmp
502     echo -n 'SRCFILES = ' > srclist.inc
503     echo -n 'CSRCFILES = ' > csrclist.inc
504     #echo -n 'HEADERFILES = ' > hlist.inc
505 cnh 1.1 foreach dr ($SOURCEDIRS)
506 adcroft 1.23 set deplist=( )
507     foreach srcfile (`cd $dr; ls *.[hcF]`)
508     if (! -r .links.tmp/$srcfile) then
509     if (-f $dr/$srcfile) then
510     switch ($srcfile:e)
511     case F:
512     touch .links.tmp/$srcfile
513     set deplist=($deplist $srcfile)
514     echo ' \' >> srclist.inc
515     echo -n " " $srcfile >> srclist.inc
516     breaksw
517     case c:
518     touch .links.tmp/$srcfile
519     set deplist=($deplist $srcfile)
520     echo ' \' >> csrclist.inc
521     echo -n " " $srcfile >> csrclist.inc
522     breaksw
523     case h:
524     # touch .links.tmp/$srcfile
525     # set deplist=($deplist $srcfile)
526     # echo ' \' >> hlist.inc
527     # echo -n " " $srcfile >> hlist.inc
528     breaksw
529     endsw
530     endif
531     endif
532     end
533     if ($#deplist != 0) then
534     echo "# These files are linked from $dr" >> srclinks.tmp
535     echo $deplist':' >> srclinks.tmp
536     echo ' $(LN) '$dr'/$@ $@' >> srclinks.tmp
537     endif
538 cnh 1.1 end
539 adcroft 1.23 rm -rf .links.tmp
540     echo "" >> srclist.inc
541     echo "" >> csrclist.inc
542     #echo "" >> hlist.inc
543 cnh 1.1
544     set THISHOSTNAME = ( `hostname` )
545     set THISCWD = ( `pwd` )
546     set THISDATE = ( `date` )
547    
548 adcroft 1.23 if (-r $mfile) mv -f $mfile $mfile.bak
549 cnh 1.1 ###########################################
550     ## This is the template for the makefile ##
551     ###########################################
552     echo Creating makefile: $mfile
553     echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}
554 adcroft 1.23 echo "# This makefile was generated automatically on" >> ${mfile}
555 cnh 1.1 echo "# $THISDATE" >> ${mfile}
556     echo "# by the command:" >> ${mfile}
557     echo "# ${0} $argv" >> ${mfile}
558     echo "# executed by:" >> ${mfile}
559     echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> ${mfile}
560     cat >> ${mfile} <<EOF
561     #
562     # BUILDDIR : Directory where object files are written
563     # SOURCEDIRS : Directories containing the source (.F) files
564     # INCLUDEDIRS : Directories containing the header-source (.h) files
565     # EXEDIR : Directory where executable that is generated is written
566     # EXECUTABLE : Full path of executable binary
567     #
568     # CPP : C-preprocessor command
569     # INCLUDES : Directories searched for header files
570     # DEFINES : Macro definitions for CPP
571     # KPP : Special preprocessor command (specific to platform)
572     # KFLAGS : Flags for KPP
573     # FC : Fortran compiler command
574     # FFLAGS : Configuration/debugging options for FC
575     # FOPTIM : Optimization options for FC
576     # LINK : Command for link editor program
577     # LIBS : Library flags /or/ additional optimization/debugging flags
578    
579 adcroft 1.23 ROOTDIR = ${ROOTDIR}
580     BUILDDIR = ${BUILDDIR}
581     SOURCEDIRS = ${SOURCEDIRS}
582 cnh 1.1 INCLUDEDIRS = ${INCLUDEDIRS}
583 adcroft 1.23 EXEDIR = ${EXEDIR}
584     EXECUTABLE = \$(EXEDIR)/${EXECUTABLE}
585     TOOLSDIR = ${TOOLSDIR}
586 cnh 1.1
587 adcroft 1.12 EOF
588    
589    
590     # JAM libraries on Hyades
591     if ($?include_jam_libs) then
592     cat >> ${mfile} <<EOF
593     # extra stuff for Hyades ............................................
594     HYADES_DIR = /u/u0/cnh/jam-lib/software
595 adcroft 1.16 HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
596 adcroft 1.35 HYADES_DIR = /usr/local/jamlib/current/dual_proc
597 adcroft 1.12 WORK_DIR = \$(HYADES_DIR)
598     DEPOSIT_DIR = linux_bin
599    
600     STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR)
601     STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \
602     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \
603     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \
604     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o
605    
606     JAMOBJDIR = jam/\$(DEPOSIT_DIR)
607     JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \
608     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \
609     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \
610     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \
611     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o
612    
613     JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR)
614     JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o
615    
616     XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ)
617    
618     # ..................................................................
619    
620     EOF
621     endif
622    
623    
624     cat >> ${mfile} <<EOF
625 cnh 1.1 # Unix ln (link)
626     LN = ${LN}
627     # C preprocessor
628 adcroft 1.23 CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP}
629 cnh 1.1 # Special preprocessor (KAP on DECs, FPP on Crays)
630     KPP = ${KPP}
631     # Fortran compiler
632     FC = ${FC}
633     # Link editor
634     LINK = ${LINK}
635    
636     # Defines for CPP
637     DEFINES = ${DEFINES}
638     # Includes for CPP
639     INCLUDES = ${INCLUDES}
640     # Flags for KPP
641     KFLAGS1 = ${KFLAGS1}
642     KFLAGS2 = ${KFLAGS2}
643     # Optim./debug for FC
644     FFLAGS = ${FFLAGS}
645     FOPTIM = ${FOPTIM}
646     # Files that should not be optimized
647     NOOPTFILES = ${NOOPTFILES}
648     NOOPTFLAGS = ${NOOPTFLAGS}
649     # Flags and libraries needed for linking
650 adcroft 1.15 LIBS = ${LIBS} \$(XLIBS)
651 cnh 1.1
652     EOF
653    
654 heimbach 1.19 cat srclist.inc >> ${mfile}
655     cat csrclist.inc >> ${mfile}
656     echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile}
657     echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
658    
659 adcroft 1.23 rm -f srclist.inc csrclist.inc flist.tmp clist.tmp
660 cnh 1.1
661     cat >> ${mfile} <<EOF
662    
663     .SUFFIXES:
664 cnh 1.5 .SUFFIXES: .o .f .p .F .c
665 cnh 1.1
666     all: \$(EXECUTABLE)
667     \$(EXECUTABLE): \$(OBJFILES)
668     \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
669     depend:
670     @make links
671     makedepend -o .f \$(INCLUDES) \$(SRCFILES)
672 adcroft 1.32
673 adcroft 1.23 links: \$(SRCFILES)
674 heimbach 1.19
675     small_f: \$(F77FILES)
676    
677 cnh 1.1 clean:
678     -rm -rf *.o *.f *.p ${RMFILES}
679 cnh 1.6 Clean:
680     @make clean
681 adcroft 1.32 @make cleanlinks
682 adcroft 1.23 -rm -f Makefile.bak
683 adcroft 1.12 CLEAN:
684     @make Clean
685 adcroft 1.28 -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
686     -find \$(EXEDIR) -name "*.data" -exec rm {} \;
687 adcroft 1.23 -rm -f \$(EXECUTABLE)
688 adcroft 1.32
689     makefile:
690     ${0} $argv
691     cleanlinks:
692     -find . -type l -exec rm {} \;
693 cnh 1.1
694     # The normal chain of rules is ( .F - .f - .o )
695     .F.f:
696 cnh 1.6 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
697 cnh 1.1 .f.o:
698     \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
699    
700     # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
701     .F.p:
702 cnh 1.6 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
703 cnh 1.1 .p.f:
704     \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
705     EOF
706    
707     # Make list of "exceptions" that need ".p" files
708     foreach sf ($KPPFILES)
709     set fname=( ${sf:t} )
710     echo "${fname:r}.f: ${fname:r}.p" >> ${mfile}
711     end
712     foreach sf ($NOOPTFILES)
713     set fname=( ${sf:t} )
714     echo "${fname:r}.o: ${fname:r}.f" >> ${mfile}
715     echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile}
716     end
717 adcroft 1.23 echo "" >> ${mfile}
718    
719     # Add rules for links
720     cat srclinks.tmp >> ${mfile}
721     rm -f srclinks.tmp
722    
723     echo "" >> ${mfile}
724 cnh 1.1 echo "# DO NOT DELETE" >> ${mfile}
725    
726     exit

  ViewVC Help
Powered by ViewVC 1.1.22