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