/[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.27 - (show annotations) (download)
Wed Feb 7 14:00:06 2001 UTC (23 years, 1 month ago) by adcroft
Branch: MAIN
Changes since 1.26: +2 -1 lines
Broke -rootdir=dir when adding auto scan feature.

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

  ViewVC Help
Powered by ViewVC 1.1.22