-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
252 lines (211 loc) · 10.4 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
245
246
247
248
249
250
251
252
# ===================================================================================================
# Makefile for the ROOT programs - derived from $ROOTSYS/test/Makefile
# using ROOT v5.34.18
# Orig author: Fons Rademakers, 29/2/2000 - Copyright (c) 2000 Rene Brun and Fons Rademakers
# ===================================================================================================
# ---------------------------------------------------------------------------------------------------
# general ROOT flags etc.
# ---------------------------------------------------------------------------------------------------
RC := root-config
ifeq ($(shell which $(RC) 2>&1 | sed -ne "s@.*/$(RC)@$(RC)@p"),$(RC))
MKARCH := $(wildcard $(shell $(RC) --etcdir)/Makefile.arch)
RCONFIG := $(wildcard $(shell $(RC) --incdir)/RConfigure.h)
endif
ifneq ($(MKARCH),)
include $(MKARCH)
else
ifeq ($(ROOTSYS),)
ROOTSYS = ..
endif
include $(ROOTSYS)/etc/Makefile.arch
endif
# -include ../MyConfig.mk
# ---------------------------------------------------------------------------------------------------
# add rpath to LDFLAGS, which may be needed for precompiled root versions
# ---------------------------------------------------------------------------------------------------
CURRENT_DIR = $(shell pwd)
ROOTLIB := $(wildcard $(shell $(RC) --libdir))
LDFLAGS += -Wl,-rpath,$(ROOTLIB),-rpath,$(CURRENT_DIR)
# ---------------------------------------------------------------------------------------------------
# search path for included files and files-to-make; included ROOT libraries
# ---------------------------------------------------------------------------------------------------
CXXFLAGS += -g -I../ -I./ -I../src/ -I../include/
VPATH += ./:../:../src:../include
MORELIBS = -lMinuit -lTMVA -lXMLIO -lTreePlayer
ROOT_LD = $(shell $(RC) --libs) $(MORELIBS)
LIBS += $(MORELIBS)
# ---------------------------------------------------------------------------------------------------
# Added -std=c++0x to enable c++11 support for e.g., stoi()
# Tested on clang (MAC) and on gcc 4.6.3 (LINUX). See: https://gcc.gnu.org/projects/cxx0x.html
# ---------------------------------------------------------------------------------------------------
CXXFLAGS += -std=c++0x
# # ---------------------------------------------------------------------------------------------------
# # for degudding only - cancel optimization (remove -O2 flag) to speed up compilation
# # ---------------------------------------------------------------------------------------------------
# OPT =
# OPT2 =
# CXXOPT =
# # ---------------------------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------
# objects and shared libraries
# ---------------------------------------------------------------------------------------------------
OptMaps_O = OptMaps.$(ObjSuf)
OptMaps_S = OptMaps.$(SrcSuf)
OptMaps_SO = libOptMaps.$(DllSuf)
Utils_O = Utils.$(ObjSuf)
Utils_S = Utils.$(SrcSuf)
Utils_SO = libUtils.$(DllSuf)
VarMaps_O = VarMaps.$(ObjSuf)
VarMaps_S = VarMaps.$(SrcSuf)
VarMaps_SO = libVarMaps.$(DllSuf)
OutMngr_O = OutMngr.$(ObjSuf)
OutMngr_S = OutMngr.$(SrcSuf)
OutMngr_SO = libOutMngr.$(DllSuf)
BaseClass_O = BaseClass.$(ObjSuf)
BaseClass_S = BaseClass.$(SrcSuf)
BaseClass_SO = libBaseClass.$(DllSuf)
CatFormat_O = CatFormat.$(ObjSuf)
CatFormat_S = CatFormat.$(SrcSuf)
CatFormat_SO = libCatFormat.$(DllSuf)
ANNZ_O = ANNZ.$(ObjSuf)
ANNZ_S = ANNZ.$(SrcSuf)
ANNZ_SO = libANNZ.$(DllSuf)
myANNZ_O = myANNZ.$(ObjSuf)
myANNZ_SO = myANNZ.$(DllSuf)
myANNZ_E = myANNZ
Wrapper_O = Wrapper.$(ObjSuf)
Wrapper_S = Wrapper.$(SrcSuf)
Wrapper_SO = Wrapper.$(DllSuf)
# ---------------------------------------------------------------------------------------------------
# main rule
# ---------------------------------------------------------------------------------------------------
all: $(myANNZ_E) $(Wrapper_SO)
# ---------------------------------------------------------------------------------------------------
# messaging
# ---------------------------------------------------------------------------------------------------
txtred = $(shell tput setaf 1) # Red
txtgrn = $(shell tput setaf 2) # Green
txtylw = $(shell tput setaf 3) # Yellow
txtblu = $(shell tput setaf 4) # Blue
txtrst = $(shell tput sgr0) # Reset
msg0 = "$(txtblu)---------------------- DONE:"$(txtgrn)
msg1 = "$(txtblu)---------------------- DONE:"$(txtylw)
msg2 = "$(txtblu)----------------------$(txtrst)"
# ---------------------------------------------------------------------------------------------------
# pre-compile the header file
# see e.g.,: http://itscompiling.eu/2017/01/12/precompiled-headers-cpp-compilation/
# ---------------------------------------------------------------------------------------------------
Common_H = commonInclude.hpp
Common_HGC = $(Common_H).gch
Common_HGC_FLAG = -include $(Common_H)
$(Common_HGC): $(Common_H)
c++ $(CXXFLAGS) -o $(Common_HGC) ../include/$(Common_H)
c++ $(CXXFLAGS) ../include/$(Common_H)
@echo $(msg1) $@ $(msg2)
# ---------------------------------------------------------------------------------------------------
# objects
# ---------------------------------------------------------------------------------------------------
$(OptMaps_O): OptMaps.hpp ../src/OptMaps*.cpp $(Common_HGC)
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(OptMaps_O) ../src/OptMaps.cpp
@echo $(msg1) $@ $(msg2)
$(Utils_O): Utils.hpp ../src/Utils*.cpp OptMaps.hpp
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(Utils_O) ../src/Utils.cpp
@echo $(msg1) $@ $(msg2)
$(VarMaps_O): VarMaps.hpp ../src/VarMaps*.cpp CntrMap.hpp OptMaps.hpp Utils.hpp
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(VarMaps_O) ../src/VarMaps.cpp
@echo $(msg1) $@ $(msg2)
$(OutMngr_O): OutMngr.hpp ../src/OutMngr*.cpp OptMaps.hpp Utils.hpp
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(OutMngr_O) ../src/OutMngr.cpp
@echo $(msg1) $@ $(msg2)
$(BaseClass_O): BaseClass.hpp ../src/BaseClass*.cpp OptMaps.hpp Utils.hpp VarMaps.hpp OutMngr.hpp
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(BaseClass_O) ../src/BaseClass.cpp
@echo $(msg1) $@ $(msg2)
$(CatFormat_O): CatFormat.hpp ../src/CatFormat*.cpp OptMaps.hpp Utils.hpp VarMaps.hpp OutMngr.hpp BaseClass.hpp
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(CatFormat_O) ../src/CatFormat.cpp
@echo $(msg1) $@ $(msg2)
$(ANNZ_O): ANNZ.hpp ../src/ANNZ*.cpp OptMaps.hpp Utils.hpp VarMaps.hpp OutMngr.hpp BaseClass.hpp
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(ANNZ_O) ../src/ANNZ.cpp
@echo $(msg1) $@ $(msg2)
$(myANNZ_O): myANNZ.hpp ../src/myANNZ*.cpp OptMaps.hpp Utils.hpp VarMaps.hpp OutMngr.hpp BaseClass.hpp CatFormat.hpp ANNZ.hpp
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(myANNZ_O) ../src/myANNZ.cpp
@echo $(msg1) $@ $(msg2)
$(Wrapper_O): Wrapper.hpp ../src/Wrapper*.cpp OptMaps.hpp Utils.hpp VarMaps.hpp OutMngr.hpp BaseClass.hpp CatFormat.hpp ANNZ.hpp myANNZ.hpp
c++ $(CXXFLAGS) $(Common_HGC_FLAG) -c -o $(Wrapper_O) ../src/Wrapper.cpp
@echo $(msg1) $@ $(msg2)
# ---------------------------------------------------------------------------------------------------
# shared libraries
# ---------------------------------------------------------------------------------------------------
$(OptMaps_SO): $(OptMaps_O)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
$(Utils_SO): $(Utils_O) $(OptMaps_SO)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
$(VarMaps_SO): $(VarMaps_O) $(OptMaps_SO) $(Utils_SO)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
$(OutMngr_SO): $(OutMngr_O) $(OptMaps_SO) $(Utils_SO) $(VarMaps_SO)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
$(BaseClass_SO): $(BaseClass_O) $(OptMaps_SO) $(Utils_SO) $(VarMaps_SO) $(OutMngr_SO)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
$(CatFormat_SO): $(CatFormat_O) $(OptMaps_SO) $(Utils_SO) $(VarMaps_SO) $(OutMngr_SO) $(BaseClass_SO)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
$(ANNZ_SO): $(ANNZ_O) $(OptMaps_SO) $(Utils_SO) $(VarMaps_SO) $(OutMngr_SO) $(BaseClass_SO)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
$(myANNZ_SO): $(myANNZ_O) $(OptMaps_SO) $(Utils_SO) $(VarMaps_SO) $(OutMngr_SO) $(BaseClass_SO) $(CatFormat_SO) $(ANNZ_SO)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
# ---------------------------------------------------------------------------------------------------
# myANNZ_E
# ---------------------------------------------------------------------------------------------------
$(myANNZ_E): $(myANNZ_SO) $(OptMaps_SO) $(Utils_SO) $(VarMaps_SO) $(OutMngr_SO) $(BaseClass_SO) $(CatFormat_SO) $(ANNZ_SO)
$(LD) $(LDFLAGS) $^ $(LIBS) $(OutPutOpt) $@ $(MT_EXE) $(ROOT_LD)
@echo $(msg0) $@ $(msg2)
# ===================================================================================================
# ---------------------------------------------------------------------------------------------------
# Wrapper_SO
# ---------------------------------------------------------------------------------------------------
$(Wrapper_SO): $(Wrapper_O) $(OptMaps_SO) $(Utils_SO) $(VarMaps_SO) $(OutMngr_SO) $(BaseClass_SO) $(CatFormat_SO) $(ANNZ_SO) $(myANNZ_SO)
ifeq ($(PLATFORM),macosx)
$(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(ROOT_LD)
endif
@echo $(msg0) $@ $(msg2)
# ---------------------------------------------------------------------------------------------------