Restoring debug and profile targets
[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
4dc83bdb 126default:
127 $(MAKE) aliroot
b9d0a01d 128
462ee303 129#-------------------------------------------------------------------------------
130# Each module will add to these macros
b9d0a01d 131
132ALLLIBS :=
133ALLEXECS :=
134INCLUDEFILES :=
b934f194 135BINLIBS :=
136EXPORTFILES :=
b9d0a01d 137
462ee303 138#-------------------------------------------------------------------------------
139# Dependencies of module.mk files
b9d0a01d 140
141include build/module.dep
142
462ee303 143#-------------------------------------------------------------------------------
144# Check if module.mk is present for the library
145
5386b933 146%.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
b9d0a01d 147ifndef ALIQUIET
148 @echo "***** Creating $@ file *****";
149endif
150 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
b9d0a01d 151
462ee303 152#-------------------------------------------------------------------------------
462ee303 153# If making modules, not not include anything
b9d0a01d 154
bdfb9593 155ifeq ($(findstring modules,$(MAKECMDGOALS)),)
b9d0a01d 156
462ee303 157#-------------------------------------------------------------------------------
158# Include the modules
159
b934f194 160-include $(patsubst %,%/module.mk,$(MODULES))
b9d0a01d 161
462ee303 162#-------------------------------------------------------------------------------
bdfb9593 163# If cleaning, do not include dependencies or module.mk files.
164
165ifeq ($(CLEAN),)
166
167#-------------------------------------------------------------------------------
462ee303 168# Include dependencies if not making them!
b9d0a01d 169
462ee303 170ifneq ($(MAKECMDGOALS),depend)
9f1751e4 171ifneq ($(MAKECMDGOALS),)
462ee303 172
173ifdef ALIVERBOSE
174$(warning INCLUDEFILES=$(INCLUDEFILES))
b9d0a01d 175endif
462ee303 176-include $(INCLUDEFILES)
b9d0a01d 177
178endif
179endif
462ee303 180endif
9f1751e4 181endif
462ee303 182
183#-------------------------------------------------------------------------------
184# Include dummy dependency file *MUST* be last includefile
b9d0a01d 185
b9d0a01d 186include build/dummy.d
b9d0a01d 187
188
462ee303 189#-------------------------------------------------------------------------------
190# Targets
b9d0a01d 191
2ea00b17 192.PHONY: alilibs aliroot makedistr clean distclean clean-all \
9f1751e4 193 htmldoc profile modules depend
b9d0a01d 194
b934f194 195modules: $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 196
2d8cad5a 197ifeq ($(ALIPROFILE),YES)
3a5e5a40 198alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
2d8cad5a 199else
3a5e5a40 200alilibs: $(LIBPATH) modules $(ALLLIBS)
2d8cad5a 201endif
41f6cf69 202
b8205a22 203aliroot: alilibs $(BINPATH) $(ALLEXECS)
9f1751e4 204
462ee303 205#-------------------------------------------------------------------------------
b9d0a01d 206# Single Makefile "distribution": Makefile + modules + mkdepend scripts
b934f194 207makedistr: $(MODULES)
b9d0a01d 208 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
b934f194 209 Makefile create build/*
41f6cf69 210
b9d0a01d 211all: aliroot
41f6cf69 212
b934f194 213depend: $(INCLUDEFILES)
41f6cf69 214
b9d0a01d 215debug:
216ifndef ALIQUIET
217 @echo "***** Entering DEBUG mode. *****"
218endif
e1f602dc 219 @(export ALIDEBUG=YES && $(MAKE) aliroot)
b934f194 220
2d8cad5a 221profile:
222ifndef ALIQUIET
223 @echo "***** Entering PROFILE mode. *****"
224endif
e1f602dc 225 @(export ALIPROFILE=YES && $(MAKE) aliroot)
b934f194 226
b9d0a01d 227$(MODULES):
228ifndef ALIQUIET
229 @echo "***** Making $@ *****"
230endif
231 @mkdir -p $@
232
233$(BINPATH):
234ifndef ALIQUIET
235 @echo "***** Making $@ *****"
236endif
237 @mkdir -p $@
238
239$(LIBPATH):
240ifndef ALIQUIET
241 @echo "***** Making $@ *****"
242endif
243 @mkdir -p $@
244
245build/dummy.d: $(EXPORTFILES)
246 @(if [ ! -f $@ ] ; then \
247 touch $@; \
248 fi)
249
250clean:
2ea00b17 251 @echo "***** No target clean, use one of these *****"
b9d0a01d 252 @echo " clean-aliroot : Clean up all aliroot libraries"
253 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
254 @echo " clean-all : Cleans up everything, including cern libraires"
1aa44b64 255 @echo " distclean : Like clean-all + clean all tgt_*'s"
b934f194 256 @echo " clean-modules : Clean all module.mk files in all modules"
b9d0a01d 257 @echo " clean-libs : Clean all libraries (not object files)"
258 @echo "********************************************"
259
260clean-all: clean-modules clean-libs clean-bins
261ifndef ALIQUIET
262 @echo "***** Cleaning up everything ****"
263endif
264 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
265 $(MUTE)rm -rf $(EXPORTDIR)
266
2ea00b17 267distclean: clean-all
1aa44b64 268 $(MUTE)rm -rf */tgt_* bin lib
2ea00b17 269
462ee303 270#-------------------------------------------------------------------------------
271# This cleans only libraries that are not CERN-libraries
b9d0a01d 272
273clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
274
7e96fcc7 275CHECKMODULES := $(MODULES)
2900fa57 276CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
277CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
278CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
0b5dd071 279CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
7e96fcc7 280CHECKMODULES := $(filter-out PDF,$(CHECKMODULES))
281CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
b9d0a01d 282
b934f194 283check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
b9d0a01d 284
b934f194 285reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
b9d0a01d 286
b934f194 287revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
b9d0a01d 288
289clean-dicts:
290ifndef ALIQUIET
291 @echo "***** Cleaning up G__ files *****"
292endif
293 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
41f6cf69 294
b9d0a01d 295clean-modules:
296ifndef ALIQUIET
297 @echo "***** Cleaning up module.mk files *****"
298endif
b934f194 299 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 300
b9d0a01d 301clean-depend:
302ifndef ALIQUIET
303 @echo "***** Cleaning up dependencies *****"
304endif
305 $(MUTE)echo rm `find . -name "*.d"`
306
307clean-objects:
308ifndef ALIQUIET
309 @echo "***** Cleaning up .o files *****"
310endif
311 $(MUTE)echo rm `find . -name "*.o"`
312
313clean-libs:
314ifndef ALIQUIET
315 @echo "***** Cleaning up library files *****"
316endif
317 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
318
319clean-bins:
320ifndef ALIQUIET
321 @echo "***** Cleaning up binary files *****"
322endif
323 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
d7a221d0 324
b934f194 325clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
ba546cfd 326
b934f194 327clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
ba546cfd 328
d7a221d0 329htmldoc:
330 @rm -rf html/roothtml
331 @rm -f html/picts
332 @rm -f /tmp/macros
333 @cd html ;\
334 aliroot -q -b "mkhtml.C(0,1)" ;\
335 ls ../macros/*.C > /tmp/macros ;\
336 for i in $(ALIROOTMODULES) ; do \
337 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
338 done ;\
339 for i in `cat /tmp/macros` ; do \
340 echo $$i ; \
341 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
342 done ;\
343 ./makeExampleList ;
344 @ln -s ../picts html/picts
345 @ln -s ../../picts html/roothtml/picts
346 @ln -s ../../../picts html/roothtml/src/picts
347 @ln -s ../../../picts html/roothtml/examples/picts