aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: f4848dac1de81a5b24100eb811afddd695c29da7 (plain)
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
#
# Makefile for `chandra-acis-analysis/mass_profile` tools
#
# Junhua GU
# Weitian LI
# 2016-06-07
#


CXX ?= g++
CXXFLAGS += -Wall -Wextra
#CXXFLAGS += -Werror

ifdef OPENMP
	CXXFLAGS += -fopenmp
endif

ifdef DEBUG
	CXXFLAGS += -g
else
	CXXFLAGS += -O2
endif

OPT_UTIL_INC ?= -I../opt_utilities

TARGETS= fit_dbeta_sbp fit_beta_sbp fit_wang2012_model \
		fit_nfw_mass calc_lx_dbeta calc_lx_beta
HEADERS= projector.hpp spline.hpp vchisq.hpp

all: $(TARGETS)

# NOTE:
# Object/source files should placed *before* libraries (order matters)

fit_dbeta_sbp: fit_dbeta_sbp.o beta_cfg.o report_error.o
	$(CXX) $(CXXFLAGS) $^ -o $@ $(OPT_UTIL_INC)

fit_beta_sbp: fit_beta_sbp.o beta_cfg.o dump_fit_qdp.o
	$(CXX) $(CXXFLAGS) $^ -o $@ $(OPT_UTIL_INC)

fit_wang2012_model: fit_wang2012_model.o
	$(CXX) $(CXXFLAGS) $^ -o $@ $(OPT_UTIL_INC)

fit_nfw_mass: fit_nfw_mass.o
	$(CXX) $(CXXFLAGS) $^ -o $@ $(OPT_UTIL_INC)

calc_lx_dbeta: calc_lx_dbeta.o beta_cfg.o report_error.o
	$(CXX) $(CXXFLAGS) $^ -o $@ $(OPT_UTIL_INC)

calc_lx_beta: calc_lx_beta.o beta_cfg.o dump_fit_qdp.o
	$(CXX) $(CXXFLAGS) $^ -o $@ $(OPT_UTIL_INC)


fit_dbeta_sbp.o: fit_dbeta_sbp.cpp $(HEADERS)
	$(CXX) $(CXXFLAGS) -c $< $(OPT_UTIL_INC)

fit_beta_sbp.o: fit_beta_sbp.cpp beta.hpp $(HEADERS)
	$(CXX) $(CXXFLAGS) -c $< $(OPT_UTIL_INC)

fit_wang2012_model.o: fit_wang2012_model.cpp wang2012_model.hpp chisq.hpp
	$(CXX) $(CXXFLAGS) -c $< $(OPT_UTIL_INC)

fit_nfw_mass.o: fit_nfw_mass.cpp nfw.hpp chisq.hpp
	$(CXX) $(CXXFLAGS) -c $< $(OPT_UTIL_INC)

calc_lx_dbeta.o: calc_lx_dbeta.cpp $(HEADERS)
	$(CXX) $(CXXFLAGS) -c $< $(OPT_UTIL_INC)

calc_lx_beta.o: calc_lx_beta.cpp beta.hpp $(HEADERS)
	$(CXX) $(CXXFLAGS) -c $< $(OPT_UTIL_INC)

beta_cfg.o: beta_cfg.cpp beta_cfg.hpp
	$(CXX) $(CXXFLAGS) -c $<

report_error.o: report_error.cpp report_error.hpp
	$(CXX) $(CXXFLAGS) -c $<

dump_fit_qdp.o: dump_fit_qdp.cpp dump_fit_qdp.hpp
	$(CXX) $(CXXFLAGS) -c $< $(OPT_UTIL_INC)

%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c $< $(OPT_UTIL_INC)


clean:
	rm -f *.o $(TARGETS)


install: $(TARGETS)
	@for f in $(TARGETS); do \
		(cd ../bin && ln -svf ../src/$$f . ); \
	done


uninstall:
	@for f in $(TARGETS); do \
		rm -fv ../bin/$$f; \
	done