forked from DOI-USGS/COAWST
-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
executable file
·789 lines (645 loc) · 25.4 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
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
# svn $Id: makefile 1054 2021-03-06 19:47:12Z arango $
#::::::::::::::::::::::::::::::::::::::::::::::::::::: Hernan G. Arango :::
# Copyright (c) 2002-2021 The ROMS/TOMS Group Kate Hedstrom :::
# Licensed under a MIT/X style license :::
# See License_ROMS.txt :::
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# :::
# ROMS/TOMS Framework Master Makefile :::
# :::
# This makefile is designed to work only with GNU Make version 3.80 or :::
# higher. It can be used in any architecture provided that there is a :::
# machine/compiler rules file in the "Compilers" subdirectory. You :::
# may need to modify the rules file to specify the correct path for :::
# the NetCDF and ARPACK libraries. The ARPACK library is only used in :::
# the Generalized Stability Theory analysis and Laczos algorithm. :::
# :::
# If appropriate, the USER needs to modify the macro definitions in :::
# in user-defined section below. To activate an option set the macro :::
# to "on". For example, if you want to compile with debugging options :::
# set: :::
# :::
# USE_DEBUG := on :::
# :::
# Otherwise, leave macro definition blank. :::
# :::
# The USER needs to provide a value for the macro FORT. Choose the :::
# appropriate value from the list below. :::
# :::
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
ifneq (3.80,$(firstword $(sort $(MAKE_VERSION) 3.80)))
$(error This makefile requires GNU make version 3.80 or higher. \
Your current version is: $(MAKE_VERSION))
endif
#--------------------------------------------------------------------------
# Initialize some things.
#--------------------------------------------------------------------------
sources :=
libraries :=
c_sources :=
#==========================================================================
# Start of user-defined options. In some macro definitions below: "on" or
# any other string means TRUE while blank (or spaces) is FALSE.
#==========================================================================
#
# The CPP option defining a particular application is specified below.
# See header file "ROMS/Include/cppdefs.h" for all available idealized
# and realistic applications CPP flags. For example, to activate the
# upwelling test case (UPWELLING) set:
#
# ROMS_APPLICATION ?= UPWELLING
#
# Notice that this makefile will include the associated application header
# file, which is located either in the "ROMS/Include" or MY_HEADER_DIR
# directory. This makefile is designed to search in both directories.
# The only constrain is that the application CPP option must be unique
# and header file name is the lowercase value of ROMS_APPLICATION with
# the .h extension. For example, the upwelling application includes the
# "upwelling.h" header file.
ROMS_APPLICATION ?= UPWELLING
# If application header files is not located in "ROMS/Include",
# provide an alternate directory FULL PATH.
MY_HEADER_DIR ?=
# If your application requires analytical expressions and they are
# not located in "ROMS/Functionals", provide an alternate directory.
# Notice that a set analytical expressions templates can be found in
# "User/Functionals".
#
# If applicable, also used this directory to place your customized
# biology model header file (like fennel.h, nemuro.h, ecosim.h, etc).
MY_ANALYTICAL_DIR ?=
# Sometimes it is desirable to activate one or more CPP options to
# run different variants of the same application without modifying
# its header file. If this is the case, specify such options here
# using the -D syntax. For example, to write time-averaged fields
# set:
#
# MY_CPP_FLAGS ?= -DAVERAGES
#
MY_CPP_FLAGS ?=
# Activate debugging compiler options:
USE_DEBUG ?=
# If parallel applications, use at most one of these definitions
# (leave both definitions blank in serial applications):
USE_MPI ?=
USE_OpenMP ?=
# If distributed-memory, turn on compilation via the script "mpif90".
# This is needed in some Linux operating systems. In some systems with
# native MPI libraries the compilation does not require MPICH type
# scripts. This macro is also convient when there are several fortran
# compiliers (ifort, pgf90, pathf90) in the system that use mpif90.
# In this, case the user need to select the desired compiler below and
# turn on both USE_MPI and USE_MPIF90 macros.
USE_MPIF90 ?=
# If applicable, activate 64-bit compilation:
USE_LARGE ?=
# If applicable, link with NetCDF-4 library. Notice that the NetCDF-4
# library needs both the HDF5 and MPI libraries.
USE_NETCDF4 ?=
#--------------------------------------------------------------------------
# We are going to include a file with all the settings that depend on
# the system and the compiler. We are going to build up the name of the
# include file using information on both. Set your compiler here from
# the following list:
#
# Operating System Compiler(s)
#
# AIX: xlf
# ALPHA: f90
# CYGWIN: g95, df, ifort
# Darwin: f90, xlf
# IRIX: f90
# Linux: ftn, ifc, ifort, pgi, path, g95, gfortran
# SunOS: f95
# UNICOS-mp: ftn
# SunOS/Linux: ftn (Cray cross-compiler)
#
# Feel free to send us additional rule files to include! Also, be sure
# to check the appropriate file to make sure it has the right paths to
# NetCDF and so on.
#--------------------------------------------------------------------------
FORT ?= gfortran
#--------------------------------------------------------------------------
# Set directory for executable.
#--------------------------------------------------------------------------
BINDIR ?= .
#==========================================================================
# End of user-defined options. See also the machine-dependent include
# file being used above.
#==========================================================================
#--------------------------------------------------------------------------
# Set directory for temporary objects.
#--------------------------------------------------------------------------
SCRATCH_DIR ?= Build
clean_list := core *.ipo $(SCRATCH_DIR)
ifeq "$(strip $(SCRATCH_DIR))" "."
clean_list := core *.o *.oo *.mod *.f90 lib*.a *.bak
clean_list += $(CURDIR)/*.ipo
endif
ifeq "$(strip $(SCRATCH_DIR))" "./"
clean_list := core *.o *.oo *.ipo *.mod *.f90 lib*.a *.bak
clean_list += $(CURDIR)/*.ipo
endif
ifdef USE_ROMS
#--------------------------------------------------------------------------
# Notice that the token "libraries" is initialized with the ROMS/Utility
# library to account for calls to objects in other ROMS libraries or
# cycling dependencies. These types of dependencies are problematic in
# some compilers during linking. Such libraries appear twice at linking
# step (beginning and almost the end of ROMS library list).
#--------------------------------------------------------------------------
libraries := $(SCRATCH_DIR)/libNLM.a $(SCRATCH_DIR)/libDRIVER.a \
$(SCRATCH_DIR)/libUTIL.a
endif
#--------------------------------------------------------------------------
# Set Pattern rules.
#--------------------------------------------------------------------------
%.o: %.F
%.o: %.f90
cd $(SCRATCH_DIR); $(FC) -c $(FFLAGS) $(notdir $<)
%.f90: %.F
$(CPP) $(CPPFLAGS) $(MY_CPP_FLAGS) $< > $*.f90
$(CLEAN) $*.f90
CLEAN := ROMS/Bin/cpp_clean
#--------------------------------------------------------------------------
# Set C-preprocessing flags associated with ROMS application. They are
# used in "ROMS/Include/cppdefs.h" to include the appropriate application
# header file.
#--------------------------------------------------------------------------
ifdef ROMS_APPLICATION
HEADER := $(addsuffix .h, \
$(shell echo ${ROMS_APPLICATION} | tr [A-Z] [a-z]))
ROMS_CPPFLAGS := -D$(ROMS_APPLICATION)
ROMS_CPPFLAGS += -D'HEADER="$(HEADER)"'
ifdef MY_HEADER_DIR
ROMS_CPPFLAGS += -D'ROMS_HEADER="$(MY_HEADER_DIR)/$(HEADER)"'
else
ROMS_CPPFLAGS += -D'ROMS_HEADER="$(HEADER)"'
endif
ifdef MY_CPP_FLAGS
ROMS_CPPFLAGS += $(MY_CPP_FLAGS)
endif
endif
#--------------------------------------------------------------------------
# Internal macro definitions used to select the code to compile and
# additional libraries to link. It uses the CPP activated in the
# header file ROMS/Include/cppdefs.h to determine macro definitions.
#--------------------------------------------------------------------------
COMPILERS ?= $(CURDIR)/Compilers
MAKE_MACROS := $(shell echo ${HOME} | sed 's| |\\ |g')/make_macros.mk
ifneq "$(MAKECMDGOALS)" "clean"
ifneq "$(MAKECMDGOALS)" "tarfile"
MACROS := $(shell cpp -P $(ROMS_CPPFLAGS) Compilers/make_macros.h > \
$(MAKE_MACROS); $(CLEAN) $(MAKE_MACROS))
GET_MACROS := $(wildcard $(SCRATCH_DIR)/make_macros.*)
ifdef GET_MACROS
include $(SCRATCH_DIR)/make_macros.mk
else
include $(MAKE_MACROS)
endif
endif
endif
clean_list += $(MAKE_MACROS)
#--------------------------------------------------------------------------
# Make functions for putting the temporary files in $(SCRATCH_DIR)
# DO NOT modify this section; spaces and blank lines are needed.
#--------------------------------------------------------------------------
# $(call source-dir-to-binary-dir, directory-list)
source-dir-to-binary-dir = $(addprefix $(SCRATCH_DIR)/, $(notdir $1))
# $(call source-to-object, source-file-list)
source-to-object = $(call source-dir-to-binary-dir, \
$(subst .F,.o,$1))
# $(call source-to-object, source-file-list)
c-source-to-object = $(call source-dir-to-binary-dir, \
$(subst .c,.o,$(filter %.c,$1)) \
$(subst .cc,.o,$(filter %.cc,$1)))
# $(call make-library, library-name, source-file-list)
define make-library
libraries += $(SCRATCH_DIR)/$1
sources += $2
$(SCRATCH_DIR)/$1: $(call source-dir-to-binary-dir, \
$(subst .F,.o,$2))
$(AR) $(ARFLAGS) $$@ $$^
$(RANLIB) $$@
endef
# $(call make-c-library, library-name, source-file-list)
define make-c-library
libraries += $(SCRATCH_DIR)/$1
c_sources += $2
$(SCRATCH_DIR)/$1: $(call source-dir-to-binary-dir, \
$(subst .c,.o,$(filter %.c,$2)) \
$(subst .cc,.o,$(filter %.cc,$2)))
$(AR) $(ARFLAGS) $$@ $$^
$(RANLIB) $$@
endef
# $(call f90-source, source-file-list)
f90-source = $(call source-dir-to-binary-dir, \
$(subst .F,.f90,$1))
# $(compile-rules)
define compile-rules
$(foreach f, $(local_src), \
$(call one-compile-rule,$(call source-to-object,$f), \
$(call f90-source,$f),$f))
endef
# $(c-compile-rules)
define c-compile-rules
$(foreach f, $(local_c_src), \
$(call one-c-compile-rule,$(call c-source-to-object,$f), $f))
endef
# $(call one-compile-rule, binary-file, f90-file, source-file)
define one-compile-rule
$1: $2 $3
cd $$(SCRATCH_DIR); $$(FC) -c $$(FFLAGS) $(notdir $2)
$2: $3
$$(CPP) $$(CPPFLAGS) $$(MY_CPP_FLAGS) $$< > $$@
$$(CLEAN) $$@
endef
# $(call one-c-compile-rule, binary-file, source-file)
define one-c-compile-rule
$1: $2
cd $$(SCRATCH_DIR); $$(CXX) -c $$(CXXFLAGS) $$<
endef
#--------------------------------------------------------------------------
# Set ROMS/TOMS executable file name.
#--------------------------------------------------------------------------
BIN := $(BINDIR)/coawstS
ifdef USE_DEBUG
BIN := $(BINDIR)/coawstG
else
ifdef USE_MPI
BIN := $(BINDIR)/coawstM
endif
ifdef USE_OpenMP
BIN := $(BINDIR)/coawstO
endif
endif
#--------------------------------------------------------------------------
# Set name of module files for netCDF F90 interface. On some platforms
# these will need to be overridden in the machine-dependent include file.
#--------------------------------------------------------------------------
NETCDF_MODFILE := netcdf.mod
TYPESIZES_MODFILE := typesizes.mod
#--------------------------------------------------------------------------
# "uname -s" should return the OS or kernel name and "uname -m" should
# return the CPU or hardware name. In practice the results can be pretty
# flaky. Run the results through sed to convert "/" and " " to "-",
# then apply platform-specific conversions.
#--------------------------------------------------------------------------
OS := $(shell uname -s | sed 's/[\/ ]/-/g')
OS := $(patsubst CYGWIN_%,CYGWIN,$(OS))
OS := $(patsubst MINGW%,MINGW,$(OS))
OS := $(patsubst sn%,UNICOS-sn,$(OS))
CPU := $(shell uname -m | sed 's/[\/ ]/-/g')
ROOTDIR := $(shell pwd)
ifndef FORT
$(error Variable FORT not set)
endif
ifneq "$(MAKECMDGOALS)" "clean"
ifneq "$(MAKECMDGOALS)" "tarfile"
MKFILE := $(COMPILERS)/$(OS)-$(strip $(FORT)).mk
include $(MKFILE)
endif
endif
ifdef USE_MPI
ifdef USE_OpenMP
$(error You cannot activate USE_MPI and USE_OpenMP at the same time!)
endif
endif
#--------------------------------------------------------------------------
# Pass the platform variables to the preprocessor as macros. Convert to
# valid, upper-case identifiers. Attach ROMS application CPP options.
#--------------------------------------------------------------------------
CPPFLAGS += -D$(shell echo ${OS} | tr "-" "_" | tr [a-z] [A-Z])
CPPFLAGS += -D$(shell echo ${CPU} | tr "-" "_" | tr [a-z] [A-Z])
CPPFLAGS += -D$(shell echo ${FORT} | tr "-" "_" | tr [a-z] [A-Z])
CPPFLAGS += -D'ROOT_DIR="$(ROOTDIR)"'
ifdef ROMS_APPLICATION
CPPFLAGS += $(ROMS_CPPFLAGS)
CPPFLAGS += -DNestedGrids=$(NestedGrids)
MDEPFLAGS += -DROMS_HEADER="$(HEADER)"
endif
ifndef MY_ANALYTICAL_DIR
MY_ANALYTICAL_DIR := $(ROOTDIR)/ROMS/Functionals
endif
ifeq (,$(findstring ROMS/Functionals,$(MY_ANALYTICAL_DIR)))
MY_ANALYTICAL := on
endif
CPPFLAGS += -D'ANALYTICAL_DIR="$(MY_ANALYTICAL_DIR)"'
ifdef MY_ANALYTICAL
CPPFLAGS += -D'MY_ANALYTICAL="$(MY_ANALYTICAL)"'
endif
CPPFLAGS += -D'SVN_URL="$(SVNURL)"'
CPPFLAGS += -D'SVN_REV="$(SVNREV)"'
#--------------------------------------------------------------------------
# Build target directories.
#--------------------------------------------------------------------------
ifdef USE_ROMS
.PHONY: all
all: $(SCRATCH_DIR) $(SCRATCH_DIR)/MakeDepend $(BIN) rm_macros
endif
ifdef USE_SWAN
.PHONY: all
all: $(SCRATCH_DIR) $(SCRATCH_DIR)/MakeDepend $(BIN) rm_macros
endif
modules :=
ifdef USE_ADJOINT
modules += ROMS/Adjoint \
ROMS/Adjoint/Biology
endif
ifdef USE_REPRESENTER
modules += ROMS/Representer \
ROMS/Representer/Biology
endif
ifdef USE_SEAICE
modules += ROMS/Nonlinear/SeaIce
endif
ifdef USE_TANGENT
modules += ROMS/Tangent \
ROMS/Tangent/Biology
endif
ifdef USE_ROMS
modules += ROMS/Nonlinear \
ROMS/Nonlinear/Biology \
ROMS/Nonlinear/Sediment \
ROMS/Nonlinear/Wec \
ROMS/Nonlinear/Vegetation \
ROMS/Functionals \
ROMS/Utility \
ROMS/Drivers \
ROMS/Modules
endif
includes := ROMS/Include
ifdef MY_ANALYTICAL
includes += $(MY_ANALYTICAL_DIR)
endif
ifdef USE_ADJOINT
includes += ROMS/Adjoint \
ROMS/Adjoint/Biology
endif
ifdef USE_REPRESENTER
includes += ROMS/Representer \
ROMS/Representer/Biology
endif
ifdef USE_SEAICE
includes += ROMS/Nonlinear/SeaIce
endif
ifdef USE_TANGENT
includes += ROMS/Tangent \
ROMS/Tangent/Biology
endif
ifdef USE_ROMS
includes += ROMS/Nonlinear \
ROMS/Nonlinear/Biology \
ROMS/Nonlinear/Sediment \
ROMS/Nonlinear/Wec \
ROMS/Nonlinear/Vegetation \
ROMS/Utility \
ROMS/Drivers \
ROMS/Functionals
endif
ifdef MY_HEADER_DIR
includes += $(MY_HEADER_DIR)
endif
ifdef USE_COAMPS
includes += $(COAMPS_LIB_DIR)
endif
ifdef USE_SWAN
modules += SWAN/Src
includes += SWAN/Src
endif
ifdef USE_INWAVE
modules += InWave/Drivers \
InWave/Action_balance \
InWave/Boundaries \
InWave/Modules \
InWave/Utility
includes += InWave/Drivers \
InWave/Action_balance \
InWave/Boundaries \
InWave/Include \
InWave/Modules \
InWave/Utility
endif
#ifdef USE_WRF
# ifeq "$(strip $(WRF_LIB_DIR))" "$(WRF_SRC_DIR)"
# includes += $(addprefix $(WRF_LIB_DIR)/,$(WRF_MOD_DIRS))
# else
# includes += $(WRF_LIB_DIR)
# endif
#endif
ifdef USE_ROMS
modules += Master
includes += Master Compilers
else ifdef USE_SWAN
modules += Master
includes += Master Compilers
else ifdef USE_WW3
modules += Master
includes += Master Compilers
#else ifdef USE_WRF
# modules += Master
# includes += Master Compilers
endif
vpath %.F $(modules)
vpath %.cc $(modules)
vpath %.h $(includes)
vpath %.f90 $(SCRATCH_DIR)
vpath %.o $(SCRATCH_DIR)
include $(addsuffix /Module.mk,$(modules))
MDEPFLAGS += $(patsubst %,-I %,$(includes)) --silent --moddir $(SCRATCH_DIR)
CPPFLAGS += $(patsubst %,-I%,$(includes))
ifdef MY_HEADER_DIR
CPPFLAGS += -D'HEADER_DIR="$(MY_HEADER_DIR)"'
else
CPPFLAGS += -D'HEADER_DIR="$(ROOTDIR)/ROMS/Include"'
endif
$(SCRATCH_DIR):
$(shell $(TEST) -d $(SCRATCH_DIR) || $(MKDIR) $(SCRATCH_DIR) )
#--------------------------------------------------------------------------
# Add profiling.
#--------------------------------------------------------------------------
# FFLAGS += -check bounds # ifort
# FFLAGS += -C # pgi
# FFLAGS += -xpg # Sun
# FFLAGS += -pg # g95
# FFLAGS += -qp # ifort
# FFLAGS += -Mprof=func,lines # pgi
# FFLAGS += -Mprof=mpi,lines # pgi
# FFLAGS += -Mprof=mpi,hwcts # pgi
# FFLAGS += -Mprof=func # pgi
#--------------------------------------------------------------------------
# Special CPP macros for mod_strings.F
#--------------------------------------------------------------------------
$(SCRATCH_DIR)/mod_strings.f90: CPPFLAGS += -DMY_OS='"$(OS)"' \
-DMY_CPU='"$(CPU)"' -DMY_FORT='"$(FORT)"' \
-DMY_FC='"$(FC)"' -DMY_FFLAGS='"$(FFLAGS)"'
#--------------------------------------------------------------------------
# ROMS/TOMS libraries.
#--------------------------------------------------------------------------
MYLIB := libocean.a
.PHONY: libraries
libraries: $(libraries)
#--------------------------------------------------------------------------
# Build MCT coupler param files.
#--------------------------------------------------------------------------
.PHONY: mct_params
mct_params:
# $(shell $(TEST) -d $(SCRATCH_DIR) || $(MKDIR) $(SCRATCH_DIR) ) \
# cd $(SCRATCH_DIR); \
# cpp -P $(ROMS_CPPFLAGS) -I$(MY_ROMS_SRC)/ROMS/Include $(MY_ROMS_SRC)/Master/MCT_coupler/mod_coupler_kinds.F > mod_coupler_kinds.f90; \
# $(MY_ROMS_SRC)/$(CLEAN) mod_coupler_kinds.f90; \
# $(FC) -c $(FFLAGS) mod_coupler_kinds.f90; \
# cpp -P $(ROMS_CPPFLAGS) -I$(MY_ROMS_SRC)/ROMS/Include $(MY_ROMS_SRC)/Master/MCT_coupler/mct_coupler_params.F > mct_coupler_params.f90; \
# $(MY_ROMS_SRC)/$(CLEAN) mct_coupler_params.f90; \
# $(FC) -c $(FFLAGS) mct_coupler_params.f90;
#--------------------------------------------------------------------------
# Build WW3.
#--------------------------------------------------------------------------
.PHONY: ww3clean
ww3clean:
ifdef USE_WW3
cd $(COAWST_WW3_DIR)/bin; ls; ./w3_clean -c;
echo "cleaned ww3";
endif
.PHONY: ww3
ww3:
ifdef USE_WW3
cp -p $(BIN) $(BIN).backup; \
$(RM) $(BIN); \
$(RM) $(COAWST_WW3_DIR)/obj_DIST/libWW3.a; \
cd $(COAWST_WW3_DIR); ls; \
echo " "; echo " "; \
export FC=$(FC); \
export "FFLAGS=$(FFLAGS)"; \
./coawst_compile_ww3; \
echo ""; \
echo "-------- Finished compiling WW3 ------------"
echo "";
endif
#--------------------------------------------------------------------------
# Build WRF.
#--------------------------------------------------------------------------
.PHONY: wrfclean
wrfclean:
ifdef USE_WRF
cd $(WRF_DIR); ls; ./clean -a; \
./configure; \
echo " "; echo " "; \
echo "cleaned wrf";
endif
.PHONY: wrf
wrf:
ifdef USE_WRF
cp -p $(BIN) $(BIN).backup; \
$(RM) -r $(BIN); \
cd $(WRF_DIR); ls; \
echo " "; echo " "; \
echo "Compiling wrf"; \
./compile em_real; \
echo ""; \
echo "-------- Finished compiling WRF ------------"
ifndef USE_ROMS
ifndef USE_SWAN
ifndef USE_WW3
ln -sf WRF/main/wrf.exe coawstM;
endif
endif
endif
echo "";
endif
#--------------------------------------------------------------------------
# Build WRF_hydro.
#--------------------------------------------------------------------------
.PHONY: wrfhydroclean
wrfhydroclean:
ifdef USE_WRFHYDRO
cd $(WRFHYDRO_DIR); ls; \
./configure; \
make clean; \
echo " "; echo " "; \
echo "cleaned wrf";
endif
.PHONY: wrfhydro
wrfhydro:
ifdef USE_WRFHYDRO
export "WRF_HYDRO=1"; \
export FC=$(FC); \
export "FFLAGS=$(FFLAGS)"; \
export "HEADER=$(HEADER)"; \
export MY_ROMS_SRC=$(MY_ROMS_SRC); \
export "USE_MCT=$(USE_MCT)"; \
cp -p $(BIN) $(BIN).backup; \
$(RM) -r $(BIN); \
cd $(WRFHYDRO_DIR); ls; \
echo " "; echo " "; \
ls; \
echo "Compiling wrfhydro"; \
cp -p compile_offline_NoahMP.sh compile; \
./compile; \
echo ""; \
rm -rf compile; \
echo "-------- Finished compiling WRFhydro ------------"
ifndef USE_ROMS
ifndef USE_SWAN
ifndef USE_WW3
ln -sf WRF/hydro_v5.0/Run/wrf_hydro.exe coawstM;
endif
endif
endif
echo "";
endif
#--------------------------------------------------------------------------
# Target to create ROMS/TOMS dependecies.
#--------------------------------------------------------------------------
ifneq "$(MAKECMDGOALS)" "tarfile"
$(SCRATCH_DIR)/$(NETCDF_MODFILE): | $(SCRATCH_DIR)
cp -f $(NETCDF_INCDIR)/$(NETCDF_MODFILE) $(SCRATCH_DIR)
$(SCRATCH_DIR)/$(TYPESIZES_MODFILE): | $(SCRATCH_DIR)
cp -f $(NETCDF_INCDIR)/$(TYPESIZES_MODFILE) $(SCRATCH_DIR)
$(SCRATCH_DIR)/MakeDepend: makefile \
$(SCRATCH_DIR)/$(NETCDF_MODFILE) \
$(SCRATCH_DIR)/$(TYPESIZES_MODFILE) \
| $(SCRATCH_DIR)
@ $(SFMAKEDEPEND) $(MDEPFLAGS) $(sources) > $(SCRATCH_DIR)/MakeDepend
cp -p $(MAKE_MACROS) $(SCRATCH_DIR)
.PHONY: depend
SFMAKEDEPEND := ./ROMS/Bin/sfmakedepend
depend: $(SCRATCH_DIR)
$(SFMAKEDEPEND) $(MDEPFLAGS) $(sources) > $(SCRATCH_DIR)/MakeDepend
endif
ifneq ($(MAKECMDGOALS),clean)
-include $(SCRATCH_DIR)/MakeDepend
endif
#--------------------------------------------------------------------------
# Target to create ROMS/TOMS tar file.
#--------------------------------------------------------------------------
.PHONY: tarfile
tarfile:
tar --exclude=".svn" --exclude Output -cvf coawst_v3.7.tar *
.PHONY: zipfile
zipfile:
zip -r roms-3_7.zip *
.PHONY: gzipfile
gzipfile:
gzip -v roms-3_7.gzip *
#--------------------------------------------------------------------------
# Cleaning targets.
#--------------------------------------------------------------------------
.PHONY: clean
clean:
$(RM) -r $(clean_list)
.PHONY: rm_macros
rm_macros:
$(RM) -r $(MAKE_MACROS)
#--------------------------------------------------------------------------
# A handy debugging target. This will allow to print the value of any
# makefile defined macro (see http://tinyurl.com/8ax3j). For example,
# to find the value of CPPFLAGS execute:
#
# gmake print-CPPFLAGS
# or
# make print-CPPFLAGS
#--------------------------------------------------------------------------
.PHONY: print-%
print-%:
@echo $* = $($*)