-
Notifications
You must be signed in to change notification settings - Fork 4
/
makefile
127 lines (106 loc) · 3.88 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
# Call as make [sam=shark,...] [system=personal,hyades,...] [mode=standard,dev]
# optional arguments:
# sam = galaxy formation model; each model requires custom modules "module_user_routines_[sam].f08" and "module_user_selection_[sam].f08"
# system = computing system on which stingray is complied and executed, used to link HDF5 library if not in ${HDF5_DIR}
# mode = compilation mode; allowed modes are 'default' and 'dev'
ifndef sam
sam = shark
endif
ifndef system
system = default
endif
ifndef mode
mode = default
endif
# library flags (depend on the "system" option)
ifeq ($(system),default)
LFLAGS = -I${HDF5_DIR}/include -L${HDF5_DIR}/lib -lhdf5_fortran -lhdf5
else ifeq ($(system),hyades) # ICRAR-Hyades
LFLAGS = -I${BLDR_HDF5_INCLUDE_PATH} -L${BLDR_HDF5_LIB_PATH} -lhdf5_fortran -lhdf5
else
$(error ERROR: unknown system '$(system)')
endif
# standard compiler flags (depend on the "mode" option)
ifeq ($(mode),default)
CFLAGS = -O3 -fopenmp -ffree-line-length-0
else ifeq ($(mode),dev)
CFLAGS = -O0 -g -fbounds-check -fwhole-file -ffpe-trap=invalid,zero,overflow -Wall -Wunused -Wuninitialized -Wsurprising -Wconversion
else
$(error ERROR: unknown mode: '${mode}')
endif
# concatenate flags
FCFLAGS = $(CFLAGS) $(LFLAGS)
# Compiler
FC = gfortran
# user info
$(info Compilation options:)
$(info + Computing system = '${system}'.)
$(info + Compiling mode = '${mode}'.)
$(info + Galaxy formation model = '${sam}'.)
# List of executables to be built within the package
PROGRAMS = stingray
# "make" builds all
all: $(PROGRAMS)
stingray.o: shared/shared_module_core.o \
shared/shared_module_arguments.o \
shared/shared_module_parameters.o \
shared/shared_module_hdf5.o \
shared/shared_module_cosmology.o \
shared/shared_module_maths.o \
shared/shared_module_vectors.o \
shared/shared_module_constants.o \
shared/shared_module_sort.o \
module_global.o \
module_parameters.o \
module_conversion.o \
module_emission_lines.o \
module_user_routines_$(sam).o \
module_selection_tools.o \
module_user_selection_$(sam).o \
module_tiling.o \
module_sky.o
stingray: shared_module_core.o \
shared_module_arguments.o \
shared_module_parameters.o \
shared_module_hdf5.o \
shared_module_cosmology.o \
shared_module_maths.o \
shared_module_vectors.o \
shared_module_constants.o \
shared_module_sort.o \
module_global.o \
module_parameters.o \
module_conversion.o \
module_emission_lines.o \
module_user_routines_$(sam).o \
module_selection_tools.o \
module_user_selection_$(sam).o \
module_tiling.o \
module_sky.o
# ======================================================================
# And now the general rules, these should not require modification
# ======================================================================
# General rule for building prog from prog.o; $^ (GNU extension) is
# used in order to list additional object files on which the
# executable depends
%: %.o
$(FC) $(FCFLAGS) -o $@ $^
# General rules for building prog.o from prog.f90 or prog.F90; $< is
# used in order to list only the first prerequisite (the source file)
# and not the additional prerequisites such as module or include files
%.o: %.f90
$(FC) $(FCFLAGS) -c $<
%.o: %.f95
$(FC) $(FCFLAGS) -c $<
%.o: %.f03
$(FC) $(FCFLAGS) -c $<
%.o: %.f08
$(FC) $(FCFLAGS) -c $<
# Utility targets
.PHONY: clean veryclean
clean:
rm -f *.o *.mod *.MOD
rm -f *~ $(PROGRAMS)
rm -f fort.*
rm -rf *.dSYM
rm -rf example