forked from christophersanborn/Radiative3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
244 lines (184 loc) · 6.65 KB
/
Makefile
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
CC=gcc
CPP=g++
FLAGS= -std=c++11 -O3 -g -Wall
DEFINES=
build_dir = build
objdir = $(build_dir)
OUT_EXEC = main
objects = geom_s2.o geom_r3.o geom_r4.o probability.o sources.o scatterers.o \
events.o phonons.o grid.o raypath.o media_cellface.o media.o \
model.o rtcoef.o dataout.o scatparams.o cmdline.o user.o global.o \
ecs.o elastic.o main.o
objects := $(addprefix $(objdir)/,$(objects))
.PHONY : default cleanall clean neat anyway directories .FORCE
default : directories $(OUT_EXEC)
directories : $(objdir)
$(objdir) :
mkdir -p $@
##//////
## Versioning:
##
ifneq ($(wildcard .git),)
gitstatus = $(shell git status --untracked-files=no --porcelain)
ifneq ($(gitstatus),)
gitstatus = , with local modifications
endif
revision = "\"$(shell git rev-parse --short HEAD)$(gitstatus) (git)\""
else ifneq ($(wildcard .svn),)
branch = $(shell basename "`svn info | grep '^URL:'`")
revision = "\"$(branch)@$(shell svnversion) (svn)\""
else
revision =
endif
ifneq ($(revision),)
DEFINES += -DREVISION_NUM=$(revision)
endif
##//////
## Platform-Specific Stuff:
##
machine = $(shell uname -m)
ifeq ($(machine),armv7l)
FLAGS += -Wno-psabi # Silence ABI warnings on Raspberry Pi
endif
##//////
## Configutation Options:
##
## These definitions and recipes encapsulate compile-time build
## options.
##
.PHONY : config-float config-double
.FORCE :
configopt_files = config/opt-fptype.hpp
config/opt-fptype.hpp :
@$(MAKE) config-double
# Default to config-double if opt-fptype does not exist
config-float :
@echo "Configure - Floating-point type: float"
@echo '// ***Auto-Generated***' > config/opt-fptype.hpp
@echo '#define TYPEDEFS_H_FP_TYPE float' >> config/opt-fptype.hpp
config-double :
@echo "Configure - Floating-point type: double"
@echo '// ***Auto-Generated***' > config/opt-fptype.hpp
@echo '#define TYPEDEFS_H_FP_TYPE double' >> config/opt-fptype.hpp
config-long-double :
@echo "Configure - Floating-point type: long double"
@echo '// ***Auto-Generated***' > config/opt-fptype.hpp
@echo '#define TYPEDEFS_H_FP_TYPE long double' >> config/opt-fptype.hpp
##//////
## Headers, and their dependencies:
##
# /* Fundamentals: */
#
typedefs_hpp = typedefs.hpp config/opt-fptype.hpp
raytype_hpp = raytype.hpp
array_hpp = array.hpp
complex_hpp = complex.hpp $(typedefs_hpp)
probability_hpp = probability.hpp $(typedefs_hpp)
#
# /* Libraries: */
#
geom_base_hpp = geom_base.hpp $(typedefs_hpp)
geom_s2_hpp = geom_s2.hpp $(geom_base_hpp)
geom_r3_hpp = geom_r3.hpp $(geom_base_hpp)
geom_r4_hpp = geom_r4.hpp $(geom_r3_hpp)
geom_hpp = geom.hpp $(geom_r3_hpp) $(geom_s2_hpp)
tensors_hpp = tensors.hpp $(geom_r3_hpp)
elastic_hpp = elastic.hpp $(typedefs_hpp)
ecs_hpp = ecs.hpp $(geom_hpp) $(elastic_hpp)
#
# /* Radiative3D Computation Core: */
#
rtcoef_hpp = rtcoef.hpp $(geom_hpp) $(raytype_hpp) $(complex_hpp)
phonons_hpp = phonons.hpp $(geom_hpp) $(raytype_hpp)
sources_hpp = sources.hpp $(geom_hpp) $(raytype_hpp) $(probability_hpp)
events_hpp = events.hpp $(sources_hpp) $(tensors_hpp)
scatparams_hpp = scatparams.hpp $(geom_hpp) $(elastic_hpp)
scatterers_hpp = scatterers.hpp $(sources_hpp) $(scatparams_hpp)
grid_hpp = grid.hpp $(ecs_hpp)
raypath_hpp = raypath.hpp $(geom_hpp)
media_cellface_hpp = media_cellface.hpp $(geom_hpp)
media_hpp = media.hpp $(array_hpp) $(raytype_hpp) $(elastic_hpp) $(raypath_hpp) $(media_cellface_hpp)
model_hpp = model.hpp $(events_hpp) $(scatterers_hpp) $(grid_hpp) $(media_hpp)
#
# /* Radiative3D User Interaction and Input/Output: */
#
params_hpp = params.hpp
cmdline_hpp = cmdline.hpp $(geom_hpp)
dataout_hpp = dataout.hpp $(geom_hpp) $(raytype_hpp) $(tensors_hpp)
#
#
##//////
## Executable:
##
$(OUT_EXEC) : $(objects)
$(CPP) -c main.cpp $(FLAGS) -DREVISION_NUM=$(revision) -o $(objdir)/main.o
$(CPP) $^ -o $@ $(FLAGS)
anyway : $(objects)
$(CPP) -c main.cpp $(FLAGS) $(DEFINES)
$(CPP) $^ -o $(OUT_EXEC) $(FLAGS)
##//////
## Objects Files:
##
comd = # (Common Build Dependencies)
# (If these files change, rebuild everything)
$(objdir)/geom_s2.o : geom_s2.cpp $(geom_s2_hpp) $(geom_r3_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/geom_r3.o : geom_r3.cpp $(geom_r3_hpp) $(geom_s2_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/geom_r4.o : geom_r4.cpp $(geom_r4_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/probability.o : probability.cpp $(probability_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/elastic.o : elastic.cpp $(elastic_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/sources.o : sources.cpp $(sources_hpp) $(phonons_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/events.o : events.cpp $(events_hpp) $(phonons_hpp) $(dataout_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/scatparams.o : scatparams.cpp $(scatparams_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/scatterers.o : scatterers.cpp $(scatterers_hpp) $(phonons_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/phonons.o : phonons.cpp $(phonons_hpp) $(media_hpp) $(rtcoef_hpp) \
$(scatterers_hpp) $(dataout_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/rtcoef.o : rtcoef.cpp $(rtcoef_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/grid.o : grid.cpp $(grid_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/raypath.o : raypath.cpp $(raypath_hpp)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/media_cellface.o : media_cellface.cpp $(media_cellface_hpp) $(media_hpp) $(rtcoef_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/media.o : media.cpp $(media_hpp) $(grid_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/model.o : model.cpp $(model_hpp) $(phonons_hpp) $(dataout_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/dataout.o: dataout.cpp $(dataout_hpp) $(phonons_hpp) $(media_hpp) \
$(ecs_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/cmdline.o: cmdline.cpp $(cmdline_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/user.o : user.cpp $(grid_hpp) $(comd) user_*_inc.cpp
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/global.o : global.cpp $(ecs_hpp) $(dataout_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/ecs.o : ecs.cpp $(ecs_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
$(objdir)/main.o : main.cpp $(params_hpp) $(model_hpp) $(dataout_hpp) \
$(rtcoef_hpp) $(cmdline_hpp) $(comd)
$(CPP) -c $< $(FLAGS) -o $@
## Cleanup:
##
cleanall :
rm -f $(configopt_files)
rm -f $(objects)
rm -f $(OUT_EXEC)
clean :
@echo "*NOTE: 'Make clean' removes object files and target exe, but"
@echo " does NOT remove auto-generated config files. To remove"
@echo " these too, do 'make cleanall'."
rm -f $(objects)
rm -f $(OUT_EXEC)
neat :
rm -f $(objects)