source: LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/Makefile @ 5162

Last change on this file since 5162 was 4728, checked in by idelkadi, 13 months ago

Update of ecrad in the LMDZ_ECRad branch of LMDZ:

  • version 1.6.1 of ecrad
  • files are no longer grouped in the same ecrad directory.
  • the structure of ecrad offline is preserved to facilitate updating in LMDZ
  • cfg.bld modified to take into account the new added subdirectories.
  • the interface routines and those added in ecrad are moved to the phylmd directory
File size: 5.4 KB
RevLine 
[4728]1# ecRad Makefile - read the README file before editing
2
3#############################
4### --- CONFIGURATION --- ###
5#############################
6
7# Use the nf-config utility, if available, to set the NETCDF_INCLUDE
8# and NETCDF_LIB flags
9HAVE_NFCONFIG := $(shell nf-config --version 2> /dev/null)
10ifdef HAVE_NFCONFIG
11$(info *** Using nf-config to obtain NetCDF flags)
12NETCDF_INCLUDE = $(shell nf-config --fflags)
13NETCDF_LIB     = $(shell nf-config --flibs)
14ifeq ($(shell nf-config --has-nc4),yes)
15NETCDF4        = 1
16endif
17else
18$(info *** nf-config not found)
19endif
20
21# make can be invoked using "make PROFILE=<prof>" in which case your
22# local configuration parameters will be obtained from
23# Makefile_include.<prof>
24ifndef PROFILE
25$(info *** No "PROFILE" variable provided, assuming "gfortran")
26PROFILE = gfortran
27endif
28
29# Include a platform-specific makefile that defines FC, FCFLAGS and
30# LIBS
31include Makefile_include.$(PROFILE)
32
33# Check for presence of the NETCDF_INCLUDE and NETCDF_LIB flags
34ifndef NETCDF_INCLUDE
35$(info *** You may need to set NETCDF_INCLUDE manually)
36endif
37ifndef NETCDF_LIB
38$(info *** You may need to set NETCDF_LIB manually)
39endif
40
41# Add single-precision flag if SINGLE_PRECISION=1 was given on the
42# "make" command line
43ifdef SINGLE_PRECISION
44CPPFLAGS += -DPARKIND1_SINGLE
45endif
46
47# If PRINT_ENTRAPMENT_DATA=1 was given on the "make" command line
48# then the SPARTACUS shortwave solver will write data to fort.101 and
49# fort.102
50ifdef PRINT_ENTRAPMENT_DATA
51CPPFLAGS += -DPRINT_ENTRAPMENT_DATA
52endif
53# For backwards compatibility we allow the following as well
54ifdef PRINT_ENCROACHMENT_DATA
55CPPFLAGS += -DPRINT_ENTRAPMENT_DATA
56endif
57# Allow the capability to write NetCDF4/HDF5 files, provided the code
58# is compiled against the NetCDF4 library
59ifdef NETCDF4
60$(info *** Building with NetCDF4/HDF5 support)
61CPPFLAGS += -DNC_NETCDF4
62endif
63
64# Consolidate flags
65export FC
66export FCFLAGS = $(WARNFLAGS) $(BASICFLAGS) $(CPPFLAGS) -I../include \
67        $(OPTFLAGS) $(DEBUGFLAGS) $(NETCDF_INCLUDE) $(OMPFLAG)
68export LIBS    = $(LDFLAGS) -L../lib -lradiation -lutilities \
69        -lifsrrtm -lifsaux $(FCLIBS) $(NETCDF_LIB) $(OMPFLAG)
70
71# Do we include Dr Hook from ECMWF's fiat library?
72ifdef FIATDIR
73# Prepend location of yomhook.mod module file from fiat library, so
74# that it is found in preference to the dummy one in ecRad
75FCFLAGS := -I$(FIATDIR)/module/fiat $(FCFLAGS)
76# Append fiat library (usually shared: libfiat.so)
77LIBS += -L$(FIATDIR)/lib -Wl,-rpath,$(FIATDIR)/lib -lfiat
78else
79# Dummy Dr Hook library
80LIBS += -ldrhook
81endif
82
83
84#############################
85### --- BUILD TARGETS --- ###
86#############################
87
88all: build
89
90help:
91        @echo "Usage:"
92        @echo "  make PROFILE=<prof>"
93        @echo "where <prof> is one of gfortran, pgi, intel or cray (see Makefile_include.<prof>)"
94        @echo "Other possible arguments are:"
95        @echo "  DEBUG=1              Compile with debug settings on and optimizations off"
96        @echo "  SINGLE_PRECISION=1   Compile with single precision"
97        @echo "  FIATDIR=/my/path     Compile with Dr Hook, specifying the directory containing lib/libfiat.so and module/fiat/yomhook.mod"
98        @echo "  test                 Run test cases in test directory"
99        @echo "  clean                Remove all compiled files"
100
101ifndef FIATDIR
102build: directories libifsaux libdummydrhook libutilities libifsrrtm \
103        libradiation driver ifsdriver symlinks
104libradiation libutilities: libdummydrhook
105else
106# Note that if we are using Dr Hook from the fiat library we don't
107# want to create mod/yomhook.mod as this can sometimes be found before
108# the one in the fiat directory leading to an error at link stage
109build: directories libifsaux libutilities libifsrrtm libradiation \
110        driver ifsdriver symlinks
111endif
112
113# git cannot store empty directories so they may need to be created
114directories: mod lib
115mod:
116        mkdir -p mod
117lib:
118        mkdir -p lib
119
120deps: clean-deps
121        cd ifsaux && $(MAKE) deps
122        cd ifsrrtm && $(MAKE) deps
123        cd ifs && $(MAKE) deps
124
125clean-deps:
126        rm -f include/*.intfb.h
127
128libifs: libradiation
129        cd ifs && $(MAKE)
130
131libifsaux:
132        cd ifsaux && $(MAKE)
133
134libdummydrhook: libifsaux
135        cd drhook && $(MAKE) dummy
136
137libutilities: libifsaux
138        cd utilities && $(MAKE)
139
140libifsrrtm: libifsaux
141        cd ifsrrtm && $(MAKE)
142
143libradiation: libifsrrtm libutilities libifsaux
144        cd radiation && $(MAKE)
145
146driver: libifsaux libifsrrtm libutilities libradiation
147        cd driver && $(MAKE) driver
148
149ifsdriver: libifsaux libifsrrtm libutilities libradiation libifs
150        cd driver && $(MAKE) ifs_driver
151
152test_programs: driver
153        cd driver && $(MAKE) test_programs
154
155symlinks: clean-symlinks
156        cd practical && ln -s ../bin/ecrad
157        cd practical && ln -s ../data
158
159test: test_ifs test_i3rc test_ckdmip
160
161test_ifs: driver
162        cd test/ifs && $(MAKE) test
163
164test_i3rc: driver
165        cd test/i3rc && $(MAKE) test
166
167test_ckdmip:
168        cd test/ckdmip && $(MAKE) test
169
170clean: clean-tests clean-toplevel clean-utilities clean-mods clean-symlinks
171
172clean-tests:
173        cd test/ifs && $(MAKE) clean
174        cd test/i3rc && $(MAKE) clean
175        cd test/ckdmip && $(MAKE) clean
176
177clean-toplevel:
178        cd radiation && $(MAKE) clean
179        cd driver && $(MAKE) clean
180
181clean-utilities:
182        cd ifsaux && $(MAKE) clean
183        cd utilities && $(MAKE) clean
184        cd ifsrrtm && $(MAKE) clean
185        cd drhook && $(MAKE) clean
186        cd ifs && $(MAKE) clean
187
188clean-mods:
189        rm -f mod/*.mod
190
191clean-symlinks:
192        rm -f practical/ecrad practical/data
193
194clean-autosaves:
195        rm -f *~ .gitignore~ */*~ */*/*~
196
197.PHONY: all build help deps clean-deps libifsaux libdummydrhook libutilities libifsrrtm \
198        libradiation driver symlinks clean clean-toplevel test test_ifs ifsdriver \
199        test_i3rc clean-tests clean-utilities clean-mods clean-symlinks
Note: See TracBrowser for help on using the repository browser.