Added preprocessor conditionals to support ROOT > 5.11.2.
[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
462ee303 26#-------------------------------------------------------------------------------
462ee303 27# Include machine dependent macros
fe4da5cc 28
b9d0a01d 29-include build/Makefile.$(ALICE_TARGET)
fe4da5cc 30
462ee303 31#-------------------------------------------------------------------------------
32# Check if called with debug
42865053 33
b9d0a01d 34ifeq ($(ALIDEBUG),YES)
b934f194 35override ALICE_TARGET := $(ALICE_TARGET)DEBUG
36FFLAGS := -g $(filter-out -O%,$(FFLAGS))
4448d4ac 37CXXFLAGS := -g $(filter-out -O%,$(CXXFLAGS))
38CFLAGS := -g $(filter-out -O%,$(CFLAGS))
b934f194 39SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
40LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
b9d0a01d 41endif
fe4da5cc 42
462ee303 43#-------------------------------------------------------------------------------
44# Check if called with profile
2d8cad5a 45
46ifeq ($(ALIPROFILE),YES)
b934f194 47override ALICE_TARGET := $(ALICE_TARGET)PROF
48FFLAGS += -pg
2d8cad5a 49CXXFLAGS += -pg
b934f194 50CFLAGS += -pg
51SOFLAGS += -pg
52LDFLAGS += -pg
2d8cad5a 53endif
2d8cad5a 54
462ee303 55#-------------------------------------------------------------------------------
56# Check if DATE is installed
b8f3fa00 57
58ifdef DATE_ROOT
462ee303 59DATEFLAGS = -DALI_DATE -D${DATE_SYS} -DDATE_SYS=${DATE_SYS} -Dlong32=${DATE_LONG32} \
bf25155c 60 -Dlong64='${DATE_LONG64}' -DdatePointer=${DATE_POINTER} -I${DATE_COMMON_DEFS}
b934f194 61CXXFLAGS += $(DATEFLAGS)
62CFLAGS += $(DATEFLAGS)
b8f3fa00 63CINTFLAGS += $(DATEFLAGS)
e506ace2 64DEPINC += $(DATEFLAGS)
65else
8c50acf2 66DATEFLAGS = -D`uname` -DDATE_SYS=`uname` -Dlong32='int' \
e506ace2 67 -Dlong64='long long' -DdatePointer='long'
68CXXFLAGS += $(DATEFLAGS)
69CFLAGS += $(DATEFLAGS)
70CINTFLAGS += $(DATEFLAGS)
b934f194 71DEPINC += $(DATEFLAGS)
0a1aa611 72endif
0a1aa611 73
462ee303 74#-------------------------------------------------------------------------------
e44bc3df 75# Location where to install libraries and binaries and common header files
76
77LIBPATH := lib/tgt_$(ALICE_TARGET)
78BINPATH := bin/tgt_$(ALICE_TARGET)
79EXPORTDIR := $(ALICE_ROOT)/include
80BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
81
82#-------------------------------------------------------------------------------
462ee303 83# Modules to build
fe4da5cc 84
e3642d02 85ifeq (ALIVERBOSE,2)
462ee303 86$(warning MAKECMDGOALS=$(MAKECMDGOALS))
87endif
fe4da5cc 88
b934f194 89ALIROOTMODULES := STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
b9d0a01d 90 CRT RICH START STRUCT EVGEN RALICE ALIFAST VZERO \
e756ece8 91 THijing MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
cfdc4533 92 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR DISPLAY ANALYSIS \
521bebb4 93 JETAN HLT LHC EVE
41f6cf69 94
b9d0a01d 95ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
462ee303 96ALIROOTMODULES += TFluka
b9d0a01d 97endif
98
18d2e4ee 99ifeq ($(findstring PWG0,$(MAKECMDGOALS)),PWG0)
100ALIROOTMODULES += PWG0
101endif
102
f3fc258a 103ifeq ($(findstring PWG3,$(MAKECMDGOALS)),PWG3)
104ALIROOTMODULES += PWG3
105endif
106
18d2e4ee 107ifeq ($(findstring SHUTTLE,$(MAKECMDGOALS)),SHUTTLE)
108ALIROOTMODULES += SHUTTLE
109endif
110
2830f9fb 111ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
462ee303 112ALIROOTMODULES += Flugg
2830f9fb 113endif
b9d0a01d 114
462ee303 115CERNMODULES := PDF PYTHIA6 HIJING MICROCERN HERWIG
b9d0a01d 116
462ee303 117MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
b9d0a01d 118
119MODDIRS := $(MODULES)
120
462ee303 121#-------------------------------------------------------------------------------
122# Default include dirs for C++, Fortran, Cint, and dependencies
123# The module directory will be added by each module
b9d0a01d 124
19ca05d1 125GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
19ca05d1 126CXXFLAGS += $(GENINC)
127CXXFLAGSNO += $(GENINC)
128CINTFLAGS += $(GENINC)
129DEPINC += $(GENINC)
b9d0a01d 130
462ee303 131#-------------------------------------------------------------------------------
132# Libraries to link binaries against
133# Libraries will be linked against SHLIB
de6c7cfd 134# ROOT libraries
135
3df2764f 136ROOTCLIBS := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom
b9d0a01d 137
3df2764f 138ROOTPLIBS := -lEGPythia6
de6c7cfd 139
140ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \
141 -lITS -lPHOS -lCRT -lRICH -lVZERO -lZDC -lSTRUCT \
e756ece8 142 -lSTART -lEVGEN -lSTEER
de6c7cfd 143
144LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS)
b9d0a01d 145
462ee303 146#-------------------------------------------------------------------------------
b9d0a01d 147# default target
462ee303 148
4dc83bdb 149default:
0693bbb3 150 $(MUTE)$(MAKE) aliroot
b9d0a01d 151
de6c7cfd 152FORCE:
153
462ee303 154#-------------------------------------------------------------------------------
155# Each module will add to these macros
b9d0a01d 156
157ALLLIBS :=
158ALLEXECS :=
159INCLUDEFILES :=
b934f194 160BINLIBS :=
161EXPORTFILES :=
b9d0a01d 162
462ee303 163#-------------------------------------------------------------------------------
8d7652bd 164# Dependencies of module.mk files if not cleaning
b9d0a01d 165
8ef0bd93 166ifeq ($(CLEAN),)
b9d0a01d 167include build/module.dep
8d7652bd 168endif
b9d0a01d 169
462ee303 170#-------------------------------------------------------------------------------
171# Check if module.mk is present for the library
172
5386b933 173%.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
b9d0a01d 174ifndef ALIQUIET
175 @echo "***** Creating $@ file *****";
176endif
177 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
b9d0a01d 178
462ee303 179#-------------------------------------------------------------------------------
462ee303 180# If making modules, not not include anything
b9d0a01d 181
bdfb9593 182ifeq ($(findstring modules,$(MAKECMDGOALS)),)
b9d0a01d 183
462ee303 184#-------------------------------------------------------------------------------
185# Include the modules
186
b934f194 187-include $(patsubst %,%/module.mk,$(MODULES))
b9d0a01d 188
462ee303 189#-------------------------------------------------------------------------------
bdfb9593 190# If cleaning, do not include dependencies or module.mk files.
191
192ifeq ($(CLEAN),)
193
194#-------------------------------------------------------------------------------
462ee303 195# Include dependencies if not making them!
b9d0a01d 196
462ee303 197ifneq ($(MAKECMDGOALS),depend)
9f1751e4 198ifneq ($(MAKECMDGOALS),)
462ee303 199
e3642d02 200ifeq (ALIVERBOSE,2)
462ee303 201$(warning INCLUDEFILES=$(INCLUDEFILES))
b9d0a01d 202endif
462ee303 203-include $(INCLUDEFILES)
b9d0a01d 204
205endif
206endif
462ee303 207endif
9f1751e4 208endif
462ee303 209
210#-------------------------------------------------------------------------------
211# Include dummy dependency file *MUST* be last includefile
b9d0a01d 212
b9d0a01d 213include build/dummy.d
b9d0a01d 214
215
462ee303 216#-------------------------------------------------------------------------------
217# Targets
b9d0a01d 218
2ea00b17 219.PHONY: alilibs aliroot makedistr clean distclean clean-all \
9f1751e4 220 htmldoc profile modules depend
b9d0a01d 221
b934f194 222modules: $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 223
2d8cad5a 224ifeq ($(ALIPROFILE),YES)
3a5e5a40 225alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
2d8cad5a 226else
3a5e5a40 227alilibs: $(LIBPATH) modules $(ALLLIBS)
2d8cad5a 228endif
41f6cf69 229
b8205a22 230aliroot: alilibs $(BINPATH) $(ALLEXECS)
9f1751e4 231
462ee303 232#-------------------------------------------------------------------------------
b9d0a01d 233# Single Makefile "distribution": Makefile + modules + mkdepend scripts
b934f194 234makedistr: $(MODULES)
b9d0a01d 235 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
b934f194 236 Makefile create build/*
41f6cf69 237
b9d0a01d 238all: aliroot
41f6cf69 239
b934f194 240depend: $(INCLUDEFILES)
41f6cf69 241
b9d0a01d 242debug:
243ifndef ALIQUIET
244 @echo "***** Entering DEBUG mode. *****"
245endif
e1f602dc 246 @(export ALIDEBUG=YES && $(MAKE) aliroot)
b934f194 247
2d8cad5a 248profile:
249ifndef ALIQUIET
250 @echo "***** Entering PROFILE mode. *****"
251endif
e1f602dc 252 @(export ALIPROFILE=YES && $(MAKE) aliroot)
b934f194 253
b9d0a01d 254$(MODULES):
255ifndef ALIQUIET
256 @echo "***** Making $@ *****"
257endif
258 @mkdir -p $@
259
260$(BINPATH):
261ifndef ALIQUIET
262 @echo "***** Making $@ *****"
263endif
264 @mkdir -p $@
265
266$(LIBPATH):
267ifndef ALIQUIET
268 @echo "***** Making $@ *****"
269endif
270 @mkdir -p $@
271
272build/dummy.d: $(EXPORTFILES)
273 @(if [ ! -f $@ ] ; then \
274 touch $@; \
275 fi)
276
277clean:
2ea00b17 278 @echo "***** No target clean, use one of these *****"
b9d0a01d 279 @echo " clean-aliroot : Clean up all aliroot libraries"
280 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
281 @echo " clean-all : Cleans up everything, including cern libraires"
1aa44b64 282 @echo " distclean : Like clean-all + clean all tgt_*'s"
b934f194 283 @echo " clean-modules : Clean all module.mk files in all modules"
b9d0a01d 284 @echo " clean-libs : Clean all libraries (not object files)"
285 @echo "********************************************"
286
287clean-all: clean-modules clean-libs clean-bins
288ifndef ALIQUIET
289 @echo "***** Cleaning up everything ****"
290endif
291 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
292 $(MUTE)rm -rf $(EXPORTDIR)
293
2ea00b17 294distclean: clean-all
1aa44b64 295 $(MUTE)rm -rf */tgt_* bin lib
2ea00b17 296
462ee303 297#-------------------------------------------------------------------------------
298# This cleans only libraries that are not CERN-libraries
b9d0a01d 299
300clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
301
7e96fcc7 302CHECKMODULES := $(MODULES)
2900fa57 303CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
304CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
305CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
0b5dd071 306CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
7e96fcc7 307CHECKMODULES := $(filter-out PDF,$(CHECKMODULES))
308CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
b9d0a01d 309
b934f194 310check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
b9d0a01d 311
b934f194 312reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
b9d0a01d 313
b934f194 314revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
b9d0a01d 315
316clean-dicts:
317ifndef ALIQUIET
318 @echo "***** Cleaning up G__ files *****"
319endif
320 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
41f6cf69 321
b9d0a01d 322clean-modules:
323ifndef ALIQUIET
324 @echo "***** Cleaning up module.mk files *****"
325endif
b934f194 326 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 327
b9d0a01d 328clean-depend:
329ifndef ALIQUIET
330 @echo "***** Cleaning up dependencies *****"
331endif
332 $(MUTE)echo rm `find . -name "*.d"`
333
334clean-objects:
335ifndef ALIQUIET
336 @echo "***** Cleaning up .o files *****"
337endif
338 $(MUTE)echo rm `find . -name "*.o"`
339
340clean-libs:
341ifndef ALIQUIET
342 @echo "***** Cleaning up library files *****"
343endif
344 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
345
346clean-bins:
347ifndef ALIQUIET
348 @echo "***** Cleaning up binary files *****"
349endif
350 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
d7a221d0 351
b934f194 352clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
ba546cfd 353
b934f194 354clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
ba546cfd 355
d7a221d0 356htmldoc:
357 @rm -rf html/roothtml
358 @rm -f html/picts
359 @rm -f /tmp/macros
360 @cd html ;\
361 aliroot -q -b "mkhtml.C(0,1)" ;\
362 ls ../macros/*.C > /tmp/macros ;\
363 for i in $(ALIROOTMODULES) ; do \
364 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
365 done ;\
366 for i in `cat /tmp/macros` ; do \
367 echo $$i ; \
368 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
369 done ;\
370 ./makeExampleList ;
371 @ln -s ../picts html/picts
372 @ln -s ../../picts html/roothtml/picts
373 @ln -s ../../../picts html/roothtml/src/picts
374 @ln -s ../../../picts html/roothtml/examples/picts