1 | ###################### |
---|
2 | # POSTAMBLE |
---|
3 | |
---|
4 | FGREP = fgrep -iq |
---|
5 | |
---|
6 | ARCHFLAGS = $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZE) -DRWORDSIZE=$(RWORDSIZE) -DLWORDSIZE=$(LWORDSIZE) \ |
---|
7 | $(ARCH_LOCAL) \ |
---|
8 | $(DA_ARCHFLAGS) \ |
---|
9 | CONFIGURE_DMPARALLEL \ |
---|
10 | CONFIGURE_STUBMPI \ |
---|
11 | CONFIGURE_NETCDF_FLAG \ |
---|
12 | CONFIGURE_PNETCDF_FLAG \ |
---|
13 | CONFIGURE_ESMF_FLAG \ |
---|
14 | CONFIGURE_GRIB2_FLAG \ |
---|
15 | CONFIGURE_RTTOV_FLAG \ |
---|
16 | CONFIGURE_CRTM_FLAG \ |
---|
17 | CONFIGURE_4DVAR_FLAG \ |
---|
18 | CONFIGURE_WAVELET_FLAG \ |
---|
19 | CONFIGURE_NESTOPT \ |
---|
20 | -DUSE_ALLOCATABLES \ |
---|
21 | -DGRIB1 \ |
---|
22 | -DINTIO \ |
---|
23 | -DLIMIT_ARGS \ |
---|
24 | -DCONFIG_BUF_LEN=$(CONFIG_BUF_LEN) \ |
---|
25 | -DMAX_DOMAINS_F=$(MAX_DOMAINS) \ |
---|
26 | -DMAX_HISTORY=$(MAX_HISTORY) \ |
---|
27 | -DNMM_NEST=$(WRF_NMM_NEST) |
---|
28 | CFLAGS = $(CFLAGS_LOCAL) CONFIGURE_DMPARALLEL CONFIGURE_STUBMPI \ |
---|
29 | -DMAX_HISTORY=$(MAX_HISTORY) |
---|
30 | FCFLAGS = $(FCOPTIM) $(FCBASEOPTS) |
---|
31 | ESMF_LIB_FLAGS = ESMFLIBFLAG |
---|
32 | #NOWIN ESMF_IO_LIB = ESMFIOLIB |
---|
33 | ESMF_IO_LIB_EXT = ESMFIOEXTLIB |
---|
34 | INCLUDE_MODULES = $(MODULE_SRCH_FLAG) \ |
---|
35 | $(ESMF_MOD_INC) $(ESMF_LIB_FLAGS) \ |
---|
36 | -I$(WRF_SRC_ROOT_DIR)/main \ |
---|
37 | -I$(WRF_SRC_ROOT_DIR)/external/io_netcdf \ |
---|
38 | -I$(WRF_SRC_ROOT_DIR)/external/io_int \ |
---|
39 | -I$(WRF_SRC_ROOT_DIR)/frame \ |
---|
40 | -I$(WRF_SRC_ROOT_DIR)/share \ |
---|
41 | -I$(WRF_SRC_ROOT_DIR)/phys \ |
---|
42 | -I$(WRF_SRC_ROOT_DIR)/chem -I$(WRF_SRC_ROOT_DIR)/inc \ |
---|
43 | -I$(NETCDFPATH)/include \ |
---|
44 | CONFIGURE_RTTOV_INC |
---|
45 | REGISTRY = Registry |
---|
46 | |
---|
47 | #NOWIN LIB_BUNDLED = \ |
---|
48 | #NOWIN $(WRF_SRC_ROOT_DIR)/external/fftpack/fftpack5/libfftpack.a \ |
---|
49 | #NOWIN $(WRF_SRC_ROOT_DIR)/external/io_grib1/libio_grib1.a \ |
---|
50 | #NOWIN $(WRF_SRC_ROOT_DIR)/external/io_grib_share/libio_grib_share.a \ |
---|
51 | #NOWIN $(WRF_SRC_ROOT_DIR)/external/io_int/libwrfio_int.a \ |
---|
52 | #NOWIN $(ESMF_IO_LIB) \ |
---|
53 | #NOWIN CONFIGURE_COMMS_LIB \ |
---|
54 | #NOWIN $(WRF_SRC_ROOT_DIR)/frame/module_internal_header_util.o \ |
---|
55 | #NOWIN $(WRF_SRC_ROOT_DIR)/frame/pack_utils.o |
---|
56 | |
---|
57 | #NOWIN LIB_EXTERNAL = \ |
---|
58 | #NOWIN CONFIGURE_NETCDF_LIB_PATH CONFIGURE_PNETCDF_LIB_PATH CONFIGURE_GRIB2_LIB CONFIGURE_ATMOCN_LIB |
---|
59 | |
---|
60 | LIB = $(LIB_BUNDLED) $(LIB_EXTERNAL) $(LIB_LOCAL) |
---|
61 | LDFLAGS = $(OMP) $(FCFLAGS) $(LDFLAGS_LOCAL) CONFIGURE_LDFLAGS |
---|
62 | ENVCOMPDEFS = CONFIGURE_COMPILEFLAGS |
---|
63 | CPPFLAGS = $(ARCHFLAGS) $(ENVCOMPDEFS) -I$(LIBINCLUDE) $(TRADFLAG) CONFIGURE_COMMS_INCLUDE |
---|
64 | NETCDFPATH = CONFIGURE_NETCDF_PATH |
---|
65 | PNETCDFPATH = CONFIGURE_PNETCDF_PATH |
---|
66 | |
---|
67 | bundled: wrf_ioapi_includes wrfio_grib_share wrfio_grib1 wrfio_int esmf_time fftpack CONFIGURE_ATMOCN |
---|
68 | external: CONFIGURE_WRFIO_NF CONFIGURE_WRFIO_PNF CONFIGURE_WRFIO_GRIB2 CONFIGURE_COMMS_EXTERNAL $(ESMF_TARGET) |
---|
69 | |
---|
70 | ###################### |
---|
71 | externals: bundled external |
---|
72 | |
---|
73 | gen_comms_serial : |
---|
74 | ( /bin/rm -f $(WRF_SRC_ROOT_DIR)/tools/gen_comms.c ) |
---|
75 | |
---|
76 | module_dm_serial : |
---|
77 | ( if [ ! -e module_dm.F ] ; then /bin/cp module_dm_warning module_dm.F ; cat module_dm_stubs.F >> module_dm.F ; fi ) |
---|
78 | |
---|
79 | gen_comms_rsllite : |
---|
80 | ( if [ ! -e $(WRF_SRC_ROOT_DIR)/tools/gen_comms.c ] ; then \ |
---|
81 | /bin/cp $(WRF_SRC_ROOT_DIR)/tools/gen_comms_warning $(WRF_SRC_ROOT_DIR)/tools/gen_comms.c ; \ |
---|
82 | cat $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/gen_comms.c >> $(WRF_SRC_ROOT_DIR)/tools/gen_comms.c ; fi ) |
---|
83 | |
---|
84 | module_dm_rsllite : |
---|
85 | ( if [ ! -e module_dm.F ] ; then /bin/cp module_dm_warning module_dm.F ; \ |
---|
86 | cat $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/module_dm.F >> module_dm.F ; fi ) |
---|
87 | |
---|
88 | wrfio_nf : |
---|
89 | ( cd $(WRF_SRC_ROOT_DIR)/external/io_netcdf ; \ |
---|
90 | make NETCDFPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ |
---|
91 | CC="$(SCC)" CFLAGS="$(CFLAGS)" \ |
---|
92 | FC="$(SFC) $(PROMOTION) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) |
---|
93 | |
---|
94 | wrfio_pnf : |
---|
95 | ( cd $(WRF_SRC_ROOT_DIR)/external/io_pnetcdf ; \ |
---|
96 | make NETCDFPATH="$(PNETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP) $(ARCHFLAGS)" \ |
---|
97 | FC="$(FC) $(PROMOTION) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) |
---|
98 | |
---|
99 | wrfio_grib_share : |
---|
100 | ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib_share ; \ |
---|
101 | make CC="$(SCC)" CFLAGS="$(CFLAGS)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ |
---|
102 | FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive) |
---|
103 | |
---|
104 | wrfio_grib1 : |
---|
105 | ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib1 ; \ |
---|
106 | make CC="$(SCC)" CFLAGS="$(CFLAGS)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ |
---|
107 | FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive) |
---|
108 | |
---|
109 | wrfio_grib2 : |
---|
110 | ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib2 ; \ |
---|
111 | make CC="$(SCC)" CFLAGS="$(CFLAGS) CONFIGURE_GRIB2_INC" RM="$(RM)" RANLIB="$(RANLIB)" \ |
---|
112 | CPP="$(CPP)" \ |
---|
113 | FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="-traditional" AR="$(AR)" ARFLAGS="$(ARFLAGS)" \ |
---|
114 | FIXED="$(FORMAT_FIXED)" archive) |
---|
115 | |
---|
116 | wrfio_int : |
---|
117 | ( cd $(WRF_SRC_ROOT_DIR)/external/io_int ; \ |
---|
118 | make CC="$(CC)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ |
---|
119 | FC="$(SFC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" FGREP="$(FGREP)" \ |
---|
120 | TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ARCHFLAGS="$(ARCHFLAGS)" all ) |
---|
121 | |
---|
122 | esmf_time : |
---|
123 | ( cd $(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 ; \ |
---|
124 | make FC="$(SFC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" RANLIB="$(RANLIB)" \ |
---|
125 | CPP="$(CPP) -I$(WRF_SRC_ROOT_DIR)/inc -I. $(ARCHFLAGS) $(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) |
---|
126 | |
---|
127 | fftpack : |
---|
128 | ( cd $(WRF_SRC_ROOT_DIR)/external/fftpack/fftpack5 ; \ |
---|
129 | make FC="$(SFC)" FFLAGS="$(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" RANLIB="$(RANLIB)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) |
---|
130 | |
---|
131 | atm_ocn : |
---|
132 | ( cd $(WRF_SRC_ROOT_DIR)/external/atm_ocn ; \ |
---|
133 | make CC="$(SCC)" CFLAGS="$(CFLAGS) " RM="$(RM)" RANLIB="$(RANLIB)" \ |
---|
134 | CPP="$(CPP)" \ |
---|
135 | FC="$(DM_FC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="-traditional" AR="$(AR)" ARFLAGS="$(ARFLAGS)" \ |
---|
136 | FIXED="$(FORMAT_FIXED)" ) |
---|
137 | |
---|
138 | $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a : |
---|
139 | ( cd $(WRF_SRC_ROOT_DIR)/external/RSL_LITE ; make CC="$(CC) $(CFLAGS)" \ |
---|
140 | FC="$(FC) $(FCFLAGS) $(PROMOTION) $(BYTESWAPIO)" \ |
---|
141 | CPP="$(CPP) -I. $(ARCHFLAGS) $(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ;\ |
---|
142 | $(RANLIB) $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a ) |
---|
143 | |
---|
144 | ###################### |
---|
145 | # Macros, these should be generic for all machines |
---|
146 | |
---|
147 | LN = ln -sf |
---|
148 | MAKE = make -i -r |
---|
149 | RM = rm -f |
---|
150 | |
---|
151 | |
---|
152 | # These sub-directory builds are identical across all architectures |
---|
153 | |
---|
154 | wrf_ioapi_includes : |
---|
155 | ( cd $(WRF_SRC_ROOT_DIR)/external/ioapi_share ; \ |
---|
156 | $(MAKE) NATIVE_RWORDSIZE="$(NATIVE_RWORDSIZE)" RWORDSIZE="$(RWORDSIZE)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) |
---|
157 | |
---|
158 | wrfio_esmf : |
---|
159 | ( cd $(WRF_SRC_ROOT_DIR)/external/io_esmf ; \ |
---|
160 | make FC="$(FC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS) $(ESMF_MOD_INC)" \ |
---|
161 | RANLIB="$(RANLIB)" CPP="$(CPP) $(POUND_DEF) " AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) |
---|
162 | |
---|
163 | # There is probably no reason to modify these rules |
---|
164 | |
---|
165 | .F.i: |
---|
166 | $(RM) $@ |
---|
167 | $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.F > $@ |
---|
168 | mv $*.i $(DEVTOP)/pick/$*.f90 |
---|
169 | cp $*.F $(DEVTOP)/pick |
---|
170 | |
---|
171 | .F.o: |
---|
172 | $(RM) $@ |
---|
173 | $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $(OMPCPP) $*.F > $*.bb |
---|
174 | $(SED_FTN) $*.bb | $(CPP) > $*.f90 |
---|
175 | $(RM) $*.b $*.bb |
---|
176 | @ if echo $(ARCHFLAGS) | $(FGREP) 'DVAR4D'; then \ |
---|
177 | echo COMPILING $*.F for 4DVAR ; \ |
---|
178 | $(WRF_SRC_ROOT_DIR)/var/build/da_name_space.pl $*.f90 > $*.f90.tmp ; \ |
---|
179 | mv $*.f90.tmp $*.f90 ; \ |
---|
180 | fi |
---|
181 | if $(FGREP) '!$$OMP' $*.f90 ; then \ |
---|
182 | if [ -n "$(OMP)" ] ; then echo COMPILING $*.F WITH OMP ; fi ; \ |
---|
183 | $(FC) -o $@ -c $(FCFLAGS) $(OMP) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $*.f90 ; \ |
---|
184 | else \ |
---|
185 | if [ -n "$(OMP)" ] ; then echo COMPILING $*.F WITHOUT OMP ; fi ; \ |
---|
186 | $(FC) -o $@ -c $(FCFLAGS) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $*.f90 ; \ |
---|
187 | fi |
---|
188 | |
---|
189 | |
---|
190 | .F.f90: |
---|
191 | $(RM) $@ |
---|
192 | $(SED_FTN) $*.F > $*.b |
---|
193 | $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.b > $@ |
---|
194 | $(RM) $*.b |
---|
195 | |
---|
196 | .f90.o: |
---|
197 | $(RM) $@ |
---|
198 | $(FC) -o $@ -c $(FCFLAGS) $(PROMOTION) $(FCSUFFIX) $*.f90 |
---|
199 | |
---|
200 | setfeenv.o : setfeenv.c |
---|
201 | $(RM) $@ |
---|
202 | $(CCOMP) -o $@ -c $(CFLAGS) $(OMPCC) $*.c |
---|
203 | |
---|
204 | .c.o: |
---|
205 | $(RM) $@ |
---|
206 | $(CC) -o $@ -c $(CFLAGS) $*.c |
---|
207 | |
---|