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

Contents of /MITgcm/tools/genmake

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


Revision 1.22.2.9 - (show annotations) (download)
Thu Feb 1 16:07:04 2001 UTC (23 years, 2 months ago) by adcroft
Branch: branch-atmos-merge
CVS Tags: branch-atmos-merge-freeze
Changes since 1.22.2.8: +14 -14 lines
Changed -mymods CLO and MYMODS variable to -mods and MODS to satisfy
Chris's paranoia that we're influenced by MOM. Poor boy needs help.

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

  ViewVC Help
Powered by ViewVC 1.1.22