Air with increased transport cuts close to qb28.
[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 \
b384f8a4 93 ACORDE HMPID T0 STRUCT EVGEN RALICE VZERO \
e756ece8 94 THijing MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
92b443ef 95 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS \
8db084d0 96 JETAN HLT LHC ESDCheck
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
04d2c4d5 114ifeq ($(findstring PWG2,$(MAKECMDGOALS)),PWG2)
115ALIROOTMODULES += PWG2
116endif
117
f3fc258a 118ifeq ($(findstring PWG3,$(MAKECMDGOALS)),PWG3)
119ALIROOTMODULES += PWG3
120endif
121
739baceb 122ifeq ($(findstring PWG4,$(MAKECMDGOALS)),PWG4)
123ALIROOTMODULES += PWG4
124endif
125
18d2e4ee 126ifeq ($(findstring SHUTTLE,$(MAKECMDGOALS)),SHUTTLE)
127ALIROOTMODULES += SHUTTLE
128endif
129
2830f9fb 130ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
462ee303 131ALIROOTMODULES += Flugg
2830f9fb 132endif
b9d0a01d 133
8db084d0 134CERNMODULES := LHAPDF HIJING MICROCERN HERWIG
135
136ifneq ($(wildcard $(ROOTSYS)/include/TPythia6.h),)
137CERNMODULES += PYTHIA6
138endif
b9d0a01d 139
462ee303 140MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
b9d0a01d 141
142MODDIRS := $(MODULES)
143
462ee303 144#-------------------------------------------------------------------------------
145# Default include dirs for C++, Fortran, Cint, and dependencies
146# The module directory will be added by each module
b9d0a01d 147
19ca05d1 148GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
19ca05d1 149CXXFLAGS += $(GENINC)
150CXXFLAGSNO += $(GENINC)
151CINTFLAGS += $(GENINC)
152DEPINC += $(GENINC)
b9d0a01d 153
462ee303 154#-------------------------------------------------------------------------------
155# Libraries to link binaries against
156# Libraries will be linked against SHLIB
de6c7cfd 157# ROOT libraries
158
e9f631d2 159ROOTCLIBS := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO
b9d0a01d 160
3df2764f 161ROOTPLIBS := -lEGPythia6
de6c7cfd 162
163ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \
b384f8a4 164 -lITS -lPHOS -lACORDE -lHMPID -lVZERO -lZDC -lSTRUCT \
ababa197 165 -lT0 -lEVGEN -lSTEER
de6c7cfd 166
167LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS)
b9d0a01d 168
462ee303 169#-------------------------------------------------------------------------------
b9d0a01d 170# default target
462ee303 171
4dc83bdb 172default:
0693bbb3 173 $(MUTE)$(MAKE) aliroot
b9d0a01d 174
de6c7cfd 175FORCE:
176
462ee303 177#-------------------------------------------------------------------------------
178# Each module will add to these macros
b9d0a01d 179
180ALLLIBS :=
181ALLEXECS :=
182INCLUDEFILES :=
b934f194 183BINLIBS :=
184EXPORTFILES :=
b9d0a01d 185
462ee303 186#-------------------------------------------------------------------------------
8d7652bd 187# Dependencies of module.mk files if not cleaning
b9d0a01d 188
8ef0bd93 189ifeq ($(CLEAN),)
b9d0a01d 190include build/module.dep
8d7652bd 191endif
b9d0a01d 192
462ee303 193#-------------------------------------------------------------------------------
194# Check if module.mk is present for the library
195
5386b933 196%.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
b9d0a01d 197ifndef ALIQUIET
198 @echo "***** Creating $@ file *****";
199endif
200 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
b9d0a01d 201
462ee303 202#-------------------------------------------------------------------------------
462ee303 203# If making modules, not not include anything
b9d0a01d 204
bdfb9593 205ifeq ($(findstring modules,$(MAKECMDGOALS)),)
b9d0a01d 206
462ee303 207#-------------------------------------------------------------------------------
208# Include the modules
209
b934f194 210-include $(patsubst %,%/module.mk,$(MODULES))
b9d0a01d 211
462ee303 212#-------------------------------------------------------------------------------
bdfb9593 213# If cleaning, do not include dependencies or module.mk files.
214
215ifeq ($(CLEAN),)
216
217#-------------------------------------------------------------------------------
462ee303 218# Include dependencies if not making them!
b9d0a01d 219
462ee303 220ifneq ($(MAKECMDGOALS),depend)
9f1751e4 221ifneq ($(MAKECMDGOALS),)
462ee303 222
e3642d02 223ifeq (ALIVERBOSE,2)
462ee303 224$(warning INCLUDEFILES=$(INCLUDEFILES))
b9d0a01d 225endif
462ee303 226-include $(INCLUDEFILES)
b9d0a01d 227
228endif
229endif
462ee303 230endif
9f1751e4 231endif
462ee303 232
233#-------------------------------------------------------------------------------
234# Include dummy dependency file *MUST* be last includefile
b9d0a01d 235
b9d0a01d 236include build/dummy.d
b9d0a01d 237
238
462ee303 239#-------------------------------------------------------------------------------
240# Targets
b9d0a01d 241
2ea00b17 242.PHONY: alilibs aliroot makedistr clean distclean clean-all \
9f1751e4 243 htmldoc profile modules depend
b9d0a01d 244
b934f194 245modules: $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 246
2d8cad5a 247ifeq ($(ALIPROFILE),YES)
3a5e5a40 248alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
2d8cad5a 249else
3a5e5a40 250alilibs: $(LIBPATH) modules $(ALLLIBS)
2d8cad5a 251endif
41f6cf69 252
b8205a22 253aliroot: alilibs $(BINPATH) $(ALLEXECS)
9f1751e4 254
a6e3afe8 255ROOTALIBDIR=$(shell root-config --libdir)
256
257alimdc-static: $(LIBPATH) $(BINPATH) $(RAWDatabaseALIB) $(MDCALIB) $(ESDALIB) $(alimdcCXXO)
3c1a04dc 258 $(MUTE)rm -rf $(LIBPATH)/libAliMDC.a
259 $(MUTE)rm -rf junk
260 mkdir junk && cd junk && ar x ../$(RAWDatabaseALIB) && ar x ../$(MDCALIB) && ar x ../$(ESDALIB) && ar r ../$(LIBPATH)/libAliMDC.a *.o && cd .. && rm -rf junk
a6e3afe8 261 $(LD) $(LDFLAGS) -o $(BINPATH)/alimdca $(alimdcCXXO) \
262 $(LIBPATH)/libAliMDC.a \
263 $(ROOTALIBDIR)/libRoot.a \
264 $(ROOTALIBDIR)/libfreetype.a $(ROOTALIBDIR)/libpcre.a \
265 -ldl
5fdadcc5 266
e5f9749d 267alilibs-static: $(LIBPATH) modules $(ALLALIBS)
268
5fdadcc5 269include build/MakefileDA
270
462ee303 271#-------------------------------------------------------------------------------
b9d0a01d 272# Single Makefile "distribution": Makefile + modules + mkdepend scripts
b934f194 273makedistr: $(MODULES)
b9d0a01d 274 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
b934f194 275 Makefile create build/*
41f6cf69 276
b9d0a01d 277all: aliroot
41f6cf69 278
b934f194 279depend: $(INCLUDEFILES)
41f6cf69 280
b9d0a01d 281debug:
282ifndef ALIQUIET
283 @echo "***** Entering DEBUG mode. *****"
284endif
e1f602dc 285 @(export ALIDEBUG=YES && $(MAKE) aliroot)
b934f194 286
2d8cad5a 287profile:
288ifndef ALIQUIET
289 @echo "***** Entering PROFILE mode. *****"
290endif
e1f602dc 291 @(export ALIPROFILE=YES && $(MAKE) aliroot)
b934f194 292
b9d0a01d 293$(MODULES):
294ifndef ALIQUIET
295 @echo "***** Making $@ *****"
296endif
297 @mkdir -p $@
298
299$(BINPATH):
300ifndef ALIQUIET
301 @echo "***** Making $@ *****"
302endif
303 @mkdir -p $@
304
305$(LIBPATH):
306ifndef ALIQUIET
307 @echo "***** Making $@ *****"
308endif
309 @mkdir -p $@
310
311build/dummy.d: $(EXPORTFILES)
312 @(if [ ! -f $@ ] ; then \
313 touch $@; \
314 fi)
315
316clean:
2ea00b17 317 @echo "***** No target clean, use one of these *****"
b9d0a01d 318 @echo " clean-aliroot : Clean up all aliroot libraries"
319 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
320 @echo " clean-all : Cleans up everything, including cern libraires"
1aa44b64 321 @echo " distclean : Like clean-all + clean all tgt_*'s"
b934f194 322 @echo " clean-modules : Clean all module.mk files in all modules"
b9d0a01d 323 @echo " clean-libs : Clean all libraries (not object files)"
324 @echo "********************************************"
325
326clean-all: clean-modules clean-libs clean-bins
327ifndef ALIQUIET
328 @echo "***** Cleaning up everything ****"
329endif
330 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
331 $(MUTE)rm -rf $(EXPORTDIR)
332
2ea00b17 333distclean: clean-all
1aa44b64 334 $(MUTE)rm -rf */tgt_* bin lib
2ea00b17 335
462ee303 336#-------------------------------------------------------------------------------
337# This cleans only libraries that are not CERN-libraries
b9d0a01d 338
339clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
340
7e96fcc7 341CHECKMODULES := $(MODULES)
2900fa57 342CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
343CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
344CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
0b5dd071 345CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
af4ebdd2 346CHECKMODULES := $(filter-out LHAPDF,$(CHECKMODULES))
7e96fcc7 347CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
b9d0a01d 348
b934f194 349check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
b9d0a01d 350
5b0f3b29 351smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
352
b934f194 353reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
b9d0a01d 354
b934f194 355revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
b9d0a01d 356
118c0ae6 357smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
358
b9d0a01d 359clean-dicts:
360ifndef ALIQUIET
361 @echo "***** Cleaning up G__ files *****"
362endif
363 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
41f6cf69 364
b9d0a01d 365clean-modules:
366ifndef ALIQUIET
367 @echo "***** Cleaning up module.mk files *****"
368endif
b934f194 369 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 370
b9d0a01d 371clean-depend:
372ifndef ALIQUIET
373 @echo "***** Cleaning up dependencies *****"
374endif
375 $(MUTE)echo rm `find . -name "*.d"`
376
377clean-objects:
378ifndef ALIQUIET
379 @echo "***** Cleaning up .o files *****"
380endif
381 $(MUTE)echo rm `find . -name "*.o"`
382
383clean-libs:
384ifndef ALIQUIET
385 @echo "***** Cleaning up library files *****"
386endif
387 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
388
389clean-bins:
390ifndef ALIQUIET
391 @echo "***** Cleaning up binary files *****"
392endif
393 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
d7a221d0 394
b934f194 395clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
ba546cfd 396
5b0f3b29 397clean-smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-smell-%,$(CHECKMODULES))
398
b934f194 399clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
ba546cfd 400
d7a221d0 401htmldoc:
402 @rm -rf html/roothtml
403 @rm -f html/picts
404 @rm -f /tmp/macros
405 @cd html ;\
406 aliroot -q -b "mkhtml.C(0,1)" ;\
407 ls ../macros/*.C > /tmp/macros ;\
408 for i in $(ALIROOTMODULES) ; do \
409 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
410 done ;\
411 for i in `cat /tmp/macros` ; do \
412 echo $$i ; \
413 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
414 done ;\
415 ./makeExampleList ;
416 @ln -s ../picts html/picts
417 @ln -s ../../picts html/roothtml/picts
418 @ln -s ../../../picts html/roothtml/src/picts
419 @ln -s ../../../picts html/roothtml/examples/picts