/[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.22.2.6 - (hide annotations) (download)
Mon Jan 29 15:29:37 2001 UTC (23 years, 4 months ago) by adcroft
Branch: branch-atmos-merge
Changes since 1.22.2.5: +127 -27 lines
Added -enable=pkg1 -disable=pkg2 options.
*** Need to test on other platforms

1 cnh 1.1 #!/bin/csh -f
2     #
3 adcroft 1.22.2.6 # $Header: /u/gcmpack/models/MITgcmUV/tools/genmake,v 1.22.2.5 2001/01/26 00:14:32 cnh Exp $
4 cnh 1.1 #
5     # Makefile generator for MITgcm UV codes
6 adcroft 1.22.2.6 # created by cnh 03/98
7     # 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 cnh 1.1
18     # Process command-line arguments
19     set allargs=( $argv )
20     while ($#allargs)
21     set arg = $allargs[1]
22     switch ($arg)
23 adcroft 1.9 case -makefile:
24     set mfile = ( Makefile )
25     breaksw
26     case -makefile=*:
27     set mfile = ( `echo $arg | sed 's/-makefile=//' `)
28 cnh 1.1 breaksw
29     case -platform:
30     case -platform=:
31     echo "To change platform you must specify one with -platform="
32     echo "eg. -platform=sparc or -platform=mips"
33     exit
34     breaksw
35     case -platform*:
36 adcroft 1.22.2.6 if ($?platform) then
37     echo Option -platform=dir can only be specified once.; exit 1
38     endif
39 cnh 1.1 set platform = ( `echo $arg | sed 's/-platform=//' `)
40     breaksw
41 adcroft 1.22.2.6 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 adcroft 1.22.2.1 case -rootdir=*:
48 adcroft 1.22.2.6 if ($?ROOTDIR) then
49     echo "***" Warning: variable \$ROOTDIR is already set to $ROOTDIR
50     echo "***" Command line \"$arg\" will override this.
51     endif
52 adcroft 1.22.2.1 set ROOTDIR = ( `echo $arg | sed 's/-rootdir=//' `)
53     breaksw
54 adcroft 1.22.2.6 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 adcroft 1.22.2.1 case -mymods=*:
61 adcroft 1.22.2.6 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 adcroft 1.22.2.1 breaksw
82 cnh 1.1 case -mpi:
83     echo "Enabling MPI options"
84     set USEMPI
85     breaksw
86 adcroft 1.12 case -jam:
87     set include_jam_libs
88     echo "Including paths to JAM libraries"
89     breaksw
90 cnh 1.1 case -help:
91     echo "usage: $0 [-help] [-makefile[=...]] [-platform=...] [-mpi]"
92     exit
93     breaksw
94     default:
95     echo "Unknown command-line option: " $arg
96     echo $0 "-help to show usage"
97     exit
98     breaksw
99     endsw
100     shift allargs
101     end
102 cnh 1.6
103 adcroft 1.22.2.1 # Default actions/options
104    
105     # If platform wasn't specified then determine platform type of the host
106 adcroft 1.22.2.6 if (! $?platform) then
107 cnh 1.6 set platform = (`uname`)
108     endif
109 adcroft 1.22.2.1 # If name of makefile wasn't specified then use default "Makefile"
110 adcroft 1.22.2.6 if (! $?mfile) set mfile = ( Makefile )
111 adcroft 1.22.2.1
112 cnh 1.1 set mach = ( `uname -a` )
113     echo Operating system: $mach
114    
115 adcroft 1.22.2.1
116 cnh 1.1 # Directories for source, includes, binaries and executables
117 adcroft 1.22.2.1 #
118     # 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
120 adcroft 1.22.2.6 if (! $?ROOTDIR) then
121 adcroft 1.22.2.1 set ROOTDIR = ( .. )
122     else
123 adcroft 1.22.2.6 if (! $?EXEDIR) set EXEDIR = ( ./ )
124     endif
125     if (! -d $ROOTDIR) then
126     echo Root directory $ROOTDIR not found.;exit 1
127 adcroft 1.22.2.1 endif
128 adcroft 1.22.2.6 # If -mymods wasn't specified then we will assume that we can find all the
129     # source code in the standard directories
130     if (! $?MYMODS) then
131     set SOURCEDIRS = ( )
132     set INCLUDEDIRS = ( . )
133 adcroft 1.22.2.1 else
134 adcroft 1.22.2.6 set SOURCEDIRS = ( $MYMODS )
135     set INCLUDEDIRS = ( . $MYMODS )
136 adcroft 1.22.2.1 endif
137 adcroft 1.22.2.6 if (! $?BUILDDIR) set BUILDDIR = ( . )
138     if (! -d $BUILDDIR) then
139     echo Build directory $BUILDDIR not found.;exit 1
140     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 cnh 1.1
194     # This is the generic configuration.
195     # Platform specific options are chosen below
196 adcroft 1.22.2.1 set LN = ( 'ln -s' )
197 cnh 1.1 set CPP = ( '/lib/cpp -P' )
198     set KPP = ( )
199     set FC = ( 'f77' )
200     set LINK = ( 'f77' )
201     set DEFINES = ( )
202     set INCLUDES = ( )
203     set FFLAGS = ( )
204     set FOPTIM = ( )
205     set KFLAGS1 = ( )
206     set KFLAGS2 = ( )
207     set LIBS = ( )
208     set KPPFILES = ( )
209     set NOOPTFILES = ( )
210     set NOOPTFLAGS = ( )
211     set RMFILES = ( )
212    
213     # We often want to use different compile/link options is using MPI
214     if ($?USEMPI) then
215     set USEMPI = ( '+mpi' )
216     set DEFINES = ( ${DEFINES} '-DALLOW_USE_MPI -DALWAYS_USE_MPI' )
217     else
218     set USEMPI
219     # set DEFINES = ( ${DEFINES} '-UALLOW_USE_MPI -UALWAYS_USE_MPI' )
220     endif
221    
222     # Platform specific options
223     switch ($platform$USEMPI)
224 cnh 1.6 case OSF1:
225     case OSF1+mpi:
226 cnh 1.1 echo "Configuring for DEC Alpha"
227     set CPP = ( '/usr/bin/cpp -P' )
228 adcroft 1.10 set DEFINES = ( ${DEFINES} '-DTARGET_DEC -DWORDLENGTH=1' )
229 cnh 1.1 set KPP = ( 'kapf' )
230 cnh 1.4 set KPPFILES = ( 'main.F' )
231 cnh 1.1 set KFLAGS1 = ( '-scan=132 -noconc -cmp=' )
232     set FC = ( 'f77' )
233 adcroft 1.2 set FFLAGS = ( '-convert big_endian -r8 -extend_source -u -automatic -call_shared -notransform_loops -align dcommons' )
234 cnh 1.1 set FOPTIM = ( '-O5 -fast -tune host -inline all' )
235     set NOOPTFLAGS = ( '-O0' )
236     set LIBS = ( '-lfmpi -lmpi -lkmp_osfp10 -pthread' )
237 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
238 cnh 1.1 set RMFILES = ( '*.p.out' )
239     breaksw
240 cnh 1.6 case IRIX64+mpi:
241 cnh 1.1 echo "Configuring for SGI Mips with MPI"
242 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
243 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
244     set FC = ( 'mpif77' )
245     set LINK = ( 'mpif77' )
246 adcroft 1.11 set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
247 cnh 1.1 set FOPTIM = ( '-O3' )
248     set RMFILES = ( 'rii_files' )
249     breaksw
250 cnh 1.6 case IRIX64:
251 cnh 1.1 echo "Configuring for SGI Mips"
252 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
253 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
254     set FFLAGS = ( '-extend_source -mp -mpio -bytereclen -r10000 -mips4' )
255 adcroft 1.11 set FOPTIM = ( '-O3' )
256     # set NOOPTFLAGS = ( '-O0' )
257     # set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
258 heimbach 1.20 # 'external_fields_load.F' )
259 cnh 1.1 set RMFILES = ( 'rii_files' )
260     breaksw
261 heimbach 1.20 case o2:
262     case IRIX:
263     echo "Configuring for SGI O2 running IRIX 6.5"
264     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
265     set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
266     set FOPTIM = ( '-O2' )
267     set NOOPTFLAGS = ( '-O0' )
268     breaksw
269     case o2+mpi:
270     case IRIX+mpi:
271     echo "Configuring for SGI O2 running IRIX 6.5 with MPI"
272     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
273     set FFLAGS = ( '-extend_source -bytereclen -r10000 -mips4' )
274     set FOPTIM = ( '-O2' )
275     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
276     set NOOPTFLAGS = ( '-O0' )
277     set LIBS = ( '-lmpi' )
278     breaksw
279     case o2k+mpi:
280     echo "Configuring for SGI Origin2000 running IRIX 6.5"
281     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
282     set INCLUDES = ( '-I/usr/include' )
283     set FFLAGS = ( '-n32 -extend_source -bytereclen' )
284     set FOPTIM = ( '-O2' )
285     set NOOPTFILES = ( 'calc_mom_rhs.F' )
286     set NOOPTFLAGS = ( '-O1' )
287     set LIBS = ( '-lmpi -lscs' )
288     breaksw
289     case onyx:
290     case onyx+mpi:
291     echo "Configuring for SGI ONYX running IRIX64"
292     set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
293     set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
294     set FOPTIM = ( '-O2' )
295     set NOOPTFLAGS = ( '-O0' )
296     set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F' )
297     set LIBS = ( '-lmpi' )
298     breaksw
299 cnh 1.6 case SunOS:
300 adcroft 1.22.2.1 set LN = ( '/usr/bin/ln -s' )
301 cnh 1.6 set CPP = ( '/usr/ccs/lib/cpp -P' )
302 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
303 cnh 1.6 set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar')
304 heimbach 1.20 set FOPTIM = ( '-fast -O3' )
305 cnh 1.6 set NOOPTFLAGS = ( '-O0' )
306 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F')
307 cnh 1.6 breaksw
308     case SunOS+mpi:
309 adcroft 1.22.2.1 set LN = ( '/usr/bin/ln -s' )
310 cnh 1.1 set CPP = ( '/usr/ccs/lib/cpp -P' )
311 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SUN -DWORDLENGTH=4' )
312 cnh 1.1 set INCLUDES = ( '-I/usr/local/mpi/include' )
313     set FFLAGS = ( '-stackvar -explicitpar -vpara -e -u -noautopar')
314 heimbach 1.20 set FOPTIM = ( '-fast -O3' )
315 cnh 1.1 set NOOPTFLAGS = ( '-O0' )
316     set LIBS = ( '-L/usr/local/mpi/lib/solaris/ch_shmem -lmpi -lthread' \
317 cnh 1.6 '-lsocket -lnsl' )
318 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F ini_vertical_grid.F')
319 cnh 1.3 breaksw
320 cnh 1.6 case IRIX32:
321 cnh 1.3 echo "Configuring for SGI ONYX running IRIX64"
322 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_SGI -DWORDLENGTH=4' )
323 cnh 1.3 set INCLUDES = ( '-I/usr/include' )
324     set FFLAGS = ( '-extend_source -bytereclen -r10000 -64' )
325     set FOPTIM = ( '-O2' )
326     set NOOPTFLAGS = ( '-O0' )
327     set NOOPTFILES = ( 'barrier.F different_multiple.F ' \
328 heimbach 1.20 'external_fields_load.F' )
329 cnh 1.3 set LIBS = ( '-lmpi' )
330     breaksw
331 adcroft 1.11 case HP-UX+mpi:
332     set FC = ( 'mpif77' )
333     set LINK = ( 'mpif77' )
334     set INCLUDES = ( '-I/opt/mpi/include' )
335 cnh 1.6 case HP-UX:
336 cnh 1.3 echo "Configuring for HP Exemplar"
337     set CPP = ( '/usr/ccs/lbin/cpp -P' )
338 adcroft 1.11 set DEFINES = ( ${DEFINES} '-DTARGET_HP -DWORDLENGTH=4' )
339 cnh 1.3 set FFLAGS = ( '+es +U77 +Onoautopar +Oexemplar_model' \
340     '+Okernel_threads' )
341     set FOPTIM = ( '+O2' )
342 cnh 1.6 set NOOPTFLAGS = ( '+O0' )
343 cnh 1.3 set NOOPTFILES = ( 'barrier.F different_multiple.F' \
344 heimbach 1.20 'external_fields_load.F' )
345 cnh 1.1 breaksw
346 adcroft 1.9 case Linux+mpi:
347     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
348 adcroft 1.14 set INCLUDES = ( '-I/usr/local/include' )
349 cnh 1.6 case Linux:
350 adcroft 1.22.2.1 set LN = ( '/bin/ln -s' )
351 adcroft 1.14 set CPP = ( '/lib/cpp -traditional -P' )
352 adcroft 1.11 set DEFINES = ( ${DEFINES} '-D_BYTESWAPIO -DWORDLENGTH=4' )
353 cnh 1.6 set FC = ( 'g77' )
354 adcroft 1.14 set FFLAGS = ( '-Wimplicit -Wunused -Wuninitialized' )
355     set FOPTIM = ( '-O3 -malign-double -funroll-loops ' )
356 cnh 1.6 set LINK = ( 'g77' )
357     breaksw
358 adcroft 1.14 case Linux+pgi+mpi:
359 adcroft 1.15 if ($?include_jam_libs) then
360     set INCLUDES = ( '-I/usr/local//mpich-cnh-install/include' )
361     set LIBS = ( '-L/usr/local/mpich-cnh-install/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
362     else
363     set INCLUDES = ( '-I/usr/local/include' )
364     set LIBS = ( '-L/usr/local/lib/LINUX/ch_p4/ -lfmpich -lmpich' )
365     endif
366 cnh 1.6 case Linux+pgi:
367 adcroft 1.22.2.1 set LN = ( '/bin/ln -s' )
368 adcroft 1.14 set CPP = ( '/lib/cpp -traditional -P' )
369 adcroft 1.10 set DEFINES = ( ${DEFINES} '-DWORDLENGTH=4' )
370 cnh 1.6 set FC = ( 'pgf77' )
371 cnh 1.22.2.5 set FFLAGS = ( '-byteswapio -r8 -Mnodclchk -Mextend' )
372 cnh 1.6 set FOPTIM = ( '-tp p6 -v -O2 -Munroll -Mvect=cachesize:512000,transform -Kieee' )
373     set LINK = ( 'pgf77' )
374 adcroft 1.13 breaksw
375     case T3E:
376     case sn6312:
377     set CPP = ( '/opt/ctl/bin/cpp -P')
378     set DEFINES = ( ${DEFINES} '-DTARGET_T3E -DWORDLENGTH=4' )
379     set FC = ( 'f90' )
380     set LINK = ( 'f90' )
381     set FFLAGS = ( '-O 2,fusion' )
382 heimbach 1.18 breaksw
383     case T90:
384     case sn7113:
385     set FC = ( 'f90' )
386     set LINK = ( 'f90' )
387 adcroft 1.22.2.1 set LN = ( '/bin/ln -s' )
388 heimbach 1.19 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
389     set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
390     set FFLAGS = ( '-m3 -Rabc -N 132')
391 heimbach 1.18 set FOPTIM = ( '-O0' )
392     set NOOPTFLAGS = ( '-O0' )
393 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
394 heimbach 1.18 breaksw
395     case SV1:
396     case sn3002:
397     set FC = ( 'f90' )
398     set LINK = ( 'f90' )
399 adcroft 1.22.2.1 set LN = ( '/bin/ln -s' )
400 heimbach 1.19 set CPP = ( '/opt/ctl/bin/cpp -N -P' )
401     set DEFINES = ( ${DEFINES} '-DTARGET_CRAY_VECTOR -DWORDLENGTH=4' )
402     set FFLAGS = ( '-m3 -Rabc -ei -eI -s cf77types -N 132')
403 heimbach 1.18 set FOPTIM = ( '-O0' )
404     set NOOPTFLAGS = ( '-O0' )
405 heimbach 1.20 set NOOPTFILES = ( 'barrier.F different_multiple.F external_fields_load.F')
406 cnh 1.6 breaksw
407 cnh 1.1 default:
408     echo "Error: platform not recognized: uname -p = " $platform$USEMPI
409     exit
410     breaksw
411     endsw
412    
413     ###############################################################################
414     ## ##
415     ## Everything below here should not need to be changed. Platform specific ##
416     ## changes and code specific changes should be configured above this line. ##
417     ## ##
418     ###############################################################################
419    
420     # Convert lists of directories into command-line options
421     foreach inc ($INCLUDEDIRS)
422     set INCLUDES = ($INCLUDES -I$inc)
423     end
424 adcroft 1.22.2.3
425     # Search for source code
426     rm -rf .links.tmp;mkdir .links.tmp
427     echo "# This section creates symbolic links" > srclinks.tmp
428     echo "" >> srclinks.tmp
429     echo -n 'SRCFILES = ' > srclist.inc
430     echo -n 'CSRCFILES = ' > csrclist.inc
431     #echo -n 'HEADERFILES = ' > hlist.inc
432 cnh 1.1 foreach dr ($SOURCEDIRS)
433 adcroft 1.22.2.3 set deplist=( )
434     foreach srcfile (`cd $dr; ls *.[hcF]`)
435     if (! -r .links.tmp/$srcfile) then
436     if (-f $dr/$srcfile) then
437     switch ($srcfile:e)
438     case F:
439     touch .links.tmp/$srcfile
440     set deplist=($deplist $srcfile)
441     echo ' \' >> srclist.inc
442     echo -n " " $srcfile >> srclist.inc
443     breaksw
444     case c:
445     touch .links.tmp/$srcfile
446     set deplist=($deplist $srcfile)
447     echo ' \' >> csrclist.inc
448     echo -n " " $srcfile >> csrclist.inc
449     breaksw
450     case h:
451     # touch .links.tmp/$srcfile
452     # set deplist=($deplist $srcfile)
453     # echo ' \' >> hlist.inc
454     # echo -n " " $srcfile >> hlist.inc
455     breaksw
456     endsw
457     endif
458     endif
459     end
460     if ($#deplist != 0) then
461     echo "# These files are linked from $dr" >> srclinks.tmp
462     echo $deplist':' >> srclinks.tmp
463 adcroft 1.22.2.6 echo '\t$(LN) '$dr'/$@ $@' >> srclinks.tmp
464 adcroft 1.22.2.3 endif
465 cnh 1.1 end
466 adcroft 1.22.2.3 rm -rf .links.tmp
467     echo "" >> srclist.inc
468     echo "" >> csrclist.inc
469     #echo "" >> hlist.inc
470 cnh 1.1
471     set THISHOSTNAME = ( `hostname` )
472     set THISCWD = ( `pwd` )
473     set THISDATE = ( `date` )
474    
475 adcroft 1.22.2.6 if (-r $mfile) mv -f $mfile $mfile.bak
476 cnh 1.1 ###########################################
477     ## This is the template for the makefile ##
478     ###########################################
479     echo Creating makefile: $mfile
480     echo "# Multithreaded + multi-processing makefile for $mach" > ${mfile}
481 adcroft 1.22.2.4 echo "# This makefile was generated automatically on" >> ${mfile}
482 cnh 1.1 echo "# $THISDATE" >> ${mfile}
483     echo "# by the command:" >> ${mfile}
484     echo "# ${0} $argv" >> ${mfile}
485     echo "# executed by:" >> ${mfile}
486     echo "# $USER@${THISHOSTNAME}:${THISCWD}" >> ${mfile}
487     cat >> ${mfile} <<EOF
488     #
489     # BUILDDIR : Directory where object files are written
490     # SOURCEDIRS : Directories containing the source (.F) files
491     # INCLUDEDIRS : Directories containing the header-source (.h) files
492     # EXEDIR : Directory where executable that is generated is written
493     # EXECUTABLE : Full path of executable binary
494     #
495     # CPP : C-preprocessor command
496     # INCLUDES : Directories searched for header files
497     # DEFINES : Macro definitions for CPP
498     # KPP : Special preprocessor command (specific to platform)
499     # KFLAGS : Flags for KPP
500     # FC : Fortran compiler command
501     # FFLAGS : Configuration/debugging options for FC
502     # FOPTIM : Optimization options for FC
503     # LINK : Command for link editor program
504     # LIBS : Library flags /or/ additional optimization/debugging flags
505    
506 adcroft 1.22.2.1 ROOTDIR = ${ROOTDIR}
507     BUILDDIR = ${BUILDDIR}
508     SOURCEDIRS = ${SOURCEDIRS}
509 cnh 1.1 INCLUDEDIRS = ${INCLUDEDIRS}
510 adcroft 1.22.2.1 EXEDIR = ${EXEDIR}
511     EXECUTABLE = \$(EXEDIR)${EXECUTABLE}
512     TOOLSDIR = ${TOOLSDIR}
513 cnh 1.1
514 adcroft 1.12 EOF
515    
516    
517     # JAM libraries on Hyades
518     if ($?include_jam_libs) then
519     cat >> ${mfile} <<EOF
520     # extra stuff for Hyades ............................................
521     HYADES_DIR = /u/u0/cnh/jam-lib/software
522 adcroft 1.16 HYADES_DIR = /u/u0/cnh/jam-lib-twoproc
523 adcroft 1.12 WORK_DIR = \$(HYADES_DIR)
524     DEPOSIT_DIR = linux_bin
525    
526     STARTXOBJDIR = startx_util/\$(DEPOSIT_DIR)
527     STARTXOBJ = \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_timer.o \
528     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/startx_util.o \
529     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/client.o \
530     \$(WORK_DIR)/startx_util/\$(DEPOSIT_DIR)/csutil.o
531    
532     JAMOBJDIR = jam/\$(DEPOSIT_DIR)
533     JAMOBJ = \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_init.o \
534     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_kernel.o \
535     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_malloc.o \
536     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_vmalloc.o \
537     \$(WORK_DIR)/jam/\$(DEPOSIT_DIR)/jam_mutex.o
538    
539     JAMCOBJDIR = jam_collective/\$(DEPOSIT_DIR)
540     JAMCOBJ = \$(WORK_DIR)/jam_collective/\$(DEPOSIT_DIR)/jam_collective.o
541    
542     XLIBS = \$(STARTXOBJ) \$(JAMOBJ) \$(JAMCOBJ)
543    
544     # ..................................................................
545    
546     EOF
547     endif
548    
549    
550     cat >> ${mfile} <<EOF
551 cnh 1.1 # Unix ln (link)
552     LN = ${LN}
553     # C preprocessor
554 adcroft 1.22.2.1 CPP = cat \$< | \$(TOOLSDIR)/set64bitConst.sh | ${CPP}
555 cnh 1.1 # Special preprocessor (KAP on DECs, FPP on Crays)
556     KPP = ${KPP}
557     # Fortran compiler
558     FC = ${FC}
559     # Link editor
560     LINK = ${LINK}
561    
562     # Defines for CPP
563     DEFINES = ${DEFINES}
564     # Includes for CPP
565     INCLUDES = ${INCLUDES}
566     # Flags for KPP
567     KFLAGS1 = ${KFLAGS1}
568     KFLAGS2 = ${KFLAGS2}
569     # Optim./debug for FC
570     FFLAGS = ${FFLAGS}
571     FOPTIM = ${FOPTIM}
572     # Files that should not be optimized
573     NOOPTFILES = ${NOOPTFILES}
574     NOOPTFLAGS = ${NOOPTFLAGS}
575     # Flags and libraries needed for linking
576 adcroft 1.15 LIBS = ${LIBS} \$(XLIBS)
577 cnh 1.1
578     EOF
579    
580 heimbach 1.19 cat srclist.inc >> ${mfile}
581     cat csrclist.inc >> ${mfile}
582     echo 'F77FILES = $(SRCFILES:.F=.f)' >> ${mfile}
583     echo 'OBJFILES = $(SRCFILES:.F=.o) $(CSRCFILES:.c=.o)' >> ${mfile}
584    
585 adcroft 1.22.2.3 rm -f srclist.inc csrclist.inc flist.tmp clist.tmp
586 cnh 1.1
587     cat >> ${mfile} <<EOF
588    
589     .SUFFIXES:
590 cnh 1.5 .SUFFIXES: .o .f .p .F .c
591 cnh 1.1
592     all: \$(EXECUTABLE)
593     \$(EXECUTABLE): \$(OBJFILES)
594     \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS)
595     depend:
596     @make links
597     makedepend -o .f \$(INCLUDES) \$(SRCFILES)
598 adcroft 1.22.2.3 links: \$(SRCFILES)
599 heimbach 1.19
600     small_f: \$(F77FILES)
601    
602 cnh 1.1 clean:
603     -rm -rf *.o *.f *.p ${RMFILES}
604 cnh 1.6 Clean:
605     @make clean
606 adcroft 1.8 -find . -type l -exec rm {} \;
607 adcroft 1.22.2.6 -rm -f Makefile.bak
608 adcroft 1.12 CLEAN:
609     @make Clean
610 adcroft 1.22.2.6 -find \$(ROOTDIR) -name "*.meta" -exec rm {} \;
611     -find \$(ROOTDIR) -name "*.data" -exec rm {} \;
612     -rm -f \$(EXECUTABLE)
613 cnh 1.1
614     # The normal chain of rules is ( .F - .f - .o )
615     .F.f:
616 cnh 1.6 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
617 cnh 1.1 .f.o:
618     \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
619    
620     # Special exceptions that use the ( .F - .p - .f - .o ) rule-chain
621     .F.p:
622 cnh 1.6 \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
623 cnh 1.1 .p.f:
624     \$(KPP) \$(KFLAGS1)\$@ \$(KFLAGS2) \$<
625     EOF
626    
627     # Make list of "exceptions" that need ".p" files
628     foreach sf ($KPPFILES)
629     set fname=( ${sf:t} )
630     echo "${fname:r}.f: ${fname:r}.p" >> ${mfile}
631     end
632     foreach sf ($NOOPTFILES)
633     set fname=( ${sf:t} )
634     echo "${fname:r}.o: ${fname:r}.f" >> ${mfile}
635     echo ' $(FC) $(FFLAGS) $(NOOPTFLAGS) -c $<' >> ${mfile}
636     end
637 adcroft 1.22.2.1 echo "" >> ${mfile}
638    
639 adcroft 1.22.2.3 # Add rules for links
640     cat srclinks.tmp >> ${mfile}
641     rm -f srclinks.tmp
642 adcroft 1.22.2.1
643     echo "" >> ${mfile}
644 cnh 1.1 echo "# DO NOT DELETE" >> ${mfile}
645    
646     exit

  ViewVC Help
Powered by ViewVC 1.1.22