forked from SHYFEM-model/shyfem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
480 lines (376 loc) · 13.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
#------------------------------------------------------------------------
#
# Copyright (C) 1985-2018 Georg Umgiesser
#
# This file is part of SHYFEM.
#
#------------------------------------------------------------------------
# general makefile for dir fem
#
#---------------------------------------------------------------
#
# targets that should be in all Makefiles of SUBDIRS:
#
# clean cleanall
#
# really necessary are only: fem clean cleanall
#
#---------------------------------------------------------------
DIR = fem
RULES_MAKE_VERSION = 0.0 # default if Rules.make cannot be read
FEMDIR = .
FEMBIN = $(FEMDIR)/fembin
#---------------------------------------------------------------
include ./Rules.make
#---------------------------------------------------------------
RULES_MAKE_EXPECTED = 1.6
RULES_MAKE_COMPATIBILITY = RULES_MAKE_OK
ifneq ($(RULES_MAKE_VERSION),"0.0")
ifneq ($(RULES_MAKE_VERSION),$(RULES_MAKE_EXPECTED))
RULES_MAKE_COMPATIBILITY = RULES_MAKE_NOT_COMPATIBLE
endif
endif
#---------------------------------------------------------------
ifndef ($(SHYFEMDIR))
SHYFEMDIR := $(HOME)/shyfem
endif
export SHYFEMDIR
#---------------------------------------------------------------
FEMDIR = .
DIRLIB = $(FEMDIR)/femlib
FEMSRC = $(FEMDIR)/fem3d
FEMBIN = $(FEMDIR)/fembin
TMPDIR = $(HOME)/fem/tmp
ACTFEMDIR = `pwd`
REGRESSDIR = femregress
SUBDIRS = `ls -dF * | grep '/' | sed -e 's/\///'`
FEMLIBS = femcheck post hcbs
FEMGRID = grid
FEMMESH = mesh
FEMPROG = fem3d femplot femadj
FEMUTIL = $(REGRESSDIR) femdoc fembin femlib femanim
FEMOPT = femgotm femersem
FEMEXTRA =
PARAMDIRS = fem3d femplot femadj #femspline
SPECIAL = Makefile Rules.make README CHANGES
SPECIAL = Makefile Rules.make \
BUG COMMIT FAQ LOG README VERSION
VERSION = `head -1 $(FEMDIR)/VERSION | sed -e 's/ */ /g' | cut -f4 -d" "`
COMMIT = `head -1 $(FEMDIR)/VERSION | sed -e 's/ */ /g' | cut -f5 -d" "`
VERSNAME = `head -1 $(FEMDIR)/VERSION | sed -e 's/ */ /g' | cut -f4 -d" " | sed -e 's/VERS_//'`
DATE = `date "+%F"`
TARNAME = $(VERSION)
BETANAME = $(VERSNAME)_beta_$(DATE)
TARDIR = $(TMPDIR)/fem_$(TARNAME)
BETADIR = $(TMPDIR)/shyfem-$(BETANAME)
#---------------------------------------------------------------
FEMTOTS = $(FEMLIBS) $(FEMGRID) $(FEMMESH) $(FEMPROG) $(FEMUTIL) $(FEMOPT)
ifeq ($(GOTM),true)
SUBDIRS +=
FEMEXTRA += femgotm
endif
ifeq ($(ECOLOGICAL),ERSEM)
SUBDIRS += femersem/src
FEMEXTRA += femersem/src
endif
FEMDIRS = $(FEMLIBS) $(FEMEXTRA) $(FEMGRID) $(FEMMESH) $(FEMPROG) $(FEMUTIL)
FEMNOGRAPH = $(FEMLIBS) $(FEMEXTRA) $(FEMMESH) $(FEMPROG) $(FEMUTIL)
.IGNORE: clean
.PHONY: publish version stable
#---------------------------------------------------------------
# compiling and recursive targets
#---------------------------------------------------------------
default:
@echo " shyfem - version $(VERSION) $(COMMIT)"
@echo ' run "make help" for more information'
@echo ' if you are new to shyfem run "make first_time"'
all: fem doc
@cd fem3d; make compatibility
fem: checkv directories links test_executable
@$(FEMBIN)/recursivemake $@ $(FEMDIRS)
@femcheck/check_compilation.sh -quiet
para_get:
@cd fempara; ./para_get.sh $(PARADIR)
para_compile:
@cd fempara; ./para_setup.sh $(PARADIR)
#@cd $(PARADIR)/src; make clean; make lib
@cd $(PARADIR)/src; make lib
para_clean:
@cd $(PARADIR)/src; make clean
bfm_compile:
@fembfm1/bfm_compile.sh $(BFMDIR)
nograph: checkv directories links test_executable
@$(FEMBIN)/recursivemake fem $(FEMNOGRAPH)
@femcheck/check_compilation.sh -quiet -nograph
docs: doc
doc:
@cd femdoc; make doc
dirs:
@echo "listing subdirectories (first level)"
@echo $(SUBDIRS)
dirf:
@echo "listing femdirectories (first level)"
@echo $(FEMDIRS)
list:
@$(FEMBIN)/recursivemake $@ $(FEMDIRS)
depend:
@$(FEMBIN)/recursivemake $@ $(FEMDIRS)
directories:
@-mkdir -p tmp
@-mkdir -p femlib/mod
@if [ ! -f ./tmp/Makefile ]; then cp ./femdummy/Makefile ./tmp; fi
@if [ ! -f ./arc/Makefile ]; then cp ./femdummy/Makefile ./arc; fi
links:
@-rm -fr bin lib
@-ln -sf fembin bin
@-ln -sf femlib lib
@if [ ! -d ./femregress ]; then ln -fs femdummy femregress; fi
#---------------------------------------------------------------
# cleaning
#---------------------------------------------------------------
cleanlocal:
-rm -f fem.tar fem.tar.gz
-rm -f changed_zip.zip
-rm -f *~
-rm -f *.tmp *.bak *.out
-rm -f ggg hhh
-rm -f errout.dat a.out plot.ps
-rm -f .memory
-rm -f CHECKLOG
clean: cleanlocal
$(FEMBIN)/recursivemake $@ $(SUBDIRS)
cleanall: cleanlocal cleanregress
$(FEMBIN)/recursivemake $@ $(SUBDIRS)
cleandist: cleanall
cleanregress:
if [ -d $(REGRESSDIR) ]; then cd $(REGRESSDIR); make cleanall; fi
cleanbck:
-rm -rf *.bck
#---------------------------------------------------------------
# public commands
#---------------------------------------------------------------
help:
@echo "help this screen"
@echo "help_dev more help for developers"
@echo "first_time what to do for the first time"
@echo "install installs the model"
@echo "configure configures the model"
@echo "fem compiles everything"
@echo "bfm_compile sets up BFM module"
@echo "nograph compiles everything except graphics"
@echo "compat compiles compatibility routines"
@echo "doc makes documentation"
@echo "all compiles everything and makes documentation"
@echo "clean, cleanall cleans installation from tmp and obj files"
@echo "version returns version of this distribution"
@echo "info general options from Rules.make"
@echo "check_software checks needed software"
@echo "check_compilation checks if all executables have compiled"
@echo "changed finds files changed after installation"
@echo "changed_zip zips files changed after installation"
first_time:
@echo 'Recommended use if you see shyfem for the first time:'
@echo ' make help gives overview of possible commands'
@echo 'Commands to run only for the first time:'
@echo ' make check_software checks availability of software'
@echo ' make configure configures the use of the model'
@echo ' make install installs the model'
@echo ' make fem compiles the model'
@echo 'Commands to run everytime you change something in the model:'
@echo ' make cleanall cleans directories'
@echo ' make fem compiles the model'
version:
@echo $(VERSION) $(COMMIT)
tag:
@echo $(VERSION)
info: version
@echo "general:"
@echo " version = $(VERSNAME)"
@echo " DISTRIBUTION_TYPE = $(DISTRIBUTION_TYPE)"
@echo " SHYFEM directory = $(SHYFEMDIR)"
@echo "macros:"
@echo " COMPILER = $(COMPILER)"
@echo " PARALLEL_OMP = $(PARALLEL_OMP)"
@echo " PARALLEL_MPI = $(PARALLEL_MPI)"
@echo " SOLVER = $(SOLVER)"
@echo " NETCDF = $(NETCDF)"
@echo " GOTM = $(GOTM)"
@echo " ECOLOGICAL = $(ECOLOGICAL)"
@echo "parameters:"
@echo " NKNDIM = $(NKNDIM)"
@echo " NELDIM = $(NELDIM)"
@echo " NLVDIM = $(NLVDIM)"
@echo "compiler:"
@echo " FORTRAN = $(F77)"
@echo " CC = $(CC)"
@echo "compiler options:"
@echo " PROFILE = $(PROFILE)"
@echo " DEBUG = $(DEBUG)"
@echo " OPTIMIZE = $(OPTIMIZE)"
@echo " WARNING = $(WARNING)"
@echo "compiler version:"
@make compiler_version
check: check_software
check_software:
@cd femcheck; ./check_software.sh
configure:
@cd femcheck; ./configure.sh
check_compilation:
@femcheck/check_compilation.sh
modified: changed
changed:
@femcheck/find_changed.sh
changed_zip:
zip changed_zip.zip `femcheck/find_changed.sh`
@echo "changed files have bin zipped to changed_zip.zip"
advance_time:
touch -d "`date -R -r VERSION` + 5 seconds" VERSION
#--------------------------------------------------------
# installing
#--------------------------------------------------------
#install: install_hard install_soft
install: install_soft
install_soft: checkv
$(FEMBIN)/shyfem_install_soft.sh
install_hard: checkv
$(FEMBIN)/shyfem_install_hard.sh
uninstall: install_hard_reset install_soft_reset
install_soft_reset: checkv
$(FEMBIN)/shyfem_install_soft.sh -reset
install_hard_reset: checkv
$(FEMBIN)/shyfem_install_hard.sh -reset
#--------------------------------------------------------
# private and admin commands
#--------------------------------------------------------
ggu_help: help_ggu
help_ggu:
@echo "rules_ggu_save saves my Rules.make file"
@echo "rules_ggu_restore restores my Rules.make file"
@echo "rules_nemunas copy Rules.make for nemunas server"
@echo "rules_lagoon copy Rules.make for lagoon"
@echo "rules_carbonium copy Rules.make for carbonium"
@echo "nemon set special treatment nemunas server on"
@echo "nemoff set special treatment nemunas server off"
@echo "git_nemunas enable git for push on nemunas server"
help_dev:
@echo "help_dev this screen"
@echo "test_compile compiles model with different configs"
@#echo "test_stable compiles stable model with different configs"
@echo "regress runs regression tests"
@echo "compile_regress compiles model and runs regression tests"
@echo "check_var does various checks on distribution"
@#echo "stable makes stable distribution of last version"
@echo "compiler_version info on compiler"
@echo "last_commit name of last commit"
@echo "dist prepares distribution (Rules.make)"
@echo "rules_save saves actual Rules.make file"
@echo "rules_restore restores last saved Rules.make file"
@echo "rules_dist substitutes Rules.make with Rules.dist file"
@echo "rules_new copies Rules.make file to Rules.dist"
@echo "rules_diff difference between Rules.make and Rules.dist"
@echo "advance_time advances modification time of VERSION"
@echo "make_executable makes scripts executable"
test_compile:
@femcheck/test_compile.sh
compile_regress:
@femcheck/test_compile.sh -regress
test_stable:
@femcheck/test_stable.sh
check_var:
@femcheck/check_var.sh
regress:
if [ -d $(REGRESSDIR) ]; then SHYFEMDIR=$(PWD); \
cd $(REGRESSDIR); make regress; fi
revision:
$(FEMBIN)/revision_last.sh
rules_save:
mkdir -p arc/rules
cp -f ./Rules.make arc/rules/Rules.save
cp -f femcheck/rules/Rules.dist ./Rules.make
rules_restore:
cp -f arc/rules/Rules.save ./Rules.make
rules_dist:
cp -f femcheck/rules/Rules.dist ./Rules.make
rules_new:
cp -f ./Rules.make femcheck/rules/Rules.dist
rules_diff:
@-diff femcheck/rules/Rules.dist ./Rules.make || true
dist: cleandist
mkdir -p arc/rules
mv --backup=numbered ./Rules.make arc/rules/Rules.save
cp -f femcheck/rules/Rules.dist ./Rules.make
make doc; make clean
stable:
@stable/make_stable.sh $(FEMDIR)/arc/shyfem-$(VERSNAME).tar.gz
beta: cleanall
date > LASTTAR
echo "$(BETANAME)"
rm -rf $(TMPDIR)/fem.tar $(TMPDIR)/fem_VERS_* $(TMPDIR)/shyfem-*
mkdir -p $(BETADIR)
cp -al $(FEMTOTS) $(SPECIAL) $(BETADIR)
cd $(BETADIR); ./fembin/shyfem_beta.sh
cd $(TMPDIR); tar cvf fem.tar shyfem-*
mv -f $(TMPDIR)/fem.tar .
gzip -f fem.tar
rm -rf $(TMPDIR)/fem.tar $(BETADIR)
mv fem.tar.gz shyfem-$(BETANAME).tar.gz
publish:
@fembin/fempub.sh shyfem_$(TARNAME).tar.gz
compiler_version:
$(F77) $(FINFOFLAGS)
$(CC) $(CINFOFLAGS)
last_commit:
@gittags | tail -1
shyfemdir:
@echo "shyfemdir: $(SHYFEMDIR)"
compat:
@cd fem3d; make compat
#---------------------------------------------------------------
# special targets for ggu
#---------------------------------------------------------------
rules_ggu_save:
mkdir -p arc/rules
cp -f ./Rules.make arc/rules/Rules.ggu
cp -f femcheck/rules/Rules.dist ./Rules.make
rules_ggu_restore:
cp -f arc/rules/Rules.ggu ./Rules.make
rules_nemunas:
cp -f arc/rules/Rules.nemunas ./Rules.make
rules_lagoon:
cp -f arc/rules/Rules.lagoon ./Rules.make
rules_carbonium:
cp -f arc/rules/Rules.carbonium ./Rules.make
nemon:
fem3d/bin/nemunas_adjust.sh -nemunas
nemoff:
fem3d/bin/nemunas_adjust.sh -original
git_nemunas:
. fem3d/bin/nemunas-git.sh
#---------------------------------------------------------------
# check if routines are executable
#---------------------------------------------------------------
test_executable:
@if [ ! -x fembin/make_executable.sh ]; then make make_executable; fi
make_executable:
@echo "making programs executable"
chmod +x fembin/*
fembin/make_executable.sh
#---------------------------------------------------------------
# compatibility checks
#---------------------------------------------------------------
checkv: $(RULES_MAKE_COMPATIBILITY) $(RULES_MAKE_PARAMETERS)
RULES_MAKE_OK:
RULES_MAKE_NOT_COMPATIBLE:
@echo "*** incompatible version of Rules.make file"
@echo "provided: $(RULES_MAKE_VERSION)"
@echo "expected: $(RULES_MAKE_EXPECTED)"
@echo "please adapt your Rules.make file to the latest version"
@exit 1
RULES_MAKE_PARAMETER_ERROR:
@echo "*** incompatible parameters in Rules.make file"
@echo "$(RULES_MAKE_MESSAGE)"
@echo "please adapt your Rules.make file"
@exit 1
#---------------------------------------------------------------
# end of Makefile
#---------------------------------------------------------------