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