-
Notifications
You must be signed in to change notification settings - Fork 400
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (84 loc) · 3.65 KB
/
Makefile
File metadata and controls
105 lines (84 loc) · 3.65 KB
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
.SUFFIXES: .F .o
#
# To build a dycore-only MPAS-Atmosphere model, comment-out or delete
# the definition of PHYSICS and CHEMISTRY, below
#
# If MPAS_CAM_DYCORE is found in CPPFLAGS, PHYSICS and CHEMISTRY will become undefined automatically
#
ifeq ($(findstring MPAS_CAM_DYCORE,$(CPPFLAGS)),)
PHYSICS = -DDO_PHYSICS
CHEMISTRY = -DDO_CHEMISTRY
endif
ifdef PHYSICS
PHYSCORE = physcore
PHYS_OBJS = libphys/*.o
endif
ifdef CHEMISTRY
CHEMCORE = chemcore
CHEM_OBJS = libchem/*.o
endif
OBJS = mpas_atm_core.o \
mpas_atm_core_interface.o \
mpas_atm_dimensions.o \
mpas_atm_threading.o \
mpas_atm_halos.o
all: $(PHYSCORE) $(CHEMCORE) dycore diagcore atmcore utilities
core_reg:
$(CPP) $(CPPFLAGS) $(CPPINCLUDES) $(PHYSICS) $(CHEMISTRY) Registry.xml > Registry_processed.xml
core_input_gen:
if [ ! -e default_inputs ]; then mkdir default_inputs; fi
( cd default_inputs; $(NL_GEN) ../Registry_processed.xml namelist.atmosphere in_defaults=true )
( cd default_inputs; $(ST_GEN) ../Registry_processed.xml streams.atmosphere stream_list.atmosphere. listed in_defaults=true)
gen_includes: core_reg
(if [ ! -d inc ]; then mkdir -p inc; fi) # To generate *.inc files
(cd inc; $(REG_PARSE) ../Registry_processed.xml $(CPPFLAGS) )
post_build:
if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi
cp default_inputs/* $(ROOT_DIR)/default_inputs/.
( cd $(ROOT_DIR)/default_inputs; for FILE in `ls -1`; do if [ ! -e ../$$FILE ]; then cp $$FILE ../.; fi; done )
physcore: mpas_atm_dimensions.o
( cd physics; $(MAKE) all )
( mkdir libphys; cd libphys; ar -x ../physics/libphys.a )
( cd ../..; ln -sf ./src/core_atmosphere/physics/physics_wrf/files/*TBL .)
( cd ../..; ln -sf ./src/core_atmosphere/physics/physics_wrf/files/*DATA* .)
( cd ../..; ln -sf ./src/core_atmosphere/physics/physics_noahmp/parameters/*TBL .)
chemcore:
( cd chemistry; $(MAKE) all CHEMISTRY="$(CHEMISTRY)" )
( mkdir libchem; cd libchem; ar -x ../chemistry/libchem.a )
dycore: mpas_atm_dimensions.o $(PHYSCORE) $(CHEMCORE)
( cd dynamics; $(MAKE) all PHYSICS="$(PHYSICS)" )
diagcore: $(PHYSCORE) dycore
( cd diagnostics; $(MAKE) all PHYSICS="$(PHYSICS)" )
utilities: $(PHYSCORE)
( cd utils; $(MAKE) all PHYSICS="$(PHYSICS)" )
atmcore: $(PHYSCORE) dycore diagcore $(OBJS)
ar -ru libdycore.a $(OBJS) dynamics/*.o $(PHYS_OBJS) $(CHEM_OBJS) diagnostics/*.o
nuopc: $(PHYSCORE) dycore diagcore $(OBJS)
( cd nuopc; $(MAKE) all )
mpas_atm_core_interface.o: mpas_atm_core.o
mpas_atm_core.o: dycore diagcore mpas_atm_threading.o mpas_atm_halos.o
mpas_atm_dimensions.o:
clean:
( cd physics; $(MAKE) clean )
( cd chemistry; $(MAKE) clean )
( cd dynamics; $(MAKE) clean )
( cd diagnostics; $(MAKE) clean )
( cd utils; $(MAKE) clean )
( cd nuopc; $(MAKE) clean )
( cd ../..; rm -f *TBL )
( cd ../..; rm -f *DATA* )
$(RM) -r libphys
$(RM) *.o *.mod *.f90 libdycore.a
$(RM) Registry_processed.xml
@# Certain systems with intel compilers generate *.i files
@# This removes them during the clean process
$(RM) *.i
$(RM) -r default_inputs
.F.o:
$(RM) $@ $*.mod
ifeq "$(GEN_F90)" "true"
$(CPP) $(CPPFLAGS) $(PHYSICS) $(CHEMISTRY) $(CPPINCLUDES) -I./inc $< > $*.f90
$(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I./physics/physics_noaa/UGWP $(MPAS_ESMF_INC) -I./chemistry
else
$(FC) $(CPPFLAGS) $(PHYSICS) $(CHEMISTRY) $(FFLAGS) -c $*.F $(CPPINCLUDES) $(FCINCLUDES) -I./inc -I../framework -I../operators -I./physics -I./dynamics -I./diagnostics -I./physics/physics_wrf -I./physics/physics_mmm -I./physics/physics_noaa/UGWP $(MPAS_ESMF_INC) -I./chemistry
endif