-
Notifications
You must be signed in to change notification settings - Fork 30
/
makefile_foodie
153 lines (134 loc) · 4.12 KB
/
makefile_foodie
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
143
144
145
146
147
148
149
150
151
152
153
#!/usr/bin/make
# build only FOODIE library (static)
# defaults
COMPILER = gnu
# main building variables
ifeq "$(COMPILER)" "gnu"
FC = gfortran
OPTSC = -cpp -c -frealloc-lhs -O2 -J $(DMOD)
OPTSL = -J $(DMOD)
endif
ifeq "$(COMPILER)" "intel"
FC = ifort
OPTSC = -c -O2 -module $(DMOD)
OPTSL = -module $(DMOD)
endif
ifeq "$(COMPILER)" "ibm"
FC = bgxlf2008_r
OPTSC = -c -O2 -qmoddir=$(DMOD) -I$(DMOD)
OPTSL = -qmoddir=$(DMOD) -I$(DMOD)
endif
ifeq "$(COMPILER)" "cray"
FC = ftn
OPTSC = -c -O 0 -e Z -g
endif
DSRC = src/lib
DBLD = build/lib/
DOBJ = $(DBLD)obj/
DMOD = $(DBLD)mod/
VPATH = $(DSRC) $(DOBJ) $(DMOD)
MKDIRS = $(DBLD) $(DOBJ) $(DMOD)
#auxiliary variables
COTEXT = "Compiling $(<F)"
LITEXT = "Assembling $@"
#building rules
foodie: $(MKDIRS) $(DOBJ)foodie.o
@echo $(LITEXT)
@ar -rcs $(DBLD)libfoodie.a $(DOBJ)*.o ; ranlib $(DBLD)libfoodie.a
#compiling rules
$(DOBJ)foodie_integrator_backward_differentiation_formula.o: src/lib/foodie_integrator_backward_differentiation_formula.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_adt_integrand.o: src/lib/foodie_adt_integrand.f90 \
$(DOBJ)foodie_kinds.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_integrator_tvd_runge_kutta.o: src/lib/foodie_integrator_tvd_runge_kutta.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_integrator_euler_explicit.o: src/lib/foodie_integrator_euler_explicit.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_kinds.o: src/lib/foodie_kinds.f90
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_integrator_leapfrog.o: src/lib/foodie_integrator_leapfrog.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_integrator_adams_bashforth.o: src/lib/foodie_integrator_adams_bashforth.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_utils.o: src/lib/foodie_utils.f90 \
$(DOBJ)foodie_kinds.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_integrator_adams_moulton.o: src/lib/foodie_integrator_adams_moulton.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_integrator_low_storage_runge_kutta.o: src/lib/foodie_integrator_low_storage_runge_kutta.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie.o: src/lib/foodie.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_integrator_adams_bashforth.o \
$(DOBJ)foodie_integrator_adams_bashforth_moulton.o \
$(DOBJ)foodie_integrator_adams_moulton.o \
$(DOBJ)foodie_integrator_backward_differentiation_formula.o \
$(DOBJ)foodie_integrator_embedded_runge_kutta.o \
$(DOBJ)foodie_integrator_euler_explicit.o \
$(DOBJ)foodie_integrator_leapfrog.o \
$(DOBJ)foodie_integrator_low_storage_runge_kutta.o \
$(DOBJ)foodie_integrator_tvd_runge_kutta.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_integrator_embedded_runge_kutta.o: src/lib/foodie_integrator_embedded_runge_kutta.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
$(DOBJ)foodie_integrator_adams_bashforth_moulton.o: src/lib/foodie_integrator_adams_bashforth_moulton.f90 \
$(DOBJ)foodie_adt_integrand.o \
$(DOBJ)foodie_kinds.o \
$(DOBJ)foodie_integrator_adams_bashforth.o \
$(DOBJ)foodie_integrator_adams_moulton.o \
$(DOBJ)foodie_utils.o
@echo $(COTEXT)
@$(FC) $(OPTSC) $< -o $@
#phony auxiliary rules
.PHONY : $(MKDIRS)
$(MKDIRS):
@mkdir -p $@
.PHONY : cleanobj
cleanobj:
@echo deleting objects
@rm -fr $(DOBJ)
.PHONY : cleanmod
cleanmod:
@echo deleting mods
@rm -fr $(DMOD)
.PHONY : clean
clean: cleanobj cleanmod
.PHONY : cleanall
cleanall: clean cleanexe