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