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