-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
142 lines (108 loc) · 3.33 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
# SPARTACUS-Surface Makefile - read the README file before editing
#############################
### --- CONFIGURATION --- ###
#############################
# Use the nf-config utility, if available, to set the NETCDF_INCLUDE
# and NETCDF_LIB flags
HAVE_NFCONFIG := $(shell nf-config --version 2> /dev/null)
ifdef HAVE_NFCONFIG
$(info *** Using nf-config to obtain NetCDF flags)
NETCDF_INCLUDE = $(shell nf-config --fflags)
NETCDF_LIB = $(shell nf-config --flibs)
ifeq ($(shell nf-config --has-nc4),yes)
NETCDF4 = 1
endif
else
$(info *** nf-config not found)
endif
# make can be invoked using "make PROFILE=<prof>" in which case your
# local configuration parameters will be obtained from
# Makefile_include.<prof>
ifndef PROFILE
$(info *** No "PROFILE" variable provided, assuming "gfortran")
PROFILE = gfortran
endif
# Include a platform-specific makefile that defines FC, FCFLAGS and
# LIBS
include Makefile_include.$(PROFILE)
# Check for presence of the NETCDF_INCLUDE and NETCDF_LIB flags
ifndef NETCDF_INCLUDE
$(info *** You may need to set NETCDF_INCLUDE manually)
endif
ifndef NETCDF_LIB
$(info *** You may need to set NETCDF_LIB manually)
endif
# Add single-precision flag if SINGLE_PRECISION=1 was given on the
# "make" command line
ifdef SINGLE_PRECISION
CPPFLAGS += -DSINGLE_PRECISION
endif
# Allow the capability to write NetCDF4/HDF5 files, provided the code
# is compiled against the NetCDF4 library
ifdef NETCDF4
$(info *** Building with NetCDF4/HDF5 support)
CPPFLAGS += -DNC_NETCDF4
endif
# Consolidate flags
export FC
export FCFLAGS = $(WARNFLAGS) $(BASICFLAGS) $(CPPFLAGS) \
$(OPTFLAGS) $(DEBUGFLAGS) $(NETCDF_INCLUDE) $(OMPFLAG)
export LIBS = $(DEBUGFLAGS) $(LDFLAGS) -L../lib -lradsurf -lradtool -lutilities \
$(FCLIBS) $(NETCDF_LIB) $(OMPFLAG)
#############################
### --- BUILD TARGETS --- ###
#############################
all: build
help:
@echo "Usage:"
@echo " make PROFILE=<prof>"
@echo "where <prof> is one of gfortran, pgi etc."
build: libutilities libradtool libradsurf driver
libutilities:
cd utilities && $(MAKE)
libradtool: libutilities
cd radtool && $(MAKE)
libradsurf: libradtool
cd radsurf && $(MAKE)
driver: libradsurf
cd driver && $(MAKE)
test: test_simple test_rami4pilps test_urban test_rami5 test_single_layer
test_simple:
cd test/simple && $(MAKE) test
test_rami4pilps:
cd test/rami4pilps && $(MAKE) test
test_urban:
cd test/urban && $(MAKE) test
# Single profile
test_urban_single:
cd test/urban && $(MAKE) test_single
# Single layer
test_single_layer:
cd test/single_layer && $(MAKE) test
test_rami5:
cd test/rami5 && $(MAKE) test
test_code:
cd driver && $(MAKE) test_code
clean: clean-tests clean-toplevel clean-utilities clean-mods clean-doc
dist-clean: clean-tests clean-toplevel clean-utilities clean-mods dist-clean-doc
clean-tests:
cd test/simple && $(MAKE) clean
cd test/rami4pilps && $(MAKE) clean
cd test/urban && $(MAKE) clean
cd test/rami5 && $(MAKE) clean
cd test/single_layer && $(MAKE) clean
clean-toplevel:
cd radsurf && $(MAKE) clean
cd driver && $(MAKE) clean
clean-utilities:
cd radtool && $(MAKE) clean
cd utilities && $(MAKE) clean
clean-mods:
rm -f mod/*.mod
clean-doc:
cd doc && $(MAKE) clean
dist-clean-doc:
cd doc && $(MAKE) dist-clean
clean-autosaves:
rm -f *~ */*~ */*/*~
.PHONY: libradsurf libradtool libutilities driver clean clean-toplevel test