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