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