-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile.model
90 lines (70 loc) · 3.58 KB
/
makefile.model
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
# GNU Makefile template for user ESMF application
################################################################################
################################################################################
## This Makefile must be able to find the "esmf.mk" Makefile fragment in the ##
## 'include' line below. Following the ESMF User's Guide, a complete ESMF ##
## installation should ensure that a single environment variable "ESMFMKFILE" ##
## is made available on the system. This variable should point to the ##
## "esmf.mk" file. ##
## ##
## This example Makefile uses the "ESMFMKFILE" environment variable. ##
## ##
## If you notice that this Makefile cannot find variable ESMFMKFILE then ##
## please contact the person responsible for the ESMF installation on your ##
## system. ##
## As a work-around you can simply hardcode the path to "esmf.mk" in the ##
## include line below. However, doing so will render this Makefile a lot less ##
## flexible and non-portable. ##
################################################################################
HR := ========================================
HR := $(HR)$(HR)
COMMA := ,
DIR := $(CURDIR)
ifneq ($(origin ESMFMKFILE), environment)
$(error Environment variable ESMFMKFILE was not set.)
endif
include $(ESMFMKFILE)
MODEL_OBJS := model_drv.o model_fld.o model_dom.o
MODEL_MODS := model_drv_mod.mod model_fld_mod.mod model_dom_mod.mod
MODEL_LIB := libmodel.a
################################################################################
################################################################################
# -----------------------------------------------------------------------------
# Compiler Arguments
# -----------------------------------------------------------------------------
.SUFFIXES: .f90 .F90 .c .C
%.o : %.f90
@echo $(HR)
@echo "Compiling $@"
$(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREENOCPP) $<
%.o : %.F90
@echo $(HR)
@echo "Compiling $@"
$(ESMF_F90COMPILER) -c $(ESMF_F90COMPILEOPTS) $(ESMF_F90COMPILEPATHS) $(ESMF_F90COMPILEFREECPP) $(ESMF_F90COMPILECPPFLAGS) -DESMF_VERSION_MAJOR=$(ESMF_VERSION_MAJOR) $<
%.o : %.c
@echo $(HR)
@echo "Compiling $@"
$(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $<
%.o : %.C
@echo $(HR)
@echo "Compiling $@"
$(ESMF_CXXCOMPILER) -c $(ESMF_CXXCOMPILEOPTS) $(ESMF_CXXCOMPILEPATHSLOCAL) $(ESMF_CXXCOMPILEPATHS) $(ESMF_CXXCOMPILECPPFLAGS) $<
# -----------------------------------------------------------------------------
# Build Targets
# -----------------------------------------------------------------------------
all: $(MODEL_LIB)
$(MODEL_LIB): $(MODEL_OBJS)
ar cru $@ $^
# -----------------------------------------------------------------------------
# Dependencies
# -----------------------------------------------------------------------------
model_drv.o: model_fld.o model_dom.o
model_fld.o: model_dom.o
# -----------------------------------------------------------------------------
# Clean Targets
# -----------------------------------------------------------------------------
.PHONY: clean
clean:
@echo $(HR)
@echo "Removing Model Files"
rm -f $(MODEL_LIB) $(MODEL_MODS) $(MODEL_OBJS)