-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile.am
285 lines (251 loc) · 8.52 KB
/
Makefile.am
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
#-----------------------------------------------------------------------
#
# This file is part of ITU RegESM.
#
# ITU RegESM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ITU RegESM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ITU RegESM. If not, see <http://www.gnu.org/licenses/>.
#
#-----------------------------------------------------------------------
vpath %.o util:.
vpath %.o cop:.
SUBDIRS = cop util
UTILLIBPTH = util
LIBS = -L$(UTILLIBPTH) -lesmutil
CPPFLAGS += -I$(UTILLIBPTH)
if DO_COMPILE_LIBESMF
LIBS += $(ESMFLIBPTH)
CPPFLAGS += $(ESMFINCPTH)
endif
noinst_LIBRARIES =
if DO_COMPILE_LIBATM
LIBS += ${PWD}/libatm.a
noinst_LIBRARIES += libatm.a
libatm_a_SOURCES =
if DO_COMPILE_RCM
CPPFLAGS += -I$(ATM_PREFIX)/Main -I$(ATM_PREFIX)/Main/mpplib \
-I$(ATM_PREFIX)/Main/batslib -I$(ATM_PREFIX)/Share
libatm_a_LIBADD = $(wildcard $(ATM_PREFIX)/Main/*.o) \
$(wildcard $(ATM_PREFIX)/Main/*/*.o) \
$(wildcard $(ATM_PREFIX)/Main/*/*/*.o) \
$(wildcard $(ATM_PREFIX)/Share/*.o)
endif
if DO_COMPILE_WRF
CPPFLAGS += -I$(ATM_PREFIX)/Registry \
-I$(ATM_PREFIX)/inc \
-I$(ATM_PREFIX)/arch \
-I$(ATM_PREFIX)/frame \
-I$(ATM_PREFIX)/external/esmf_time_f90 \
-I$(ATM_PREFIX)/main \
-I$(ATM_PREFIX)/share
libatm_a_LIBADD = $(wildcard $(ATM_PREFIX)/external/RSL_LITE/*.o) \
$(wildcard $(ATM_PREFIX)/external/io_netcdf/*.o) \
$(wildcard $(ATM_PREFIX)/external/io_grib1/*.o) \
$(wildcard $(ATM_PREFIX)/external/io_grib1/*/*.o) \
$(wildcard $(ATM_PREFIX)/external/io_int/*.o) \
$(wildcard $(ATM_PREFIX)/external/io_grib_share/*.o) \
$(wildcard $(ATM_PREFIX)/external/fftpack/*/*.o) \
$(wildcard $(ATM_PREFIX)/external/esmf_time_f90/*.o) \
$(wildcard $(ATM_PREFIX)/phys/*.o) \
$(wildcard $(ATM_PREFIX)/share/*.o) \
$(wildcard $(ATM_PREFIX)/frame/*.o) \
$(wildcard $(ATM_PREFIX)/dyn_em/*.o) \
$(ATM_PREFIX)/main/module_wrf_top.o
endif
endif
SFILES = ""
if DO_COMPILE_LIBOCN
LIBS += ${PWD}/libocn.a
CPPFLAGS += -I$(OCN_PREFIX)
noinst_LIBRARIES += libocn.a
libocn_a_SOURCES =
if DO_COMPILE_ROMS
SFILES += $(OCN_PREFIX)/master.o
endif
if DO_COMPILE_MIT
SFILES += $(OCN_PREFIX)/main.o
endif
OFILES = $(filter-out $(SFILES), $(wildcard $(OCN_PREFIX)/*.o))
libocn_a_LIBADD = $(OFILES)
endif
if DO_COMPILE_LIBRTM
LIBS += ${PWD}/librtm.a
CPPFLAGS += -I$(RTM_PREFIX)
noinst_LIBRARIES += librtm.a
librtm_a_SOURCES =
skip_files = $(RTM_PREFIX)/hdmain.o
librtm_a_LIBADD = $(filter-out $(skip_files), $(wildcard $(RTM_PREFIX)/*.o))
endif
if DO_COMPILE_LIBWAV
LIBS += ${PWD}/libwav.a
CPPFLAGS += -I$(WAV_PREFIX)
noinst_LIBRARIES += libwav.a
libwav_a_SOURCES =
skip_files = $(WAV_PREFIX)/chief.o \
$(WAV_PREFIX)/preproc.o \
$(WAV_PREFIX)/print_grid_file.o \
$(WAV_PREFIX)/print_radiation_file.o \
$(WAV_PREFIX)/print_time.o \
$(WAV_PREFIX)/print_spectra_file.o
libwav_a_LIBADD = $(filter-out $(skip_files), $(wildcard $(WAV_PREFIX)/*.o))
endif
if DO_COMPILE_PARAVIEW
COPLIBPTH = cop
LIBS += -L$(COPLIBPTH) -lcop -L$(PVDIR)/lib `$(PVDIR)/bin/paraview-config --libs \
vtkCommonCore \
vtkCommonDataModel \
vtkPVCatalyst \
vtkPVPythonCatalyst \
vtkParallelMPI \
vtkVTKm | cut -d ' ' -f3-`
CPPFLAGS += -I$(PVSRC)/VTK/Common/Core \
-I$(PVSRC)/VTK/Utilities/KWIML \
-I$(PVSRC)/VTK/Common/DataModel \
-I$(PVSRC)/CoProcessing/Catalyst \
-I$(PVSRC)/CoProcessing/PythonCatalyst \
-I$(PVSRC)/VTK/Parallel/MPI \
-I$(PVSRC)/VTK/IO/XMLParser \
-I$(PVDIR)/VTK/Common/Core \
-I$(PVDIR)/VTK/Utilities/KWIML \
-I$(PVDIR)/VTK/Common/DataModel \
-I$(PVDIR)/CoProcessing/Catalyst \
-I$(PVDIR)/ParaViewCore/ServerManager/SMApplication \
-I$(PVDIR)/ParaViewCore/ServerManager/Core \
-I$(PVDIR)/ParaViewCore/ServerImplementation/Core \
-I$(PVDIR)/ParaViewCore/ClientServerCore/Core \
-I$(PVDIR)/VTK/Filters/Extraction \
-I$(PVDIR)/VTK/Filters/Core \
-I$(PVDIR)/VTK/Filters/General \
-I$(PVDIR)/VTK/Filters/Statistics \
-I$(PVDIR)/VTK/Filters/Parallel \
-I$(PVDIR)/VTK/Filters/Geometry \
-I$(PVDIR)/VTK/Filters/Modeling \
-I$(PVDIR)/VTK/Filters/Sources \
-I$(PVDIR)/VTK/Rendering/Core \
-I$(PVDIR)/ParaViewCore/VTKExtensions/Core \
-I$(PVDIR)/CoProcessing/PythonCatalyst \
-I$(PVDIR)/VTK/Parallel/MPI \
-I$(PVDIR)/VTK/IO/Image \
-I$(COPLIBPTH) \
-I.
endif
bin_PROGRAMS = regesm.x
regesm_x_SOURCES = regesm.F90 mod_esmf_esm.F90 mod_esmf_cpl.F90
if DO_COMPILE_LIBATM
if DO_COMPILE_RCM
regesm_x_SOURCES += mod_esmf_atm_rcm.F90
endif
if DO_COMPILE_WRF
regesm_x_SOURCES += mod_esmf_atm_wrf.F90
endif
else
regesm_x_SOURCES += mod_esmf_atm_void.F90
endif
if DO_COMPILE_LIBOCN
if DO_COMPILE_ROMS
regesm_x_SOURCES += mod_esmf_ocn_roms.F90
endif
if DO_COMPILE_MIT
regesm_x_SOURCES += mod_esmf_ocn_mit.F90
endif
else
regesm_x_SOURCES += mod_esmf_ocn_void.F90
endif
if DO_COMPILE_LIBRTM
regesm_x_SOURCES += mod_esmf_rtm.F90
else
regesm_x_SOURCES += mod_esmf_rtm_void.F90
endif
if DO_COMPILE_LIBWAV
regesm_x_SOURCES += mod_esmf_wav.F90
else
regesm_x_SOURCES += mod_esmf_wav_void.F90
endif
if DO_COMPILE_PARAVIEW
regesm_x_SOURCES += mod_esmf_cop.F90
else
regesm_x_SOURCES += mod_esmf_cop_void.F90
endif
FCLD = $(MPIFC)
%.o: %.f90
$(FC) $(CPPFLAGS) $(FCFLAGS) -c $<
%.o: %.F90
$(FC) $(CPPFLAGS) $(SVNDEF) $(FCFLAGS) -c $<
distclean-local:
rm -f *.mod mod_mit_gcm.F90 prefix.def
clean-local:
rm -f *.mod mod_mit_gcm.F90 prefix.def
# ----------------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend depends on it.
#
# RegESM Main Program
#
OBJ=
if DO_COMPILE_LIBATM
if DO_COMPILE_RCM
mod_esmf_atm_rcm.o: mod_esmf_atm_rcm.F90 mod_types.o mod_shared.o
OBJ+=mod_esmf_atm_rcm.o
endif
if DO_COMPILE_WRF
mod_esmf_atm_wrf.o: mod_esmf_atm_wrf.F90 mod_types.o mod_shared.o
#mod_esmf_atm_wrf.o: modify_libatm mod_esmf_atm_wrf.F90 mod_types.o mod_shared.o
OBJ+=mod_esmf_atm_wrf.o
endif
else
mod_esmf_atm_void.o: mod_esmf_atm_void.F90
OBJ+=mod_esmf_atm_void.o
endif
if DO_COMPILE_LIBOCN
if DO_COMPILE_ROMS
mod_esmf_ocn_roms.o: mod_esmf_ocn_roms.F90 mod_types.o mod_shared.o
OBJ+=mod_esmf_ocn_roms.o
endif
if DO_COMPILE_MIT
mod_mit_gcm.F90: $(OCN_PREFIX)/DUMMY.f
tools/other/create.sh $(OCN_PREFIX)/DUMMY.f | \
$(AWK) -f tools/other/awk.prog | $(SED) -e 's/\([0-9]\) d \([0-9]\)/\1d\2/g' > mod_mit_gcm.F90
mod_esmf_ocn_mit.o: mod_esmf_ocn_mit.F90 mod_types.o mod_shared.o mod_mit_gcm.o
mod_mit_gcm.o: mod_mit_gcm.F90
OBJ+=mod_esmf_ocn_mit.o
endif
else
mod_esmf_ocn_void.o: mod_esmf_ocn_void.F90
OBJ+=mod_esmf_ocn_void.o
endif
if DO_COMPILE_LIBRTM
mod_esmf_rtm.o: mod_esmf_rtm.F90 mod_types.o mod_shared.o
OBJ+=mod_esmf_rtm.o
else
mod_esmf_rtm_void.o: mod_esmf_rtm_void.F90
OBJ+=mod_esmf_rtm_void.o
endif
if DO_COMPILE_LIBWAV
mod_esmf_wav.o: mod_esmf_wav.F90 mod_types.o
OBJ+=mod_esmf_wav.o
else
mod_esmf_wav_void.o: mod_esmf_wav_void.F90 mod_types.o
OBJ+=mod_esmf_wav_void.o
endif
if DO_COMPILE_PARAVIEW
mod_esmf_cop.o: mod_esmf_cop.F90 mod_types.o $(COPLIBPTH)/libcop.a
OBJ+=mod_esmf_cop.o
else
mod_esmf_cop_void.o: mod_esmf_cop_void.F90 mod_types.o
OBJ+=mod_esmf_cop_void.o
endif
#modify_libatm:
# nm libatm.a | $(GREP) -v "r __" | $(GREP) -v ".o:" | $(GREP) -e "^0" | $(GREP) -e "esmf" | $(SED) -e 's/^ *//' -e 's/ *$$//' -e '/^$$/d' | sort | uniq | $(AWK) '{print $$3" wrf_"$$3}' > prefix.def
# objcopy --redefine-syms=prefix.def libatm.a
mod_esmf_cpl.o: mod_esmf_cpl.F90 mod_types.o mod_utils.o
mod_esmf_esm.o: mod_esmf_esm.F90 mod_types.o $(OBJ) mod_esmf_cpl.o
regesm.o: regesm.F90 $(OBJ) mod_esmf_esm.o mod_esmf_cpl.o $(UTILLIBPTH)/libesmutil.a
$(MPIFC) $(CPPFLAGS) $(FCFLAGS) -c $<