QA ref defaut storage setter in sim and rec
[u/mrichter/AliRoot.git] / Makefile
... / ...
CommitLineData
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# /* $Id$ */
7
8ifdef ALIVERBOSE
9MUTE:=
10else
11MUTE:=@
12endif
13
14CLEAN=$(findstring clean,$(MAKECMDGOALS))
15
16#-------------------------------------------------------------------------------
17# IRST coding rule check
18
19IRST_INSTALLDIR=$(ALICE)/local/IRST
20IRST_CONFIG_DIR=$(IRST_INSTALLDIR)/userConfig/ALICE
21CLASSPATH=$(IRST_INSTALLDIR)
22export CLASSPATH IRST_INSTALLDIR IRST_CONFIG_DIR
23CODE_CHECK=java rules.ALICE.ALICERuleChecker
24REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh
25
26SMELL_DETECTOR_DIR=$(IRST_INSTALLDIR)/smell-detector
27
28
29#-------------------------------------------------------------------------------
30# Include machine dependent macros
31
32-include build/Makefile.$(ALICE_TARGET)
33
34#-------------------------------------------------------------------------------
35# Check if called with debug
36
37ifeq ($(ALIDEBUG),YES)
38override ALICE_TARGET := $(ALICE_TARGET)DEBUG
39FFLAGS := -g $(filter-out -O%,$(FFLAGS))
40CXXFLAGS := -g $(filter-out -O%,$(CXXFLAGS))
41CFLAGS := -g $(filter-out -O%,$(CFLAGS))
42SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
43LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
44endif
45
46#-------------------------------------------------------------------------------
47# Check if called with profile
48
49ifeq ($(ALIPROFILE),YES)
50override ALICE_TARGET := $(ALICE_TARGET)PROF
51FFLAGS += -pg
52CXXFLAGS += -pg
53CFLAGS += -pg
54SOFLAGS += -pg
55LDFLAGS += -pg
56endif
57
58#-------------------------------------------------------------------------------
59# Check if DATE is installed
60
61ifneq ($(shell date-config 2>&1 | grep -i usage),)
62DATEFLAGS = -DALI_DATE $(shell date-config --cflags | tr \" \')
63CXXFLAGS += $(DATEFLAGS)
64CFLAGS += $(DATEFLAGS)
65CINTFLAGS += $(DATEFLAGS)
66DEPINC += $(DATEFLAGS)
67else
68DATEFLAGS = -D`uname` -DDATE_SYS=`uname` -Dlong32='int' \
69 -Dlong64='long long' -DdatePointer='long'
70CXXFLAGS += $(DATEFLAGS)
71CFLAGS += $(DATEFLAGS)
72CINTFLAGS += $(DATEFLAGS)
73DEPINC += $(DATEFLAGS)
74endif
75
76
77#-------------------------------------------------------------------------------
78# ROOT Stuff
79ROOTCONFIG := root-config
80ROOTLIBDIR := $(shell $(ROOTCONFIG) --libdir)
81ROOTPLUGDIR := $(ROOTLIBDIR)/$(dir $(shell $(ROOTCONFIG) --version))
82ROOTINCDIR := $(shell $(ROOTCONFIG) --incdir)
83ROOTCLIBS := $(shell $(ROOTCONFIG) --glibs) \
84 -lThread \
85 -lMinuit \
86 -lVMC \
87 -lEG \
88 -lGeom \
89 -lTreePlayer \
90 -lXMLIO \
91 -lXMLParser \
92 -lProof \
93 -lProofPlayer \
94 -lMLP \
95 -lSpectrum \
96 -L$(ROOTPLUGDIR)
97
98#-------------------------------------------------------------------------------
99# Location where to install libraries and binaries and common header files
100
101LIBPATH := lib/tgt_$(ALICE_TARGET)
102BINPATH := bin/tgt_$(ALICE_TARGET)
103EXPORTDIR := $(ALICE_ROOT)/include
104BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
105
106#-------------------------------------------------------------------------------
107# Modules to build
108
109ifeq (ALIVERBOSE,2)
110$(warning MAKECMDGOALS=$(MAKECMDGOALS))
111endif
112
113ALIROOTMODULES := STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
114 ACORDE HMPID T0 BCM STRUCT EVGEN RALICE VZERO \
115 THijing THbtp EMCAL \
116 THerwig TEPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS \
117 JETAN HLT LHC ESDCheck STAT TTherminator CORRFW DPMJET TDPMjet \
118 PWG0 PWG1 PWG2 PWG3 PWG4
119
120ifneq ($(shell $(ROOTCONFIG) --has-pythia8), no)
121ALIROOTMODULES += PYTHIA8
122endif
123
124ifneq ($(shell $(ROOTCONFIG) --has-opengl), no)
125ALIROOTMODULES += EVE
126endif
127
128ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
129ALIROOTMODULES += TFluka
130endif
131
132ifeq ($(findstring THydjet,$(MAKECMDGOALS)),THydjet)
133ALIROOTMODULES += THydjet
134endif
135
136ifeq ($(findstring SHUTTLE,$(MAKECMDGOALS)),SHUTTLE)
137ALIROOTMODULES += SHUTTLE
138endif
139
140ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
141ALIROOTMODULES += Flugg
142endif
143
144CERNMODULES := LHAPDF HIJING MICROCERN HERWIG
145ifneq ($(wildcard $(ROOTINCDIR)/TPythia6.h),)
146CERNMODULES += PYTHIA6
147endif
148
149MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
150
151MODDIRS := $(MODULES)
152
153#-------------------------------------------------------------------------------
154# Default include dirs for C++, Fortran, Cint, and dependencies
155# The module directory will be added by each module
156
157GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
158CXXFLAGS += $(GENINC)
159CXXFLAGSNO += $(GENINC)
160CINTFLAGS += $(GENINC)
161DEPINC += $(GENINC)
162
163#-------------------------------------------------------------------------------
164# Libraries to link binaries against
165# Libraries will be linked against SHLIB
166# ROOT libraries
167
168ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \
169 -lITS -lPHOS -lACORDE -lHMPID -lVZERO -lZDC -lSTRUCT \
170 -lT0 -lEVGEN -lSTEER
171
172LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS)
173
174ARVERSIONFILE := $(EXPORTDIR)/ARVersion.h
175SVNREV := $(strip $(shell svn info | grep "Last Changed Rev:" | \
176 cut -d: -f2 ))
177SVNBRANCH := w$(subst //alisoft.cern.ch/AliRoot/,,\
178 $(shell svn info | grep "URL:" | cut -d: -f3 ))
179
180#-------------------------------------------------------------------------------
181# default target
182
183default: $(ARVERSIONFILE)
184 $(MUTE)$(MAKE) aliroot
185
186FORCE:
187
188#-------------------------------------------------------------------------------
189# Write header file with aliroot svn version and url
190
191$(ARVERSIONFILE): FORCE $(EXPORTDIR)
192 $(MUTE)rm -f $(ARVERSIONFILE)
193 @echo "***** Making $(ARVERSIONFILE) *****"
194 @echo "#ifndef ALIROOT_ARVersion" >> $@
195 @echo "#define ALIROOT_ARVersion" >> $@
196 @echo "#define ALIROOT_SVN_REVISION $(SVNREV)" >> $@
197 @echo "#define ALIROOT_SVN_BRANCH \"$(SVNBRANCH)\"" >> $@
198 @echo "#endif" >> $@
199#-------------------------------------------------------------------------------
200# Each module will add to these macros
201
202ALLLIBS :=
203ALLEXECS :=
204INCLUDEFILES :=
205BINLIBS :=
206EXPORTFILES :=
207
208#-------------------------------------------------------------------------------
209# Dependencies of module.mk files if not cleaning
210
211ifeq ($(CLEAN),)
212include build/module.dep
213endif
214
215#-------------------------------------------------------------------------------
216# Check if module.mk is present for the library
217
218%.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
219ifndef ALIQUIET
220 @echo "***** Creating $@ file *****";
221endif
222 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
223
224#-------------------------------------------------------------------------------
225# If making modules, not not include anything
226
227ifeq ($(findstring modules,$(MAKECMDGOALS)),)
228
229#-------------------------------------------------------------------------------
230# Include the modules
231
232-include $(patsubst %,%/module.mk,$(MODULES))
233
234#-------------------------------------------------------------------------------
235# If cleaning, do not include dependencies or module.mk files.
236
237ifeq ($(CLEAN),)
238
239#-------------------------------------------------------------------------------
240# Include dependencies if not making them!
241
242ifneq ($(MAKECMDGOALS),depend)
243ifneq ($(MAKECMDGOALS),)
244
245ifeq (ALIVERBOSE,2)
246$(warning INCLUDEFILES=$(INCLUDEFILES))
247endif
248-include $(INCLUDEFILES)
249
250endif
251endif
252endif
253endif
254
255#-------------------------------------------------------------------------------
256# Include dummy dependency file *MUST* be last includefile
257
258include build/dummy.d
259
260
261#-------------------------------------------------------------------------------
262# Targets
263
264.PHONY: alilibs aliroot makedistr clean distclean clean-all \
265 htmldoc profile modules depend
266
267modules: $(patsubst %,%/module.mk,$(MODULES))
268
269ifeq ($(ALIPROFILE),YES)
270alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
271else
272alilibs: $(LIBPATH) modules $(ALLLIBS)
273endif
274
275aliroot: alilibs $(BINPATH) $(ALLEXECS)
276
277ALIRECO.par: macros/loadlibsrec.C STEER/PROOF-INF.ALIRECO/SETUP.C
278 $(MUTE)echo "***** Creating package archive" $@ "*****"
279 $(MUTE)rm -rf ALIRECO
280 $(MUTE)mkdir -p ALIRECO/PROOF-INF
281 $(MUTE)cat $^ > ALIRECO/PROOF-INF/SETUP.C
282 (tar cfzh $@ ALIRECO 2> /dev/null && echo "Package archive" $@ "created in" $(PWD)/$@) || (tar cfzh /tmp/$@ ALIRECO 2> /dev/null && echo "Package archive" $@ "created in /tmp/"$@)
283 $(MUTE)rm -rf ALIRECO
284
285ROOTALIBDIR=$(shell root-config --libdir)
286
287ALIMDCSPECFILE=$(RAWDIRO)/alimdc.spec
288ALIMDCVERSION=$(subst -,.,$(notdir $(subst /RAW/mdc.h,,$(shell svn info RAW/mdc.h | grep "URL:" | cut -d: -f3 ))))
289ALIMDCRELEASE=$(firstword $(shell svn info RAW/mdc.h | grep "Revision:" | cut -d: -f2 ))
290
291alimdc-rpm: alimdc-static alimdc-specfile
292 $(MUTE)rm -rf alimdc-root
293 $(MUTE)mkdir -p alimdc-root/opt/alimdc/lib
294 $(MUTE)mkdir -p alimdc-root/opt/alimdc/include
295 $(MUTE)cp RAW/mdc.h alimdc-root/opt/alimdc/include
296 $(MUTE)cp $(LIBPATH)/libAliMDC.a \
297 $(ROOTALIBDIR)/libRoot.a \
298 $(ROOTALIBDIR)/libfreetype.a $(ROOTALIBDIR)/libpcre.a \
299 alimdc-root/opt/alimdc/lib
300 $(MUTE)rm -rf RPMS
301 $(MUTE)case `uname -m` in \
302 i?86*) ALIMDCARCHDIR=i386;;\
303 ia64*) ALIMDCARCHDIR=ia64;;\
304 x86_64*) ALIMDCARCHDIR=x86_64;;\
305 *) echo "Unknown architecture: `uname -m`"; exit 1;;\
306 esac; \
307 mkdir -p RPMS/$$ALIMDCARCHDIR; \
308 rpmbuild --verbose --define "_topdir $(ALICE_ROOT)" --define "_tmppath $(ALICE_ROOT)" -bb $(ALIMDCSPECFILE); \
309 cp -p RPMS/$$ALIMDCARCHDIR/alimdc-*.rpm .;
310 $(MUTE)rm -rf alimdc-root
311 $(MUTE)rm -rf RPMS
312 @echo "***** alimdc RPM created and put $(ALICE_ROOT) folder *****"
313
314alimdc-specfile: $(RAWDIRO)
315 $(MUTE)rm -rf $(ALIMDCSPECFILE)
316 @echo "***** Making alimdc RPM spec-file $(ALIMDCSPECFILE) *****"
317 @echo "# RPM specfile for alimdc static libs" >> $(ALIMDCSPECFILE)
318 @echo "# Package contains both ROOT and AliRoot" >> $(ALIMDCSPECFILE)
319 @echo "# static libs needed by mStreamRecorder" >> $(ALIMDCSPECFILE)
320 @echo "# in order to ROOT-ify the incoming raw" >> $(ALIMDCSPECFILE)
321 @echo "# data" >> $(ALIMDCSPECFILE)
322 @echo "# Example how-to build alimdc RPM:" >> $(ALIMDCSPECFILE)
323 @echo "# cd $ALICE_ROOT" >> $(ALIMDCSPECFILE)
324 @echo "# make alimdc-rpm" >> $(ALIMDCSPECFILE)
325 @echo "" >> $(ALIMDCSPECFILE)
326 @echo "Summary: AliMDC static libraries" >> $(ALIMDCSPECFILE)
327 @echo "Name: alimdc" >> $(ALIMDCSPECFILE)
328 @echo "Version: $(ALIMDCVERSION)" >> $(ALIMDCSPECFILE)
329 @echo "Release: $(ALIMDCRELEASE)" >> $(ALIMDCSPECFILE)
330 @echo "# Copyright: CERN Alice Off-line" >> $(ALIMDCSPECFILE)
331 @echo "License: CERN Alice Off-line" >> $(ALIMDCSPECFILE)
332 @echo "Vendor: ALICE Core Off-line Group" >> $(ALIMDCSPECFILE)
333 @echo "URL: http://aliceinfo.cern.ch" >> $(ALIMDCSPECFILE)
334 @echo "Group: Applications/Alice" >> $(ALIMDCSPECFILE)
335 @echo "Prefix: /opt/%{name}" >> $(ALIMDCSPECFILE)
336 @echo "BuildRoot: %{_tmppath}/%{name}-root" >> $(ALIMDCSPECFILE)
337 @echo "" >> $(ALIMDCSPECFILE)
338 @echo "# automatic dependencies" >> $(ALIMDCSPECFILE)
339 @echo "AutoReqProv: yes" >> $(ALIMDCSPECFILE)
340 @echo "" >> $(ALIMDCSPECFILE)
341 @echo "# list here required RPM packages for runtime" >> $(ALIMDCSPECFILE)
342 @echo "Requires: glibc" >> $(ALIMDCSPECFILE)
343 @echo "" >> $(ALIMDCSPECFILE)
344 @echo "Provides: alimdc" >> $(ALIMDCSPECFILE)
345 @echo "" >> $(ALIMDCSPECFILE)
346 @echo "# description of the package" >> $(ALIMDCSPECFILE)
347 @echo "%description" >> $(ALIMDCSPECFILE)
348 @echo "Package contains both ROOT and AliRoot" >> $(ALIMDCSPECFILE)
349 @echo "static libs needed by mStreamRecorder" >> $(ALIMDCSPECFILE)
350 @echo "in order to ROOT-ify the incoming raw" >> $(ALIMDCSPECFILE)
351 @echo "data. The package version correspond to" >> $(ALIMDCSPECFILE)
352 @echo "the AliRoot one." >> $(ALIMDCSPECFILE)
353 @echo "" >> $(ALIMDCSPECFILE)
354 @echo "# list of files to be installed" >> $(ALIMDCSPECFILE)
355 @echo "%files" >> $(ALIMDCSPECFILE)
356 @echo "%defattr (-,root,root)" >> $(ALIMDCSPECFILE)
357 @echo "%{prefix}/lib/libAliMDC.a" >> $(ALIMDCSPECFILE)
358 @echo "%{prefix}/lib/libRoot.a" >> $(ALIMDCSPECFILE)
359 @echo "%{prefix}/lib/libpcre.a" >> $(ALIMDCSPECFILE)
360 @echo "%{prefix}/lib/libfreetype.a" >> $(ALIMDCSPECFILE)
361 @echo "%{prefix}/include/mdc.h" >> $(ALIMDCSPECFILE)
362
363alimdc-static: $(LIBPATH) $(BINPATH) $(RAWDatabaseALIB) $(MDCALIB) $(ESDALIB) $(STEERBaseALIB) $(alimdcCXXO)
364 $(MUTE)rm -rf $(LIBPATH)/libAliMDC.a
365 $(MUTE)rm -rf junk
366 mkdir junk && cd junk && ar x ../$(RAWDatabaseALIB) && ar x ../$(MDCALIB) && ar x ../$(ESDALIB) && ar x ../$(STEERBaseALIB) && ar r ../$(LIBPATH)/libAliMDC.a *.o && cd .. && rm -rf junk
367 $(LD) $(LDFLAGS) -o $(BINPATH)/alimdca $(alimdcCXXO) \
368 $(LIBPATH)/libAliMDC.a \
369 $(ROOTALIBDIR)/libRoot.a \
370 $(ROOTALIBDIR)/libfreetype.a $(ROOTALIBDIR)/libpcre.a \
371 -pthread -ldl
372
373alilibs-static: $(LIBPATH) modules $(ALLALIBS)
374
375include build/MakefileDA
376
377#-------------------------------------------------------------------------------
378# Single Makefile "distribution": Makefile + modules + mkdepend scripts
379makedistr: $(MODULES)
380 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
381 Makefile create build/*
382
383all: aliroot
384
385depend: $(INCLUDEFILES)
386
387debug:
388ifndef ALIQUIET
389 @echo "***** Entering DEBUG mode. *****"
390endif
391 @(export ALIDEBUG=YES && $(MAKE) aliroot)
392
393profile:
394ifndef ALIQUIET
395 @echo "***** Entering PROFILE mode. *****"
396endif
397 @(export ALIPROFILE=YES && $(MAKE) aliroot)
398
399$(MODULES):
400ifndef ALIQUIET
401 @echo "***** Making $@ *****"
402endif
403 @mkdir -p $@
404
405$(BINPATH):
406ifndef ALIQUIET
407 @echo "***** Making $@ *****"
408endif
409 @mkdir -p $@
410
411$(LIBPATH):
412ifndef ALIQUIET
413 @echo "***** Making $@ *****"
414endif
415 @mkdir -p $@
416
417build/dummy.d: $(EXPORTFILES)
418 @(if [ ! -f $@ ] ; then \
419 touch $@; \
420 fi)
421
422clean:
423 @echo "***** No target clean, use one of these *****"
424 @echo " clean-aliroot : Clean up all aliroot libraries"
425 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
426 @echo " clean-all : Cleans up everything, including cern libraires"
427 @echo " distclean : Like clean-all + clean all tgt_*'s"
428 @echo " clean-modules : Clean all module.mk files in all modules"
429 @echo " clean-libs : Clean all libraries (not object files)"
430 @echo "********************************************"
431
432clean-all: clean-modules clean-libs clean-bins
433ifndef ALIQUIET
434 @echo "***** Cleaning up everything ****"
435endif
436 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
437 $(MUTE)rm -rf $(EXPORTDIR)
438
439distclean: clean-all
440 $(MUTE)rm -rf */tgt_* bin lib
441
442#-------------------------------------------------------------------------------
443# This cleans only libraries that are not CERN-libraries
444
445clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
446
447CHECKMODULES := $(MODULES)
448CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
449CHECKMODULES := $(filter-out LHAPDF,$(CHECKMODULES))
450CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
451
452check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
453
454smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
455
456reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
457
458revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
459
460smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
461
462clean-dicts:
463ifndef ALIQUIET
464 @echo "***** Cleaning up G__ files *****"
465endif
466 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
467
468clean-modules:
469ifndef ALIQUIET
470 @echo "***** Cleaning up module.mk and temporary compilation files *****"
471endif
472 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
473 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
474
475clean-depend:
476ifndef ALIQUIET
477 @echo "***** Cleaning up dependencies *****"
478endif
479 $(MUTE)echo rm `find . -name "*.d"`
480
481clean-objects:
482ifndef ALIQUIET
483 @echo "***** Cleaning up .o files *****"
484endif
485 $(MUTE)echo rm `find . -name "*.o"`
486
487clean-libs:
488ifndef ALIQUIET
489 @echo "***** Cleaning up library files *****"
490endif
491 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
492
493clean-bins:
494ifndef ALIQUIET
495 @echo "***** Cleaning up binary files *****"
496endif
497 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
498
499clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
500
501clean-smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-smell-%,$(CHECKMODULES))
502
503clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
504
505htmldoc:
506 @rm -rf html/roothtml
507 @rm -f html/picts
508 @rm -f /tmp/macros
509 @cd html ;\
510 aliroot -q -b "mkhtml.C(0,1)" ;\
511 ls ../macros/*.C > /tmp/macros ;\
512 for i in $(ALIROOTMODULES) ; do \
513 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
514 done ;\
515 for i in `cat /tmp/macros` ; do \
516 echo $$i ; \
517 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
518 done ;\
519 ./makeExampleList ;
520 @ln -s ../picts html/picts
521 @ln -s ../../picts html/roothtml/picts
522 @ln -s ../../../picts html/roothtml/src/picts
523 @ln -s ../../../picts html/roothtml/examples/picts