Move contents of EVE/Alieve to EVE/EveDet as most code will remain there.
[u/mrichter/AliRoot.git] / Makefile
CommitLineData
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
462ee303 6# /* $Id$ */
fe4da5cc 7
b9d0a01d 8ifdef ALIVERBOSE
9MUTE:=
10else
11MUTE:=@
12endif
fe4da5cc 13
8d7652bd 14CLEAN=$(findstring clean,$(MAKECMDGOALS))
bdfb9593 15
462ee303 16#-------------------------------------------------------------------------------
b9d0a01d 17# IRST coding rule check
462ee303 18
b9d0a01d 19IRST_INSTALLDIR=$(ALICE)/local/IRST
50a3b0ee 20IRST_CONFIG_DIR=$(IRST_INSTALLDIR)/userConfig/ALICE
b9d0a01d 21CLASSPATH=$(IRST_INSTALLDIR)
50a3b0ee 22export CLASSPATH IRST_INSTALLDIR IRST_CONFIG_DIR
b9d0a01d 23CODE_CHECK=java rules.ALICE.ALICERuleChecker
24REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh
fe4da5cc 25
67f2eee7 26SMELL_DETECTOR_DIR=$(IRST_INSTALLDIR)/smell-detector
118c0ae6 27
28
462ee303 29#-------------------------------------------------------------------------------
462ee303 30# Include machine dependent macros
fe4da5cc 31
b9d0a01d 32-include build/Makefile.$(ALICE_TARGET)
fe4da5cc 33
462ee303 34#-------------------------------------------------------------------------------
35# Check if called with debug
42865053 36
b9d0a01d 37ifeq ($(ALIDEBUG),YES)
b934f194 38override ALICE_TARGET := $(ALICE_TARGET)DEBUG
39FFLAGS := -g $(filter-out -O%,$(FFLAGS))
4448d4ac 40CXXFLAGS := -g $(filter-out -O%,$(CXXFLAGS))
41CFLAGS := -g $(filter-out -O%,$(CFLAGS))
b934f194 42SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
43LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
b9d0a01d 44endif
fe4da5cc 45
462ee303 46#-------------------------------------------------------------------------------
47# Check if called with profile
2d8cad5a 48
49ifeq ($(ALIPROFILE),YES)
b934f194 50override ALICE_TARGET := $(ALICE_TARGET)PROF
51FFLAGS += -pg
2d8cad5a 52CXXFLAGS += -pg
b934f194 53CFLAGS += -pg
54SOFLAGS += -pg
55LDFLAGS += -pg
2d8cad5a 56endif
2d8cad5a 57
462ee303 58#-------------------------------------------------------------------------------
59# Check if DATE is installed
b8f3fa00 60
61ifdef DATE_ROOT
462ee303 62DATEFLAGS = -DALI_DATE -D${DATE_SYS} -DDATE_SYS=${DATE_SYS} -Dlong32=${DATE_LONG32} \
5fdadcc5 63 -Dlong64='${DATE_LONG64}' -DdatePointer=${DATE_POINTER} -I${DATE_COMMON_DEFS} -I${DATE_MONITOR_DIR}
b934f194 64CXXFLAGS += $(DATEFLAGS)
65CFLAGS += $(DATEFLAGS)
b8f3fa00 66CINTFLAGS += $(DATEFLAGS)
e506ace2 67DEPINC += $(DATEFLAGS)
68else
8c50acf2 69DATEFLAGS = -D`uname` -DDATE_SYS=`uname` -Dlong32='int' \
e506ace2 70 -Dlong64='long long' -DdatePointer='long'
71CXXFLAGS += $(DATEFLAGS)
72CFLAGS += $(DATEFLAGS)
73CINTFLAGS += $(DATEFLAGS)
b934f194 74DEPINC += $(DATEFLAGS)
0a1aa611 75endif
0a1aa611 76
462ee303 77#-------------------------------------------------------------------------------
e44bc3df 78# Location where to install libraries and binaries and common header files
79
80LIBPATH := lib/tgt_$(ALICE_TARGET)
81BINPATH := bin/tgt_$(ALICE_TARGET)
82EXPORTDIR := $(ALICE_ROOT)/include
83BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
84
85#-------------------------------------------------------------------------------
462ee303 86# Modules to build
fe4da5cc 87
e3642d02 88ifeq (ALIVERBOSE,2)
462ee303 89$(warning MAKECMDGOALS=$(MAKECMDGOALS))
90endif
fe4da5cc 91
b934f194 92ALIROOTMODULES := STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
0850b27f 93 ACORDE HMPID T0 BCM STRUCT EVGEN RALICE VZERO \
e756ece8 94 THijing MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
92b443ef 95 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS \
18e252bc 96 JETAN HLT LHC ESDCheck STAT TTherminator CORRFW
8db084d0 97
98ifneq ($(wildcard $(ROOTSYS)/include/TGLIncludes.h),)
3b85abd6 99ALIROOTMODULES += EVE
8db084d0 100endif
41f6cf69 101
b9d0a01d 102ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
462ee303 103ALIROOTMODULES += TFluka
b9d0a01d 104endif
105
c376a06a 106ifeq ($(findstring THydjet,$(MAKECMDGOALS)),THydjet)
107ALIROOTMODULES += THydjet
108endif
109
18d2e4ee 110ifeq ($(findstring PWG0,$(MAKECMDGOALS)),PWG0)
111ALIROOTMODULES += PWG0
112endif
113
940de486 114ifeq ($(findstring PWG1,$(MAKECMDGOALS)),PWG1)
115ALIROOTMODULES += PWG1
116endif
117
04d2c4d5 118ifeq ($(findstring PWG2,$(MAKECMDGOALS)),PWG2)
119ALIROOTMODULES += PWG2
120endif
121
f3fc258a 122ifeq ($(findstring PWG3,$(MAKECMDGOALS)),PWG3)
123ALIROOTMODULES += PWG3
124endif
125
739baceb 126ifeq ($(findstring PWG4,$(MAKECMDGOALS)),PWG4)
127ALIROOTMODULES += PWG4
128endif
129
18d2e4ee 130ifeq ($(findstring SHUTTLE,$(MAKECMDGOALS)),SHUTTLE)
131ALIROOTMODULES += SHUTTLE
132endif
133
2830f9fb 134ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
462ee303 135ALIROOTMODULES += Flugg
2830f9fb 136endif
b9d0a01d 137
8db084d0 138CERNMODULES := LHAPDF HIJING MICROCERN HERWIG
139
140ifneq ($(wildcard $(ROOTSYS)/include/TPythia6.h),)
141CERNMODULES += PYTHIA6
142endif
b9d0a01d 143
462ee303 144MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
b9d0a01d 145
146MODDIRS := $(MODULES)
147
462ee303 148#-------------------------------------------------------------------------------
149# Default include dirs for C++, Fortran, Cint, and dependencies
150# The module directory will be added by each module
b9d0a01d 151
19ca05d1 152GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
19ca05d1 153CXXFLAGS += $(GENINC)
154CXXFLAGSNO += $(GENINC)
155CINTFLAGS += $(GENINC)
156DEPINC += $(GENINC)
b9d0a01d 157
462ee303 158#-------------------------------------------------------------------------------
159# Libraries to link binaries against
160# Libraries will be linked against SHLIB
de6c7cfd 161# ROOT libraries
162
683e665e 163ROOTCLIBS := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof -lProofPlayer -lMLP \
164 -lSpectrum
b9d0a01d 165
3df2764f 166ROOTPLIBS := -lEGPythia6
de6c7cfd 167
168ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \
b384f8a4 169 -lITS -lPHOS -lACORDE -lHMPID -lVZERO -lZDC -lSTRUCT \
0850b27f 170 -lT0 -lEVGEN -lSTEER
de6c7cfd 171
172LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS)
b9d0a01d 173
462ee303 174#-------------------------------------------------------------------------------
b9d0a01d 175# default target
462ee303 176
4dc83bdb 177default:
0693bbb3 178 $(MUTE)$(MAKE) aliroot
b9d0a01d 179
de6c7cfd 180FORCE:
181
462ee303 182#-------------------------------------------------------------------------------
183# Each module will add to these macros
b9d0a01d 184
185ALLLIBS :=
186ALLEXECS :=
187INCLUDEFILES :=
b934f194 188BINLIBS :=
189EXPORTFILES :=
b9d0a01d 190
462ee303 191#-------------------------------------------------------------------------------
8d7652bd 192# Dependencies of module.mk files if not cleaning
b9d0a01d 193
8ef0bd93 194ifeq ($(CLEAN),)
b9d0a01d 195include build/module.dep
8d7652bd 196endif
b9d0a01d 197
462ee303 198#-------------------------------------------------------------------------------
199# Check if module.mk is present for the library
200
5386b933 201%.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
b9d0a01d 202ifndef ALIQUIET
203 @echo "***** Creating $@ file *****";
204endif
205 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
b9d0a01d 206
462ee303 207#-------------------------------------------------------------------------------
462ee303 208# If making modules, not not include anything
b9d0a01d 209
bdfb9593 210ifeq ($(findstring modules,$(MAKECMDGOALS)),)
b9d0a01d 211
462ee303 212#-------------------------------------------------------------------------------
213# Include the modules
214
b934f194 215-include $(patsubst %,%/module.mk,$(MODULES))
b9d0a01d 216
462ee303 217#-------------------------------------------------------------------------------
bdfb9593 218# If cleaning, do not include dependencies or module.mk files.
219
220ifeq ($(CLEAN),)
221
222#-------------------------------------------------------------------------------
462ee303 223# Include dependencies if not making them!
b9d0a01d 224
462ee303 225ifneq ($(MAKECMDGOALS),depend)
9f1751e4 226ifneq ($(MAKECMDGOALS),)
462ee303 227
e3642d02 228ifeq (ALIVERBOSE,2)
462ee303 229$(warning INCLUDEFILES=$(INCLUDEFILES))
b9d0a01d 230endif
462ee303 231-include $(INCLUDEFILES)
b9d0a01d 232
233endif
234endif
462ee303 235endif
9f1751e4 236endif
462ee303 237
238#-------------------------------------------------------------------------------
239# Include dummy dependency file *MUST* be last includefile
b9d0a01d 240
b9d0a01d 241include build/dummy.d
b9d0a01d 242
243
462ee303 244#-------------------------------------------------------------------------------
245# Targets
b9d0a01d 246
2ea00b17 247.PHONY: alilibs aliroot makedistr clean distclean clean-all \
9f1751e4 248 htmldoc profile modules depend
b9d0a01d 249
b934f194 250modules: $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 251
2d8cad5a 252ifeq ($(ALIPROFILE),YES)
3a5e5a40 253alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
2d8cad5a 254else
3a5e5a40 255alilibs: $(LIBPATH) modules $(ALLLIBS)
2d8cad5a 256endif
41f6cf69 257
b8205a22 258aliroot: alilibs $(BINPATH) $(ALLEXECS)
9f1751e4 259
a6e3afe8 260ROOTALIBDIR=$(shell root-config --libdir)
261
99102ed0 262alimdc-rpm: alimdc-static RAW/alimdc.spec
263 $(MUTE)rm -rf alimdc-root
264 $(MUTE)mkdir -p alimdc-root/opt/alimdc/lib
265 $(MUTE)mkdir -p alimdc-root/opt/alimdc/include
266 $(MUTE)cp RAW/mdc.h alimdc-root/opt/alimdc/include
267 $(MUTE)cp $(LIBPATH)/libAliMDC.a \
268 $(ROOTALIBDIR)/libRoot.a \
269 $(ROOTALIBDIR)/libfreetype.a $(ROOTALIBDIR)/libpcre.a \
270 alimdc-root/opt/alimdc/lib
271 $(MUTE)rm -rf RPMS
272 $(MUTE)mkdir -p RPMS/i386
273 $(MUTE)rpmbuild --verbose --define "_topdir $(ALICE_ROOT)" --define "_tmppath $(ALICE_ROOT)" -bb RAW/alimdc.spec
274 $(MUTE)cp -p RPMS/i386/alimdc-*.rpm .
275 $(MUTE)rm -rf alimdc-root
276 $(MUTE)rm -rf RPMS
277 @echo "***** alimdc RPM created and put $(ALICE_ROOT) folder *****"
278
e66566e2 279alimdc-static: $(LIBPATH) $(BINPATH) $(RAWDatabaseALIB) $(MDCALIB) $(ESDALIB) $(STEERBaseALIB) $(alimdcCXXO)
3c1a04dc 280 $(MUTE)rm -rf $(LIBPATH)/libAliMDC.a
281 $(MUTE)rm -rf junk
e66566e2 282 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
a6e3afe8 283 $(LD) $(LDFLAGS) -o $(BINPATH)/alimdca $(alimdcCXXO) \
284 $(LIBPATH)/libAliMDC.a \
285 $(ROOTALIBDIR)/libRoot.a \
286 $(ROOTALIBDIR)/libfreetype.a $(ROOTALIBDIR)/libpcre.a \
287 -ldl
5fdadcc5 288
e5f9749d 289alilibs-static: $(LIBPATH) modules $(ALLALIBS)
290
5fdadcc5 291include build/MakefileDA
292
462ee303 293#-------------------------------------------------------------------------------
b9d0a01d 294# Single Makefile "distribution": Makefile + modules + mkdepend scripts
b934f194 295makedistr: $(MODULES)
b9d0a01d 296 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
b934f194 297 Makefile create build/*
41f6cf69 298
b9d0a01d 299all: aliroot
41f6cf69 300
b934f194 301depend: $(INCLUDEFILES)
41f6cf69 302
b9d0a01d 303debug:
304ifndef ALIQUIET
305 @echo "***** Entering DEBUG mode. *****"
306endif
e1f602dc 307 @(export ALIDEBUG=YES && $(MAKE) aliroot)
b934f194 308
2d8cad5a 309profile:
310ifndef ALIQUIET
311 @echo "***** Entering PROFILE mode. *****"
312endif
e1f602dc 313 @(export ALIPROFILE=YES && $(MAKE) aliroot)
b934f194 314
b9d0a01d 315$(MODULES):
316ifndef ALIQUIET
317 @echo "***** Making $@ *****"
318endif
319 @mkdir -p $@
320
321$(BINPATH):
322ifndef ALIQUIET
323 @echo "***** Making $@ *****"
324endif
325 @mkdir -p $@
326
327$(LIBPATH):
328ifndef ALIQUIET
329 @echo "***** Making $@ *****"
330endif
331 @mkdir -p $@
332
333build/dummy.d: $(EXPORTFILES)
334 @(if [ ! -f $@ ] ; then \
335 touch $@; \
336 fi)
337
338clean:
2ea00b17 339 @echo "***** No target clean, use one of these *****"
b9d0a01d 340 @echo " clean-aliroot : Clean up all aliroot libraries"
341 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
342 @echo " clean-all : Cleans up everything, including cern libraires"
1aa44b64 343 @echo " distclean : Like clean-all + clean all tgt_*'s"
b934f194 344 @echo " clean-modules : Clean all module.mk files in all modules"
b9d0a01d 345 @echo " clean-libs : Clean all libraries (not object files)"
346 @echo "********************************************"
347
348clean-all: clean-modules clean-libs clean-bins
349ifndef ALIQUIET
350 @echo "***** Cleaning up everything ****"
351endif
352 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
353 $(MUTE)rm -rf $(EXPORTDIR)
354
2ea00b17 355distclean: clean-all
1aa44b64 356 $(MUTE)rm -rf */tgt_* bin lib
2ea00b17 357
462ee303 358#-------------------------------------------------------------------------------
359# This cleans only libraries that are not CERN-libraries
b9d0a01d 360
361clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
362
7e96fcc7 363CHECKMODULES := $(MODULES)
2900fa57 364CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
365CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
366CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
0b5dd071 367CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
af4ebdd2 368CHECKMODULES := $(filter-out LHAPDF,$(CHECKMODULES))
7e96fcc7 369CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
b9d0a01d 370
b934f194 371check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
b9d0a01d 372
5b0f3b29 373smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
374
b934f194 375reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
b9d0a01d 376
b934f194 377revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
b9d0a01d 378
118c0ae6 379smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
380
b9d0a01d 381clean-dicts:
382ifndef ALIQUIET
383 @echo "***** Cleaning up G__ files *****"
384endif
385 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
41f6cf69 386
b9d0a01d 387clean-modules:
388ifndef ALIQUIET
389 @echo "***** Cleaning up module.mk files *****"
390endif
b934f194 391 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 392
b9d0a01d 393clean-depend:
394ifndef ALIQUIET
395 @echo "***** Cleaning up dependencies *****"
396endif
397 $(MUTE)echo rm `find . -name "*.d"`
398
399clean-objects:
400ifndef ALIQUIET
401 @echo "***** Cleaning up .o files *****"
402endif
403 $(MUTE)echo rm `find . -name "*.o"`
404
405clean-libs:
406ifndef ALIQUIET
407 @echo "***** Cleaning up library files *****"
408endif
409 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
410
411clean-bins:
412ifndef ALIQUIET
413 @echo "***** Cleaning up binary files *****"
414endif
415 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
d7a221d0 416
b934f194 417clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
ba546cfd 418
5b0f3b29 419clean-smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-smell-%,$(CHECKMODULES))
420
b934f194 421clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
ba546cfd 422
d7a221d0 423htmldoc:
424 @rm -rf html/roothtml
425 @rm -f html/picts
426 @rm -f /tmp/macros
427 @cd html ;\
428 aliroot -q -b "mkhtml.C(0,1)" ;\
429 ls ../macros/*.C > /tmp/macros ;\
430 for i in $(ALIROOTMODULES) ; do \
431 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
432 done ;\
433 for i in `cat /tmp/macros` ; do \
434 echo $$i ; \
435 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
436 done ;\
437 ./makeExampleList ;
438 @ln -s ../picts html/picts
439 @ln -s ../../picts html/roothtml/picts
440 @ln -s ../../../picts html/roothtml/src/picts
441 @ln -s ../../../picts html/roothtml/examples/picts