-
Notifications
You must be signed in to change notification settings - Fork 0
/
Make.config
478 lines (411 loc) · 13.1 KB
/
Make.config
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
ifndef CONFIG_INCLUDED
CONFIG_INCLUDED = 1
SRC_DIR = $(TOP_DIR)/src
DRV_SRCS = compute_engine.c \
file_converter.c \
start_analysis.c
BAS_SRCS = main.c \
auxiliary.c \
control_parameter.c \
cosmology.c \
halos.c \
index_hash.c \
min_heap.c \
oct_hash.c \
qss.c \
rand.c \
sfc.c \
skiplist.c \
stack.c \
system.c \
times.c \
units.c
COR_SRCS = agn.c \
cache.c \
cell_buffer.c \
config.c \
cooling.c \
density.c \
gravity.c \
halo_finder.c \
hydro.c \
hydro_tracer.c \
imf.c \
io.c \
io_cart.c \
io_artio.c \
iterators.c \
load_balance.c \
pack.c \
parallel.c \
particle.c \
particle_buffer.c \
particle_density.c \
plugin.c \
refinement.c \
refinement_indicators.c \
refinement_operations.c \
riemann.c \
root_grid_fft.c \
rt.c \
rt_debug.c \
rt_global.c \
rt_io.c \
rt_otvet.c \
rt_transfer.c \
starformation.c \
starformation_feedback.c \
starformation_formstar.c \
starformation_recipe.c \
timing.c \
tree.c \
tree_arrays.c \
tree_alloc.c \
tree_count.c \
tree_debug.c \
tree_interpolate.c \
tree_linkedlist.c
FRT_SRCS = frt_background.F \
frt_base.F \
frt_cf3.F \
frt_cooling.F \
frt_cooling_solvers.F \
frt_global.F \
frt_io.F \
frt_lwbands.F \
frt_mpi.F \
frt_spectrum.F \
frt_tables.F \
frt_testing.F \
frt_transfer.F \
frt_xrays.F
FFT_SRCS = fft3.c \
ffti_pack.c
AIO_SRCS = artio.c \
artio_file.c \
artio_grid.c \
artio_particle.c \
artio_posix.c \
artio_mpi.c \
artio_posix.c \
artio_parameter.c \
artio_endian.c \
artio_sfc.c \
artio_selector.c
RUN_SRCS = agn_step.c \
cell_feedback_step.c \
gravity_step.c \
hydro_step.c \
hydro_tracer_step.c \
io_step.c \
logging.c \
particle_step.c \
rt_step.c \
rt_otvet_step.c \
rt_transfer_step.c \
starformation_feedback_step.c \
starformation_step.c \
stardestruction_step.c \
step.c
EXT_SRCS = cd.c \
CO.c \
chull.c \
fesc.c \
gic_tools.c \
halo_tools.c \
hart_io.c \
healpix.c \
ifrit.c \
igm.c \
indexed_io.c \
interpolation.c \
ism.c \
los.c \
mesh.c \
power.c \
rfsfr.c \
sps.c \
synthetic_spectra.c \
utils.c \
viewdump.c \
xrays.c
DRV_OBJS = $(patsubst %.c,.obj/%.o,$(DRV_SRCS))
BAS_OBJS = $(patsubst %.c,.obj/%.o,$(BAS_SRCS))
COR_OBJS = $(patsubst %.c,.obj/%.o,$(COR_SRCS))
FRT_OBJS = $(patsubst %.F,.obj/%.o,$(FRT_SRCS))
FFT_OBJS = $(patsubst %.c,.obj/%.o,$(FFT_SRCS))
AIO_OBJS = $(patsubst %.c,.obj/%.o,$(AIO_SRCS))
RUN_OBJS = $(patsubst %.c,.obj/%.o,$(RUN_SRCS))
EXT_OBJS = $(patsubst %.c,.obj/extra/%.o,$(EXT_SRCS))
IOL_OBJS = $(patsubst %.c,.obj/io/%.o,$(AIO_SRCS)) # Non-MPI IO
LIBC_SRCS =
LIBF_SRCS = fftpack.f
LIBC_OBJS = $(patsubst %.c,.obj/%.o,$(LIBC_SRCS))
LIBF_OBJS = $(patsubst %.f,.obj/%.o,$(LIBF_SRCS))
LIB_OBJS = $(LIBC_OBJS) $(LIBF_OBJS)
ifeq ($(PLUGIN),)
PLUGIN = $(SRC_DIR)/core/default_plugin.c
endif
ifeq ($(findstring /extra,$(PLUGIN)),/extra)
WITH_EXTRA = 1
PLUGIN := $(PLUGIN:/extra=)
endif
ifeq ($(findstring /no_default,$(PLUGIN)),/no_default)
PLUGIN := $(PLUGIN:/no_default=)
endif
SIM_PLUGIN_SRCS = $(notdir $(PLUGIN))
ANL_PLUGIN_SRCS = $(notdir $(PLUGIN))
SIM_PLUGIN_OBJS = $(patsubst %.c,.obj/extra/%.o,$(SIM_PLUGIN_SRCS))
ANL_PLUGIN_OBJS = $(patsubst %.c,.obj/extra/%.o,$(ANL_PLUGIN_SRCS))
SIM_OBJS = $(SIM_PLUGIN_OBJS) $(BAS_OBJS) $(COR_OBJS) $(FRT_OBJS) $(FFT_OBJS) $(LIB_OBJS) $(AIO_OBJS) $(RUN_OBJS) .obj/compute_engine.o
ANL_OBJS = $(ANL_PLUGIN_OBJS) $(BAS_OBJS) $(COR_OBJS) $(FRT_OBJS) $(FFT_OBJS) $(LIB_OBJS) $(AIO_OBJS) $(EXT_OBJS) .obj/compute_engine.o .obj/start_analysis.o
FIC_OBJS = $(BAS_OBJS) $(COR_OBJS) $(FRT_OBJS) $(FFT_OBJS) $(LIB_OBJS) $(AIO_OBJS) $(SFB_OBJS) $(SFF_OBJS) .obj/file_converter.o .obj/sf_recipe.hart.o
ifeq ($(WITH_EXTRA),1)
SIM_OBJS += $(EXT_OBJS)
endif
ifdef PLATFORM
include $(TOP_DIR)/platforms/$(PLATFORM)
else
list := $(shell ls -m $(TOP_DIR)/platforms)
$(info A variable PLATFORM must be set. Available platforms:)
$(info $(list))
$(error Fatal error)
endif
ifndef CC
$(info A variable CC must be set in the platform file.)
$(error Fatal error)
endif
ifndef F77
ifdef FC
F77 = $(FC)
endif
endif
ifndef F77
$(info A variable F77 must be set in the platform file.)
$(error Fatal error)
endif
ifndef CFLAGS
$(info A variable CFLAGS must be set in the platform file.)
$(error Fatal error)
endif
ifndef FFLAGS
$(info A variable FFLAGS must be set in the platform file.)
$(error Fatal error)
endif
ifndef CXX
$(info A variable CXX must be set in the platform file.)
$(error Fatal error)
endif
ifndef CXXFLAGS
CXXFLAGS = $(CFLAGS)
endif
LIBS = -lgsl -lgslcblas -lm
DEFS = defs.h
defs.h:
@echo "Configuration file defs.h must be set. Available templates:"
@ls -1 $(TOP_DIR)/config/defs.*
@cat $(TOP_DIR)/platforms >& /dev/null
WITH_RT = $(shell fgrep RADIATIVE_TRANSFER defs.h)
ifneq ($(strip $(WITH_RT)),)
DEFS += rt_defs.h
rt_defs.h:
@echo "Configuration file rt_defs.h must be set. Available templates:"
@ls -1 $(TOP_DIR)/config/rt_defs.*
@cat $(TOP_DIR)/platforms >& /dev/null
endif
WITH_SF = $(shell fgrep STARFORM defs.h) $(shell fgrep STAR_FORMATION defs.h)
ifneq ($(strip $(WITH_SF)),)
#
# Parse defs.h to get the SF recipe (if it is there)
#
$(shell cc -I. -o psf-tester $(TOP_DIR)/config/parse_sf_recipe.c)
recipe := $(shell ./psf-tester | sed -e 's|[<>]||g')
$(shell rm -f psf-tester)
#
# If recipe is not in defs.h, use SF_RECIPE variable; if it is not set,
# use <hart> as the default one. Add the proper line to defs.h.
#
ifeq ($(recipe),)
ifneq ($(SF_RECIPE),)
recipe = $(SF_RECIPE)
else
recipe = hart
endif
$(shell echo " " >> defs.h)
$(shell echo "#define SF_RECIPE <"$(recipe)">" >> defs.h)
endif
#
# Find all available recipes
#
list := $(shell ls -1 $(SRC_DIR)/sf/sf_recipe.*.c | sed -e 's|.*sf_recipe\.\([[:alnum:]-]*\).c|<\1>|')
list += <custom>
#
# If not in the list, print all available recipes and exit
#
ifneq (<$(recipe)>,$(filter <$(recipe)>,$(list)))
$(info Star formation recipe should be defined with the SF_RECIPE variable in defs.h.)
$(info Available recipes:)
$(info $(list))
$(error Fatal error)
endif
ifneq ($(recipe),custom)
SFR_SRCS = $(notdir $(wildcard $(SRC_DIR)/sf/models/recipe.*.c) sf_recipe.$(recipe).c)
SFR_OBJS = $(patsubst %.c,.obj/%.o,$(SFR_SRCS))
SIM_OBJS += $(SFR_OBJS)
ANL_OBJS += $(SFR_OBJS)
endif
#
# Do the same with the feedback
#
$(shell cc -I. -o psf-tester $(TOP_DIR)/config/parse_sf_feedback.c)
feedback := $(shell ./psf-tester | sed -e 's|[<>]||g')
$(shell rm -f psf-tester)
#
# If feedback is not in defs.h, use SF_FEEDBACK variable; if it is not set,
# use <snII+snIa+ml> as the default one. Add the proper line to defs.h.
#
ifeq ($(feedback),)
ifneq ($(SF_FEEDBACK),)
feedback = $(SF_FEEDBACK)
else
feedback = hart
endif
$(shell echo " " >> defs.h)
$(shell echo "#define SF_FEEDBACK <"$(feedback)">" >> defs.h)
endif
#
# Find all available feedbacks
#
list := $(shell ls -1 $(SRC_DIR)/sf/sf_feedback.*.c | sed -e 's|.*sf_feedback\.\([[:alnum:]-]*\).c|<\1>|')
list += <custom>
#
# If not in the list, print all available recipes and exit
#
ifneq (<$(feedback)>,$(filter <$(feedback)>,$(list)))
$(info Star formation feedback should be defined with the SF_FEEDBACK variable in defs.h.)
$(info Available feedback models:)
$(info $(list))
$(error Fatal error)
endif
#
# Even custom feedback models may use existing modules
#
SFB_SRCS = $(notdir $(wildcard $(SRC_DIR)/sf/models/feedback.*.c) onestarfits.c)
ifneq ($(feedback),custom)
SFB_SRCS += sf_feedback.$(feedback).c
endif
SFB_OBJS = $(patsubst %.c,.obj/%.o,$(SFB_SRCS))
SIM_OBJS += $(SFB_OBJS)
ANL_OBJS += $(SFB_OBJS)
#
# Do the same with the formstar
#
$(shell cc -I. -o psf-tester $(TOP_DIR)/config/parse_sf_formstar.c)
formstar := $(shell ./psf-tester | sed -e 's|[<>]||g')
$(shell rm -f psf-tester)
#
# If formstar is not in defs.h, use SF_FORMSTAR variable; if it is not set,
# use <hart> as the default one. Add the proper line to defs.h.
#
ifeq ($(formstar),)
ifneq ($(SF_FORMSTAR),)
formstar = $(SF_FORMSTAR)
else
formstar = hart
endif
$(shell echo " " >> defs.h)
$(shell echo "#define SF_FORMSTAR <"$(formstar)">" >> defs.h)
endif
#
# Find all available formstars
#
list := $(shell ls -1 $(SRC_DIR)/sf/sf_formstar.*.c | sed -e 's|.*sf_formstar\.\([[:alnum:]-]*\).c|<\1>|')
list += <custom>
#
# If not in the list, print all available formstars and exit
#
ifneq (<$(formstar)>,$(filter <$(formstar)>,$(list)))
$(info Star formation method should be defined with the SF_FORMSTAR variable in defs.h.)
$(info Available formstars:)
$(info $(list))
$(error Fatal error)
endif
SFF_SRCS = $(notdir $(wildcard $(SRC_DIR)/sf/models/form_star.*.c) )
ifneq ($(formstar),custom)
SFF_SRCS += sf_formstar.$(formstar).c
endif
SFF_OBJS = $(patsubst %.c,.obj/%.o,$(SFF_SRCS))
SIM_OBJS += $(SFF_OBJS)
ANL_OBJS += $(SFF_OBJS)
endif
find_files = $(wildcard .obj/.phony)
ifneq ($(find_files),)
prev_platform = $(shell cat .obj/.phony)
ifneq ($(PLATFORM),$(prev_platform))
$(shell rm -rf .obj)
endif
endif
.obj/.phony:
mkdir .obj
echo $(PLATFORM) > .obj/.phony
.obj/extra/.phony: .obj/.phony
mkdir .obj/extra
echo $(PLATFORM) > .obj/extra/.phony
.obj/io/.phony: .obj/.phony
mkdir .obj/io
echo $(PLATFORM) > .obj/io/.phony
.obj/%.o: .obj/.phony $(DEFS) $(SRC_DIR)/drivers/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -o $@ -c $(SRC_DIR)/drivers/$(*F).c
.obj/%.o: .obj/.phony $(DEFS) $(SRC_DIR)/base/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -o $@ -c $(SRC_DIR)/base/$(*F).c
.obj/config.o: .obj/.phony $(DEFS) $(TOP_DIR)/config/list_defines.h $(SRC_DIR)/core/config.c
$(CC) $(CFLAGS) $(INCLUDES) \
-DREPO_PARENT="\"`hg paths -R $(TOP_DIR) | sed -ne 's#^default = ##p'`\"" \
-DREPO_VERSION="\"`hg parent -R $(TOP_DIR) --template '{latesttag}.{latesttagdistance}'`\"" \
-DREPO_REVISION="\"`hg id -R $(TOP_DIR) -i`\"" \
-I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -o $@ -c $(SRC_DIR)/core/$(*F).c
.obj/io_cart.o: .obj/.phony $(DEFS) $(SRC_DIR)/core/io_cart.c $(SRC_DIR)/core/io_cart1.def $(SRC_DIR)/core/io_cart2.def $(SRC_DIR)/core/io_cart3_hydro_tracer.def
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -o $@ -c $(SRC_DIR)/core/$(*F).c
.obj/io_artio.o: .obj/.phony $(DEFS) $(SRC_DIR)/core/io_artio.c $(SRC_DIR)/tools/artio/artio.h
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -DARTIO_MPI -o $@ -c $(SRC_DIR)/core/$(*F).c
.obj/%.o: .obj/.phony $(DEFS) $(SRC_DIR)/core/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -o $@ -c $(SRC_DIR)/core/$(*F).c
.obj/%.o: .obj/.phony $(DEFS) $(SRC_DIR)/base/rt_config.h $(SRC_DIR)/core/frt/%.F
$(F77) $(FFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core/frt -o $@ -c $(SRC_DIR)/core/frt/$(*F).F
.obj/%.o: .obj/.phony $(DEFS) $(SRC_DIR)/tools/fft/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/tools/fft -o $@ -c $(SRC_DIR)/tools/fft/$(*F).c
.obj/%.o: .obj/.phony $(SRC_DIR)/tools/artio/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/tools/artio -DARTIO_MPI -o $@ -c $(SRC_DIR)/tools/artio/$(*F).c
.obj/%.o: .obj/.phony $(DEFS) $(SRC_DIR)/run/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -o $@ -c $(SRC_DIR)/run/$(*F).c
.obj/%.o: .obj/.phony $(DEFS) $(SRC_DIR)/sf/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -o $@ -c $(SRC_DIR)/sf/$(*F).c
.obj/%.o: .obj/.phony $(DEFS) $(SRC_DIR)/sf/models/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -o $@ -c $(SRC_DIR)/sf/models/$(*F).c
.obj/%.o: .obj/.phony $(SRC_DIR)/tools/other/%.f
$(F77) $(FFLAGS) -I$(SRC_DIR)/tools/other -o $@ -c $(SRC_DIR)/tools/other/$(*F).f
.obj/%.o: .obj/.phony $(SRC_DIR)/tools/other/%.c
$(CC) $(CFLAGS) -I$(SRC_DIR)/tools/other -o $@ -c $(SRC_DIR)/tools/other/$(*F).c
.obj/extra/default_plugin.o: .obj/extra/.phony $(DEFS) $(SRC_DIR)/core/default_plugin.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -o $@ -c $(SRC_DIR)/core/default_plugin.c
.obj/extra/%.o: .obj/extra/.phony $(DEFS) $(SRC_DIR)/extra/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/base -I$(SRC_DIR)/core -o $@ -c $(SRC_DIR)/extra/$(*F).c
.obj/extra/%.o: .obj/extra/.phony $(DEFS) $(filter %$(*F).c,$(PLUGIN))
$(CC) $(CFLAGS) -I. $(INCLUDES) -I$(SRC_DIR)/base -I$(SRC_DIR)/core -I$(SRC_DIR)/extra -o $@ -c $(filter %$(*F).c,$(PLUGIN))
.obj/io/%.o: .obj/.phony .obj/io/.phony $(SRC_DIR)/tools/artio/%.c
$(CC) $(CFLAGS) $(INCLUDES) -I. -I$(SRC_DIR)/tools/artio -o $@ -c $(SRC_DIR)/tools/artio/$(*F).c
clean:
rm -rf .obj core $(CLEAN)
all:
$(MAKE) $(ALL)
info:
which mpirun
$(info **********************************************)
$(info * *)
$(info * Adaptive Refinement Tree *)
$(info * *)
$(info * Version 1.9 *)
$(info * *)
$(info **********************************************)
$(info Compiling for platform: $(PLATFORM))
endif