/[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.26 - (show annotations) (download)
Wed Feb 7 03:37:46 2001 UTC (23 years, 2 months ago) by adcroft
Branch: MAIN
Changes since 1.25: +27 -5 lines
Added autoscan feature to set ROOTDIR if not specified.

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

  ViewVC Help
Powered by ViewVC 1.1.22