b9d0a01d |
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 |
fe4da5cc |
5 | |
fe4da5cc |
6 | |
b9d0a01d |
7 | ##### include general path/location macros ##### |
8 | override ALICE_ROOT=$(shell pwd) |
fe4da5cc |
9 | |
b9d0a01d |
10 | ifdef ALIVERBOSE |
11 | MUTE:= |
12 | else |
13 | MUTE:=@ |
14 | endif |
fe4da5cc |
15 | |
b9d0a01d |
16 | # IRST coding rule check |
17 | IRST_INSTALLDIR=$(ALICE)/local/IRST |
50a3b0ee |
18 | IRST_CONFIG_DIR=$(IRST_INSTALLDIR)/userConfig/ALICE |
b9d0a01d |
19 | CLASSPATH=$(IRST_INSTALLDIR) |
50a3b0ee |
20 | export CLASSPATH IRST_INSTALLDIR IRST_CONFIG_DIR |
b9d0a01d |
21 | CODE_CHECK=java rules.ALICE.ALICERuleChecker |
22 | REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh |
fe4da5cc |
23 | |
fe4da5cc |
24 | |
b9d0a01d |
25 | include build/Makefile.config |
26 | ################################################################## |
27 | # |
28 | # Where to install libraries and binaries |
29 | # and common header files |
47b969ba |
30 | |
b9d0a01d |
31 | LIBPATH=lib/tgt_$(ALICE_TARGET) |
32 | BINPATH=bin/tgt_$(ALICE_TARGET) |
33 | EXPORTDIR = $(ALICE_ROOT)/include |
34 | ################################################################## |
47b969ba |
35 | |
b9d0a01d |
36 | ################################################################## |
37 | # include machine dependent macros |
fe4da5cc |
38 | |
b9d0a01d |
39 | -include build/Makefile.$(ALICE_TARGET) |
40 | ################################################################## |
fe4da5cc |
41 | |
b9d0a01d |
42 | ################################################################## |
43 | # |
44 | # Check if called with debug |
42865053 |
45 | |
b9d0a01d |
46 | ifeq ($(ALIDEBUG),YES) |
47 | override ALICE_TARGET:=$(ALICE_TARGET)DEBUG |
48 | FFLAGS := -g $(filter-out -O%,$(FFLAGS)) |
49 | CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS)) |
50 | CFLAGS := -g $(filter-out -O%,$(CLAGS)) |
51 | SOFLAGS := -g $(filter-out -O%,$(SOFLAGS)) |
52 | LDFLAGS := -g $(filter-out -O%,$(LDFLAGS)) |
53 | endif |
54 | ################################################################## |
fe4da5cc |
55 | |
2d8cad5a |
56 | ################################################################## |
57 | # |
58 | # Check if called with profile |
59 | |
60 | ifeq ($(ALIPROFILE),YES) |
61 | override ALICE_TARGET:=$(ALICE_TARGET)PROF |
62 | FFLAGS += -pg |
63 | CXXFLAGS += -pg |
64 | CFLAGS += -pg |
65 | SOFLAGS += -pg |
66 | LDFLAGS += -pg |
67 | endif |
68 | ################################################################## |
69 | |
b9d0a01d |
70 | ################################################################## |
71 | # |
72 | # Modules to build |
fe4da5cc |
73 | |
b9d0a01d |
74 | # Uncomment to show some output |
75 | #$(warning MAKECMDGOALS=$(MAKECMDGOALS)) |
fe4da5cc |
76 | |
b9d0a01d |
77 | ALIROOTMODULES:= STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \ |
78 | CRT RICH START STRUCT EVGEN RALICE ALIFAST VZERO \ |
79 | THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \ |
74301767 |
80 | THerwig TEPEMGEN EPEMGEN FASTSIM |
41f6cf69 |
81 | |
b9d0a01d |
82 | CERNMODULES:= PDF PYTHIA PYTHIA6 HIJING MICROCERN HERWIG |
83 | |
84 | MODULES:=$(ALIROOTMODULES) $(CERNMODULES) |
85 | |
86 | ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka) |
87 | MODULES += TFluka |
88 | endif |
89 | |
2830f9fb |
90 | ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg) |
91 | MODULES += Flugg |
92 | endif |
b9d0a01d |
93 | |
94 | ################################################################## |
95 | |
96 | MODULES += ALIROOT |
97 | |
98 | MODDIRS := $(MODULES) |
99 | |
100 | ############################################################# |
101 | # |
102 | # Default include dirs for |
103 | # C++, Fortran, Cint, and dependencies |
104 | # The module directory will be added by each module |
105 | # |
106 | |
107 | CXXFLAGS += -I$(ALICE_ROOT)/include |
108 | CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include) |
109 | |
110 | CINTFLAGS += -I$(ALICE_ROOT)/include |
111 | CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include) |
112 | |
113 | DEPINC += -I$(ALICE_ROOT)/include |
114 | DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include) |
115 | ############################################################# |
116 | |
117 | |
118 | ############################################################# |
119 | # |
120 | # Libraries to link binaries against |
121 | # Libraries will be linked againstSHLIB |
122 | LIBS := $(GLIBS) $(ROOTLIBS) $(SYSLIBS) |
123 | ############################################################# |
124 | |
125 | |
126 | # default target |
127 | default: alilibs aliroot |
128 | |
129 | |
130 | ############################################################# |
131 | # |
132 | # Each module will add to this |
133 | |
134 | ALLLIBS := |
135 | ALLEXECS := |
136 | INCLUDEFILES := |
137 | BINLIBS := |
138 | EXPORTFILES := |
139 | ############################################################# |
140 | |
141 | BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH) |
142 | |
143 | |
144 | #Dependencies of module.mk files |
145 | |
146 | include build/module.dep |
147 | |
148 | ############################################################# |
149 | # |
150 | # Check if module.mk is present for the library |
151 | %.mk: build/module.tpl |
152 | ifndef ALIQUIET |
153 | @echo "***** Creating $@ file *****"; |
154 | endif |
155 | @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@; |
156 | ############################################################# |
157 | |
158 | # ************************************************************************** |
159 | # |
160 | # If cleaning, do not include |
161 | # dependencies or module.mk files. |
162 | |
163 | ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),) |
164 | |
165 | # If making modules, not not include |
166 | # anything |
167 | |
168 | ifneq ($(findstring modules,$(MAKECMDGOALS)),modules) |
169 | |
170 | ############################################################# |
171 | # |
172 | # Include the modules |
173 | -include $(patsubst %,%/module.mk,$(MODULES)) |
174 | |
175 | # |
176 | # |
177 | ############################################################# |
178 | |
179 | ############################################################# |
180 | # |
181 | # include dependencies if not making them! |
182 | ifneq ($(MAKECMDGOALS),depend ) |
183 | # Don't include if cleaning of any sort |
184 | ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) |
2830f9fb |
185 | #$(warning INCLUDEFILES=$(INCLUDEFILES)) |
b9d0a01d |
186 | include $(INCLUDEFILES) |
187 | endif |
188 | endif |
189 | ############################################################# |
190 | |
191 | endif |
192 | endif |
193 | # ************************************************************************** |
194 | |
195 | ############################################################# |
196 | # |
197 | # include dummy dependency file |
198 | # *MUST* be last includefile |
199 | include build/dummy.d |
200 | ############################################################# |
201 | |
202 | |
203 | # targets |
204 | |
2d8cad5a |
205 | .PHONY: alilibs aliroot makedistr clean htmldoc profile |
b9d0a01d |
206 | |
207 | modules: $(patsubst %,%/module.mk,$(MODULES)) |
41f6cf69 |
208 | |
3e27ea2b |
209 | |
b9d0a01d |
210 | aliroot: $(BINPATH) $(ALLEXECS) alilibs bin |
3e27ea2b |
211 | |
2d8cad5a |
212 | ifeq ($(ALIPROFILE),YES) |
213 | alilibs: $(LIBPATH) $(ALLLIBS) $(ALLALIBS) lib modules |
214 | else |
b9d0a01d |
215 | alilibs: $(LIBPATH) $(ALLLIBS) lib modules |
2d8cad5a |
216 | endif |
41f6cf69 |
217 | |
b9d0a01d |
218 | # Single Makefile "distribution": Makefile + modules + mkdepend scripts |
219 | makedistr: $(MODULES) |
220 | tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \ |
221 | Makefile create build/* |
41f6cf69 |
222 | |
b9d0a01d |
223 | all: aliroot |
41f6cf69 |
224 | |
225 | |
b9d0a01d |
226 | depend: $(INCLUDEFILES) |
41f6cf69 |
227 | |
b9d0a01d |
228 | debug: |
229 | ifndef ALIQUIET |
230 | @echo "***** Entering DEBUG mode. *****" |
231 | endif |
232 | @(export ALIDEBUG=YES && $(MAKE)) |
2d8cad5a |
233 | profile: |
234 | ifndef ALIQUIET |
235 | @echo "***** Entering PROFILE mode. *****" |
236 | endif |
237 | @(export ALIPROFILE=YES && $(MAKE)) |
b9d0a01d |
238 | lib: |
239 | @mkdir lib |
240 | @mkdir lib/tgt_$(ALICE_TARGET) |
241 | |
242 | bin: |
243 | @mkdir bin |
244 | @mkdir bin/tgt_$(ALICE_TARGET) |
245 | |
246 | $(MODULES): |
247 | ifndef ALIQUIET |
248 | @echo "***** Making $@ *****" |
249 | endif |
250 | @mkdir -p $@ |
251 | |
252 | $(BINPATH): |
253 | ifndef ALIQUIET |
254 | @echo "***** Making $@ *****" |
255 | endif |
256 | @mkdir -p $@ |
257 | |
258 | $(LIBPATH): |
259 | ifndef ALIQUIET |
260 | @echo "***** Making $@ *****" |
261 | endif |
262 | @mkdir -p $@ |
263 | |
264 | build/dummy.d: $(EXPORTFILES) |
265 | @(if [ ! -f $@ ] ; then \ |
266 | touch $@; \ |
267 | fi) |
268 | |
269 | clean: |
270 | @echo "***** No targen clean, use one of these *****" |
271 | @echo " clean-aliroot : Clean up all aliroot libraries" |
272 | @echo " clean-MODULENAME : Clean everything from module MODULENAME" |
273 | @echo " clean-all : Cleans up everything, including cern libraires" |
274 | @echo " clean-modules : Clean all module.mk file in all modules" |
275 | @echo " clean-libs : Clean all libraries (not object files)" |
276 | @echo "********************************************" |
277 | |
278 | clean-all: clean-modules clean-libs clean-bins |
279 | ifndef ALIQUIET |
280 | @echo "***** Cleaning up everything ****" |
281 | endif |
282 | $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES)) |
283 | $(MUTE)rm -rf $(EXPORTDIR) |
284 | |
285 | #This cleans only libraries that are not CERN-libraries |
286 | |
287 | clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES)) |
288 | |
2900fa57 |
289 | CHECKMODULES := $(ALIROOTMODULES) |
290 | CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES)) |
291 | CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES)) |
292 | CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES)) |
b9d0a01d |
293 | |
294 | check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES)) |
295 | |
296 | reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES)) |
297 | |
298 | revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES)) |
299 | |
300 | clean-dicts: |
301 | ifndef ALIQUIET |
302 | @echo "***** Cleaning up G__ files *****" |
303 | endif |
304 | $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__* |
41f6cf69 |
305 | |
b9d0a01d |
306 | clean-modules: |
307 | ifndef ALIQUIET |
308 | @echo "***** Cleaning up module.mk files *****" |
309 | endif |
310 | $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES)) |
41f6cf69 |
311 | |
b9d0a01d |
312 | clean-depend: |
313 | ifndef ALIQUIET |
314 | @echo "***** Cleaning up dependencies *****" |
315 | endif |
316 | $(MUTE)echo rm `find . -name "*.d"` |
317 | |
318 | clean-objects: |
319 | ifndef ALIQUIET |
320 | @echo "***** Cleaning up .o files *****" |
321 | endif |
322 | $(MUTE)echo rm `find . -name "*.o"` |
323 | |
324 | clean-libs: |
325 | ifndef ALIQUIET |
326 | @echo "***** Cleaning up library files *****" |
327 | endif |
328 | $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/* |
329 | |
330 | clean-bins: |
331 | ifndef ALIQUIET |
332 | @echo "***** Cleaning up binary files *****" |
333 | endif |
334 | $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET) |
d7a221d0 |
335 | |
ba546cfd |
336 | clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES)) |
337 | |
338 | clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES)) |
339 | |
d7a221d0 |
340 | htmldoc: |
341 | @rm -rf html/roothtml |
342 | @rm -f html/picts |
343 | @rm -f /tmp/macros |
344 | @cd html ;\ |
345 | aliroot -q -b "mkhtml.C(0,1)" ;\ |
346 | ls ../macros/*.C > /tmp/macros ;\ |
347 | for i in $(ALIROOTMODULES) ; do \ |
348 | ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\ |
349 | done ;\ |
350 | for i in `cat /tmp/macros` ; do \ |
351 | echo $$i ; \ |
352 | aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\ |
353 | done ;\ |
354 | ./makeExampleList ; |
355 | @ln -s ../picts html/picts |
356 | @ln -s ../../picts html/roothtml/picts |
357 | @ln -s ../../../picts html/roothtml/src/picts |
358 | @ln -s ../../../picts html/roothtml/examples/picts |