efaab2ef |
1 | # Top level Makefile for AliRoot System |
2 | # |
3 | # Author: Jan-Erik Revsbech (revsbech@fys.ku.dk) |
4 | # Developed on idea of Boris Polichtchouk (Boris.Polichtchouk@cern.ch), 15/4/2001 |
5 | |
6 | |
7 | ##### include general path/location macros ##### |
8 | override ALICE_ROOT=$(shell pwd) |
9 | |
15142e2f |
10 | ifdef ALIVERBOSE |
11 | MUTE:= |
12 | else |
13 | MUTE:=@ |
14 | endif |
15 | |
efaab2ef |
16 | include build/Makefile.config |
f347de98 |
17 | ################################################################## |
18 | # |
19 | # Where to install libraries and binaries |
20 | # and common header files |
efaab2ef |
21 | |
efaab2ef |
22 | LIBPATH=lib/tgt_$(ALICE_TARGET) |
23 | BINPATH=bin/tgt_$(ALICE_TARGET) |
f347de98 |
24 | EXPORTDIR = $(ALICE_ROOT)/include |
25 | ################################################################## |
efaab2ef |
26 | |
f347de98 |
27 | ################################################################## |
28 | # include machine dependent macros |
efaab2ef |
29 | |
1092afea |
30 | -include build/Makefile.$(ALICE_TARGET) |
f347de98 |
31 | ################################################################## |
32 | |
33 | ################################################################## |
34 | # |
35 | # Check if called with debug |
efaab2ef |
36 | |
efaab2ef |
37 | ifeq ($(ALIDEBUG),YES) |
38 | override ALICE_TARGET:=$(ALICE_TARGET)DEBUG |
39 | FFLAGS := -g $(filter-out -O%,$(FFLAGS)) |
40 | CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS)) |
41 | CFLAGS := -g $(filter-out -O%,$(CLAGS)) |
a6e13297 |
42 | SOFLAGS := -g $(filter-out -O%,$(SOFLAGS)) |
43 | LDFLAGS := -g $(filter-out -O%,$(LDFLAGS)) |
efaab2ef |
44 | endif |
f347de98 |
45 | ################################################################## |
efaab2ef |
46 | |
f347de98 |
47 | ################################################################## |
efaab2ef |
48 | # |
f347de98 |
49 | # Modules to build |
efaab2ef |
50 | |
896cb507 |
51 | # COMMENTED OUT FOR TEST PURPOSES |
1092afea |
52 | |
53 | ALIROOTMODULES:= STEER \ |
9d942927 |
54 | TGeant3 TFluka PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \ |
265e2b98 |
55 | CRT RICH START STRUCT VZERO EVGEN RALICE ALIFAST \ |
3634fea4 |
56 | THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \ |
9d942927 |
57 | THerwig |
3634fea4 |
58 | |
59 | GEANT4MODULES:= TGeant4 AliGeant4 |
60 | ifeq ($(MAKECMDGOALS),geant4) |
61 | ALIROOTMODULES += $(GEANT4MODULES) |
62 | endif |
896cb507 |
63 | |
9d942927 |
64 | CERNMODULES:= PDF PYTHIA PYTHIA6 GEANT321 MINICERN HIJING HERWIG |
1092afea |
65 | |
1092afea |
66 | MODULES:=$(ALIROOTMODULES) $(CERNMODULES) |
896cb507 |
67 | |
f347de98 |
68 | ################################################################## |
efaab2ef |
69 | |
70 | MODULES += ALIROOT |
71 | |
72 | MODDIRS := MODULES |
f347de98 |
73 | |
74 | ############################################################# |
75 | # |
76 | # Default include dirs for |
77 | # C++, Fortran, Cint, and dependencies |
78 | # The module directory will be added by each module |
79 | # |
80 | |
f347de98 |
81 | CXXFLAGS += -I$(ALICE_ROOT)/include |
efaab2ef |
82 | CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include) |
83 | |
f347de98 |
84 | CINTFLAGS += -I$(ALICE_ROOT)/include |
efaab2ef |
85 | CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include) |
86 | |
f347de98 |
87 | DEPINC += -I$(ALICE_ROOT)/include |
efaab2ef |
88 | DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include) |
f347de98 |
89 | ############################################################# |
efaab2ef |
90 | |
91 | |
f347de98 |
92 | ############################################################# |
93 | # |
94 | # Libraries to link binaries against |
95 | # Libraries will be linked againstSHLIB |
7ae15f02 |
96 | LIBS := $(GLIBS) $(ROOTLIBS) $(SYSLIBS) |
f347de98 |
97 | ############################################################# |
efaab2ef |
98 | |
99 | |
100 | # default target |
101 | default: alilibs aliroot |
102 | |
f347de98 |
103 | |
104 | ############################################################# |
105 | # |
106 | # Each module will add to this |
107 | |
15142e2f |
108 | ALLLIBS := |
109 | ALLEXECS := |
efaab2ef |
110 | INCLUDEFILES := |
15142e2f |
111 | BINLIBS := |
112 | EXPORTFILES := |
f347de98 |
113 | ############################################################# |
efaab2ef |
114 | |
15142e2f |
115 | BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH) |
1092afea |
116 | |
efaab2ef |
117 | |
118 | #Dependencies of module.mk files |
119 | |
120 | include build/module.dep |
121 | |
f347de98 |
122 | ############################################################# |
123 | # |
124 | # Check if module.mk is present for the library |
ba419e66 |
125 | %.mk: build/module.tpl |
15142e2f |
126 | ifndef ALIQUIET |
efaab2ef |
127 | @echo "***** Creating $@ file *****"; |
15142e2f |
128 | endif |
896cb507 |
129 | @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@; |
f347de98 |
130 | ############################################################# |
131 | |
132 | # ************************************************************************** |
133 | # |
134 | # If cleaning, do not include |
135 | # dependencies or module.mk files. |
efaab2ef |
136 | |
1092afea |
137 | ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),) |
efaab2ef |
138 | |
15142e2f |
139 | # If making modules, not not include |
896cb507 |
140 | # anything |
141 | |
142 | ifneq ($(findstring modules,$(MAKECMDGOALS)),modules) |
143 | |
f347de98 |
144 | ############################################################# |
145 | # |
146 | # Include the modules |
1092afea |
147 | -include $(patsubst %,%/module.mk,$(MODULES)) |
f347de98 |
148 | ############################################################# |
efaab2ef |
149 | |
f347de98 |
150 | ############################################################# |
151 | # |
152 | # include dependencies if not making them! |
1092afea |
153 | ifneq ($(MAKECMDGOALS),depend ) |
154 | # Don't include if cleaning of any sort |
155 | ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) |
efaab2ef |
156 | include $(INCLUDEFILES) |
157 | endif |
1092afea |
158 | endif |
f347de98 |
159 | ############################################################# |
efaab2ef |
160 | |
896cb507 |
161 | endif |
efaab2ef |
162 | endif |
f347de98 |
163 | # ************************************************************************** |
164 | |
1092afea |
165 | ############################################################# |
166 | # |
167 | # include dummy dependency file |
168 | # *MUST* be last includefile |
169 | include build/dummy.d |
170 | ############################################################# |
171 | |
efaab2ef |
172 | |
173 | # targets |
174 | |
3634fea4 |
175 | .PHONY: alilibs aliroot geant4 makedistr clean |
1092afea |
176 | |
896cb507 |
177 | modules: $(patsubst %,%/module.mk,$(MODULES)) |
178 | |
3634fea4 |
179 | geant4modules: $(patsubst %,%/module.mk,$(GEANT4MODULES)) |
180 | |
1092afea |
181 | aliroot: $(BINPATH) $(ALLEXECS) alilibs bin |
efaab2ef |
182 | |
3634fea4 |
183 | geant4: aliroot |
184 | |
1092afea |
185 | alilibs: $(LIBPATH) $(ALLLIBS) lib modules |
efaab2ef |
186 | |
187 | # Single Makefile "distribution": Makefile + modules + mkdepend scripts |
188 | makedistr: $(MODULES) |
189 | tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \ |
190 | Makefile create build/* |
191 | |
192 | all: aliroot |
193 | |
f347de98 |
194 | depend: $(INCLUDEFILES) |
efaab2ef |
195 | |
196 | debug: |
15142e2f |
197 | ifndef ALIQUIET |
efaab2ef |
198 | @echo "***** Entering DEBUG mode. *****" |
15142e2f |
199 | endif |
efaab2ef |
200 | @(export ALIDEBUG=YES && $(MAKE) -f Makefile.flat ) |
201 | lib: |
202 | @mkdir lib |
203 | @mkdir lib/tgt_$(ALICE_TARGET) |
204 | |
205 | bin: |
206 | @mkdir bin |
207 | @mkdir bin/tgt_$(ALICE_TARGET) |
208 | |
209 | $(MODULES): |
15142e2f |
210 | ifndef ALIQUIET |
efaab2ef |
211 | @echo "***** Making $@ *****" |
15142e2f |
212 | endif |
213 | @mkdir -p $@ |
efaab2ef |
214 | |
215 | $(BINPATH): |
15142e2f |
216 | ifndef ALIQUIET |
efaab2ef |
217 | @echo "***** Making $@ *****" |
15142e2f |
218 | endif |
219 | @mkdir -p $@ |
efaab2ef |
220 | |
221 | $(LIBPATH): |
15142e2f |
222 | ifndef ALIQUIET |
efaab2ef |
223 | @echo "***** Making $@ *****" |
15142e2f |
224 | endif |
225 | @mkdir -p $@ |
efaab2ef |
226 | |
1092afea |
227 | build/dummy.d: $(EXPORTFILES) |
228 | @(if [ ! -f $@ ] ; then \ |
229 | touch $@; \ |
230 | fi) |
231 | |
232 | clean: |
15142e2f |
233 | @echo "***** No targen clean, use one of these *****" |
1092afea |
234 | @echo " clean-aliroot : Clean up all aliroot libraries" |
235 | @echo " clean-MODULENAME : Clean everything from module MODULENAME" |
236 | @echo " clean-all : Cleans up everything, including cern libraires" |
237 | @echo " clean-modules : Clean all module.mk file in all modules" |
238 | @echo " clean-libs : Clean all libraries (not object files)" |
239 | @echo "********************************************" |
240 | |
15142e2f |
241 | clean-all: clean-modules clean-libs clean-bins |
242 | ifndef ALIQUIET |
efaab2ef |
243 | @echo "***** Cleaning up everything ****" |
15142e2f |
244 | endif |
245 | $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES)) |
246 | $(MUTE)rm -rf $(EXPORTDIR) |
efaab2ef |
247 | |
1092afea |
248 | #This cleans only libraries that are not CERN-libraries |
249 | |
250 | clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES)) |
efaab2ef |
251 | |
896cb507 |
252 | clean-dicts: |
15142e2f |
253 | ifndef ALIQUIET |
f347de98 |
254 | @echo "***** Cleaning up G__ files *****" |
15142e2f |
255 | endif |
256 | $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__* |
257 | |
efaab2ef |
258 | clean-modules: |
15142e2f |
259 | ifndef ALIQUIET |
efaab2ef |
260 | @echo "***** Cleaning up module.mk files *****" |
15142e2f |
261 | endif |
262 | $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES)) |
efaab2ef |
263 | |
264 | clean-depend: |
15142e2f |
265 | ifndef ALIQUIET |
efaab2ef |
266 | @echo "***** Cleaning up dependencies *****" |
15142e2f |
267 | endif |
268 | $(MUTE)echo rm `find . -name "*.d"` |
efaab2ef |
269 | |
270 | clean-objects: |
15142e2f |
271 | ifndef ALIQUIET |
efaab2ef |
272 | @echo "***** Cleaning up .o files *****" |
15142e2f |
273 | endif |
274 | $(MUTE)echo rm `find . -name "*.o"` |
efaab2ef |
275 | |
276 | clean-libs: |
15142e2f |
277 | ifndef ALIQUIET |
efaab2ef |
278 | @echo "***** Cleaning up library files *****" |
15142e2f |
279 | endif |
280 | $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/* |
efaab2ef |
281 | |
282 | clean-bins: |
15142e2f |
283 | ifndef ALIQUIET |
efaab2ef |
284 | @echo "***** Cleaning up binary files *****" |
15142e2f |
285 | endif |
286 | $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET) |