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