forked from DOI-USGS/volcano-ash3d-metreader
-
Notifications
You must be signed in to change notification settings - Fork 4
/
makefile
254 lines (223 loc) · 9.83 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
##############################################################################
# Makefile for libmetreader.a
#
# User-specified flags are in this top block
#
###############################################################################
# This file is a component of the volcanic ash transport and dispersion model Ash3d,
# written at the U.S. Geological Survey by Hans F. Schwaiger ([email protected]),
# Larry G. Mastin ([email protected]), and Roger P. Denlinger ([email protected]).
# The model and its source code are products of the U.S. Federal Government and therefore
# bear no copyright. They may be copied, redistributed and freely incorporated
# into derivative products. However as a matter of scientific courtesy we ask that
# you credit the authors and cite published documentation of this model (below) when
# publishing or distributing derivative products.
# Schwaiger, H.F., Denlinger, R.P., and Mastin, L.G., 2012, Ash3d, a finite-
# volume, conservative numerical model for ash transport and tephra deposition,
# Journal of Geophysical Research, 117, B04204, doi:10.1029/2011JB008968.
# We make no guarantees, expressed or implied, as to the usefulness of the software
# and its documentation for any purpose. We assume no responsibility to provide
# technical support to users of this software.
# Sequence of commands:
# "make" compiles the libmetreader.a library
# "make all" builds the library, the tools executables and copies to bin
# "make check" runs the test cases in /tests
# "make install" copies the contents of volcano-ash3d-metreader/bin to the install location
# e.g. /opt/USGS
#
# SYSTEM specifies which compiler to use
# Current available options are:
# gfortran , ifort , aocc , nvhpc
# This variable cannot be left blank
#
SYSTEM = gfortran
SYSINC = make_$(SYSTEM).inc
#
# RUN specifies which collection of compilation flags that should be run
# Current available options are:
# DEBUG : includes debugging info and issues warnings
# PROF : includes profiling flags with some optimization
# OPT : includes optimizations flags for fastest runtime
# This variable cannot be left blank
#RUN = DEBUG
#RUN = PROF
RUN = OPT
INSTALLDIR=/opt/USGS
#
# DATA FORMATS
# For each data format you want to include in the library, set the corresponding
# variable below to 'T'. Set to 'F' any you do not want compiled or any unavailable
USENETCDF = T
USEGRIB = T
# MEMORY
# If you need pointer arrays instead of allocatable arrays, set this to 'T'
USEPOINTERS = F
###############################################################################
##### END OF USER SPECIFIED FLAGS ###########################################
###############################################################################
FPPFLAGS =
ifeq ($(USENETCDF), T)
ncFPPFLAG = -DUSENETCDF
ncOBJS = MetReader_NetCDF.o
nclib = -lnetcdf -lnetcdff
else
ncFPPFLAG =
ncOBJS =
nclib =
endif
ifeq ($(USEGRIB), T)
grbFPPFLAG = -DUSEGRIB
grbOBJS = MetReader_GRIB.o MetReader_GRIB_index.o
grblib = -leccodes -leccodes_f90
else
grbFPPFLAG =
grbOBJS =
grblib =
endif
ifeq ($(USEPOINTERS), T)
memFPPFLAG = -DUSEPOINTERS
else
memFPPFLAG =
endif
# location of HoursSince and projection
USGSLIBDIR = -L$(INSTALLDIR)/lib
USGSINC = -I$(INSTALLDIR)/include
USGSLIB = $(USGSINC) $(USGSLIBDIR) -lhourssince -lprojection
###############################################################################
###############################################################################
###############################################################################
# Import the compiler-specific include file. Currently one of:
# GNU Fortran Compiler
# Intel Fortran Compiler
# AMD Optimizing C/C++/Fortran Compiler (aocc)
# Nvidia HPC Fortran Compiler (ncfortran)
include $(SYSINC)
###############################################################################
LIB = libMetReader.a
ifeq ($(USEGRIB), T)
GRIBTOOL = bin/gen_GRIB_index
else
GRIBTOOL =
endif
EXEC = \
bin/MetRegrid \
bin/MetSonde \
bin/MetTraj_F \
bin/MetTraj_B \
bin/MetCheck \
bin/MetProbe \
bin/MR_ASCII_check \
bin/makegfsncml $(GRIBTOOL)
AUTOSCRIPTS = \
autorun_scripts/autorun_gfs.sh \
autorun_scripts/get_gfs.sh \
autorun_scripts/convert_gfs.sh \
autorun_scripts/autorun_nam.sh \
autorun_scripts/get_nam.sh \
autorun_scripts/autorun_NCEP_50YearReanalysis.sh \
autorun_scripts/get_NCEP_50YearReanalysis.sh \
autorun_scripts/grib2nc.sh \
autorun_scripts/prune_windfiles.sh \
autorun_scripts/get_gmao.sh \
autorun_scripts/probe_volc.sh
###############################################################################
# TARGETS
###############################################################################
all: ${lib} tools
lib: $(LIB)
tools: $(EXEC)
libMetReader.a: MetReader.F90 MetReader.o $(ncOBJS) $(grbOBJS) MetReader_Grids.o MetReader_ASCII.o makefile $(SYSINC)
ar rcs libMetReader.a MetReader.o $(ncOBJS) $(grbOBJS) MetReader_Grids.o MetReader_ASCII.o
MetReader.o: MetReader.F90 makefile $(SYSINC)
sh get_version.sh
$(FC) $(FPPFLAGS) $(EXFLAGS) $(LIBS) $(USGSLIB) -c MetReader.F90
MetReader_Grids.o: MetReader_Grids.f90 MetReader.o makefile $(SYSINC)
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(USGSLIB) -c MetReader_Grids.f90
MetReader_ASCII.o: MetReader_ASCII.f90 MetReader.o makefile $(SYSINC)
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(USGSLIB) -c MetReader_ASCII.f90
ifeq ($(USENETCDF), T)
MetReader_NetCDF.o: MetReader_NetCDF.F90 MetReader.o makefile $(SYSINC)
$(FC) $(FPPFLAGS) $(FFLAGS) $(EXFLAGS) $(LIBS) $(nclib) $(USGSLIB) -c MetReader_NetCDF.F90
endif
ifeq ($(USEGRIB), T)
MetReader_GRIB_index.o: MetReader_GRIB_index.f90 makefile $(SYSINC)
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(grblib) $(USGSLIB) -c MetReader_GRIB_index.f90
MetReader_GRIB.o: MetReader_GRIB.f90 MetReader_GRIB_index.o MetReader.o makefile $(SYSINC)
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(grblib) -c MetReader_GRIB.f90
bin/gen_GRIB_index: gen_GRIB_index.f90 MetReader_GRIB_index.o makefile $(SYSINC) libMetReader.a
mkdir -p bin
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(grblib) -c gen_GRIB_index.f90
$(FC) $(FFLAGS) $(EXFLAGS) MetReader_GRIB_index.o gen_GRIB_index.o $(LIBS) $(grblib) -o bin/gen_GRIB_index
endif
bin/MetRegrid: tools/MetRegrid.f90 makefile $(SYSINC) libMetReader.a
mkdir -p bin
$(FC) $(FFLAGS) $(EXFLAGS) tools/MetRegrid.f90 -o bin/MetRegrid -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB)
bin/MetSonde: tools/MetSonde.f90 makefile $(SYSINC) libMetReader.a
mkdir -p bin
$(FC) $(FFLAGS) $(EXFLAGS) -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB) -c tools/MetSonde.f90
$(FC) $(FFLAGS) $(EXFLAGS) MetSonde.o -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB) -o bin/MetSonde
bin/MetTraj_F: tools/MetTraj.F90 makefile $(SYSINC) libMetReader.a
mkdir -p bin
$(FC) $(FPPFLAGS) -DFORWARD $(FFLAGS) $(EXFLAGS) tools/MetTraj.F90 -o bin/MetTraj_F -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB)
bin/MetTraj_B: tools/MetTraj.F90 makefile $(SYSINC) libMetReader.a
mkdir -p bin
$(FC) $(FPPFLAGS) -DBACKWARD $(FFLAGS) $(EXFLAGS) tools/MetTraj.F90 -o bin/MetTraj_B -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB)
bin/MetCheck: tools/MetCheck.f90 makefile $(SYSINC) libMetReader.a
mkdir -p bin
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(nclib) $(grblib) -c tools/MetCheck.f90
$(FC) $(FFLAGS) $(EXFLAGS) MetCheck.o -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB) -o bin/MetCheck
bin/MetProbe: tools/MetProbe.f90 makefile $(SYSINC) libMetReader.a
mkdir -p bin
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(nclib) $(grblib) -c tools/MetProbe.f90
$(FC) $(FFLAGS) $(EXFLAGS) MetProbe.o -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB) -o bin/MetProbe
bin/makegfsncml: tools/makegfsncml.f90 makefile $(SYSINC)
mkdir -p bin
$(FC) $(FFLAGS) $(EXFLAGS) $(LIBS) $(nclib) -c tools/makegfsncml.f90
$(FC) $(FFLAGS) $(EXFLAGS) makegfsncml.o $(LIBS) $(nclib) -o bin/makegfsncml
bin/MR_ASCII_check: tools/MR_ASCII_check.f90 makefile $(SYSINC)
mkdir -p bin
$(FC) $(FFLAGS) $(EXFLAGS) tools/MR_ASCII_check.f90 -o bin/MR_ASCII_check -L./ -lMetReader $(LIBS) $(nclib) $(grblib) $(USGSLIB)
check: $(EXEC)
bash run_tests.sh
clean:
rm -f *.o *__genmod.f90 *__genmod.mod
rm -f *.mod
rm -f lib*.a
rm -f $(EXEC)
install: all
install -d $(INSTALLDIR)/lib/
install -d $(INSTALLDIR)/include/
install -d $(INSTALLDIR)/bin/
install -d $(INSTALLDIR)/bin/autorun_scripts
install -d $(INSTALLDIR)/share
install -m 644 $(LIB) $(INSTALLDIR)/lib/
install -m 644 *.mod $(INSTALLDIR)/include/
install -m 755 $(EXEC) $(INSTALLDIR)/bin/
install -m 755 $(AUTOSCRIPTS) $(INSTALLDIR)/bin/autorun_scripts/
install -m 755 tools/GMT_plot_traj.sh $(INSTALLDIR)/bin/
install -m 644 share/volc_NOVAC.txt $(INSTALLDIR)/share/volc_NOVAC.txt
uninstall:
rm -f $(INSTALLDIR)/lib/$(LIB)
rm -f $(INSTALLDIR)/include/metreader.mod
rm -f $(INSTALLDIR)/bin/MetRegrid
rm -f $(INSTALLDIR)/bin/MetSonde
rm -f $(INSTALLDIR)/bin/MetTraj_F
rm -f $(INSTALLDIR)/bin/MetTraj_B
rm -f $(INSTALLDIR)/bin/MetCheck
rm -f $(INSTALLDIR)/bin/makegfsncml
rm -f $(INSTALLDIR)/bin/gen_GRIB_index
rm -f $(INSTALLDIR)/bin/MetProbe
rm -f $(INSTALLDIR)/bin/MR_ASCII_check
rm -f $(INSTALLDIR)/bin/autorun_scripts/autorun_gfs.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/autorun_nam.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/autorun_NCEP_50YearReanalysis.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/get_gfs.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/get_nam.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/get_NCEP_50YearReanalysis.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/convert_gfs.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/grib2nc.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/prune_windfiles.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/get_gmao.sh
rm -f $(INSTALLDIR)/bin/autorun_scripts/probe_volc.sh
rm -f $(INSTALLDIR)/bin/GMT_plot_traj.sh
rm -f $(INSTALLDIR)/share/volc_NOVAC.txt