/[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.33 - (show annotations) (download)
Tue Mar 6 16:12:45 2001 UTC (23 years ago) by jmc
Branch: MAIN
CVS Tags: c37_adj, checkpoint38, checkpoint37
Branch point for: pre38
Changes since 1.32: +2 -2 lines
package "timeave" replacing "diags": remove dir "diags" from standard path

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

  ViewVC Help
Powered by ViewVC 1.1.22