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