Unused variable i removed
[u/mrichter/AliRoot.git] / Makefile
... / ...
CommitLineData
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
5
6# /* $Id$ */
7
8ifdef ALIVERBOSE
9MUTE:=
10else
11MUTE:=@
12endif
13
14CLEAN=$(findstring clean,$(MAKECMDGOALS))
15
16#-------------------------------------------------------------------------------
17# IRST coding rule check
18
19IRST_INSTALLDIR=$(ALICE)/local/IRST
20IRST_CONFIG_DIR=$(IRST_INSTALLDIR)/userConfig/ALICE
21CLASSPATH=$(IRST_INSTALLDIR)
22export CLASSPATH IRST_INSTALLDIR IRST_CONFIG_DIR
23CODE_CHECK=java rules.ALICE.ALICERuleChecker
24REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh
25
26SMELL_DETECTOR_DIR=$(IRST_INSTALLDIR)/smell-detector
27
28
29#-------------------------------------------------------------------------------
30# Include machine dependent macros
31
32-include build/Makefile.$(ALICE_TARGET)
33
34#-------------------------------------------------------------------------------
35# Check if called with debug
36
37ifeq ($(ALIDEBUG),YES)
38override ALICE_TARGET := $(ALICE_TARGET)DEBUG
39FFLAGS := -g $(filter-out -O%,$(FFLAGS))
40CXXFLAGS := -g $(filter-out -O%,$(CXXFLAGS))
41CFLAGS := -g $(filter-out -O%,$(CFLAGS))
42SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
43LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
44endif
45
46#-------------------------------------------------------------------------------
47# Check if called with profile
48
49ifeq ($(ALIPROFILE),YES)
50override ALICE_TARGET := $(ALICE_TARGET)PROF
51FFLAGS += -pg
52CXXFLAGS += -pg
53CFLAGS += -pg
54SOFLAGS += -pg
55LDFLAGS += -pg
56endif
57
58#-------------------------------------------------------------------------------
59# Check if DATE is installed
60
61ifdef DATE_ROOT
62DATEFLAGS = -DALI_DATE -D${DATE_SYS} -DDATE_SYS=${DATE_SYS} -Dlong32=${DATE_LONG32} \
63 -Dlong64='${DATE_LONG64}' -DdatePointer=${DATE_POINTER} -I${DATE_COMMON_DEFS} -I${DATE_MONITOR_DIR}
64CXXFLAGS += $(DATEFLAGS)
65CFLAGS += $(DATEFLAGS)
66CINTFLAGS += $(DATEFLAGS)
67DEPINC += $(DATEFLAGS)
68else
69DATEFLAGS = -D`uname` -DDATE_SYS=`uname` -Dlong32='int' \
70 -Dlong64='long long' -DdatePointer='long'
71CXXFLAGS += $(DATEFLAGS)
72CFLAGS += $(DATEFLAGS)
73CINTFLAGS += $(DATEFLAGS)
74DEPINC += $(DATEFLAGS)
75endif
76
77#-------------------------------------------------------------------------------
78# Location where to install libraries and binaries and common header files
79
80LIBPATH := lib/tgt_$(ALICE_TARGET)
81BINPATH := bin/tgt_$(ALICE_TARGET)
82EXPORTDIR := $(ALICE_ROOT)/include
83BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
84
85#-------------------------------------------------------------------------------
86# Modules to build
87
88ifeq (ALIVERBOSE,2)
89$(warning MAKECMDGOALS=$(MAKECMDGOALS))
90endif
91
92ALIROOTMODULES := STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
93 ACORDE HMPID T0 STRUCT EVGEN RALICE VZERO \
94 THijing MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
95 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS \
96 JETAN HLT LHC ESDCheck
97
98ifneq ($(wildcard $(ROOTSYS)/include/TGLIncludes.h),)
99ALIROOTMODULES += EVE
100endif
101
102ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
103ALIROOTMODULES += TFluka
104endif
105
106ifeq ($(findstring THydjet,$(MAKECMDGOALS)),THydjet)
107ALIROOTMODULES += THydjet
108endif
109
110ifeq ($(findstring PWG0,$(MAKECMDGOALS)),PWG0)
111ALIROOTMODULES += PWG0
112endif
113
114ifeq ($(findstring PWG1,$(MAKECMDGOALS)),PWG1)
115ALIROOTMODULES += PWG1
116endif
117
118ifeq ($(findstring PWG2,$(MAKECMDGOALS)),PWG2)
119ALIROOTMODULES += PWG2
120endif
121
122ifeq ($(findstring PWG3,$(MAKECMDGOALS)),PWG3)
123ALIROOTMODULES += PWG3
124endif
125
126ifeq ($(findstring PWG4,$(MAKECMDGOALS)),PWG4)
127ALIROOTMODULES += PWG4
128endif
129
130ifeq ($(findstring SHUTTLE,$(MAKECMDGOALS)),SHUTTLE)
131ALIROOTMODULES += SHUTTLE
132endif
133
134ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
135ALIROOTMODULES += Flugg
136endif
137
138CERNMODULES := LHAPDF HIJING MICROCERN HERWIG
139
140ifneq ($(wildcard $(ROOTSYS)/include/TPythia6.h),)
141CERNMODULES += PYTHIA6
142endif
143
144MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
145
146MODDIRS := $(MODULES)
147
148#-------------------------------------------------------------------------------
149# Default include dirs for C++, Fortran, Cint, and dependencies
150# The module directory will be added by each module
151
152GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
153CXXFLAGS += $(GENINC)
154CXXFLAGSNO += $(GENINC)
155CINTFLAGS += $(GENINC)
156DEPINC += $(GENINC)
157
158#-------------------------------------------------------------------------------
159# Libraries to link binaries against
160# Libraries will be linked against SHLIB
161# ROOT libraries
162
163ROOTCLIBS := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof -lProofPlayer
164
165ROOTPLIBS := -lEGPythia6
166
167ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \
168 -lITS -lPHOS -lACORDE -lHMPID -lVZERO -lZDC -lSTRUCT \
169 -lT0 -lEVGEN -lSTEER
170
171LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS)
172
173#-------------------------------------------------------------------------------
174# default target
175
176default:
177 $(MUTE)$(MAKE) aliroot
178
179FORCE:
180
181#-------------------------------------------------------------------------------
182# Each module will add to these macros
183
184ALLLIBS :=
185ALLEXECS :=
186INCLUDEFILES :=
187BINLIBS :=
188EXPORTFILES :=
189
190#-------------------------------------------------------------------------------
191# Dependencies of module.mk files if not cleaning
192
193ifeq ($(CLEAN),)
194include build/module.dep
195endif
196
197#-------------------------------------------------------------------------------
198# Check if module.mk is present for the library
199
200%.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
201ifndef ALIQUIET
202 @echo "***** Creating $@ file *****";
203endif
204 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
205
206#-------------------------------------------------------------------------------
207# If making modules, not not include anything
208
209ifeq ($(findstring modules,$(MAKECMDGOALS)),)
210
211#-------------------------------------------------------------------------------
212# Include the modules
213
214-include $(patsubst %,%/module.mk,$(MODULES))
215
216#-------------------------------------------------------------------------------
217# If cleaning, do not include dependencies or module.mk files.
218
219ifeq ($(CLEAN),)
220
221#-------------------------------------------------------------------------------
222# Include dependencies if not making them!
223
224ifneq ($(MAKECMDGOALS),depend)
225ifneq ($(MAKECMDGOALS),)
226
227ifeq (ALIVERBOSE,2)
228$(warning INCLUDEFILES=$(INCLUDEFILES))
229endif
230-include $(INCLUDEFILES)
231
232endif
233endif
234endif
235endif
236
237#-------------------------------------------------------------------------------
238# Include dummy dependency file *MUST* be last includefile
239
240include build/dummy.d
241
242
243#-------------------------------------------------------------------------------
244# Targets
245
246.PHONY: alilibs aliroot makedistr clean distclean clean-all \
247 htmldoc profile modules depend
248
249modules: $(patsubst %,%/module.mk,$(MODULES))
250
251ifeq ($(ALIPROFILE),YES)
252alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
253else
254alilibs: $(LIBPATH) modules $(ALLLIBS)
255endif
256
257aliroot: alilibs $(BINPATH) $(ALLEXECS)
258
259ROOTALIBDIR=$(shell root-config --libdir)
260
261alimdc-static: $(LIBPATH) $(BINPATH) $(RAWDatabaseALIB) $(MDCALIB) $(ESDALIB) $(alimdcCXXO)
262 $(MUTE)rm -rf $(LIBPATH)/libAliMDC.a
263 $(MUTE)rm -rf junk
264 mkdir junk && cd junk && ar x ../$(RAWDatabaseALIB) && ar x ../$(MDCALIB) && ar x ../$(ESDALIB) && ar r ../$(LIBPATH)/libAliMDC.a *.o && cd .. && rm -rf junk
265 $(LD) $(LDFLAGS) -o $(BINPATH)/alimdca $(alimdcCXXO) \
266 $(LIBPATH)/libAliMDC.a \
267 $(ROOTALIBDIR)/libRoot.a \
268 $(ROOTALIBDIR)/libfreetype.a $(ROOTALIBDIR)/libpcre.a \
269 -ldl
270
271alilibs-static: $(LIBPATH) modules $(ALLALIBS)
272
273include build/MakefileDA
274
275#-------------------------------------------------------------------------------
276# Single Makefile "distribution": Makefile + modules + mkdepend scripts
277makedistr: $(MODULES)
278 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
279 Makefile create build/*
280
281all: aliroot
282
283depend: $(INCLUDEFILES)
284
285debug:
286ifndef ALIQUIET
287 @echo "***** Entering DEBUG mode. *****"
288endif
289 @(export ALIDEBUG=YES && $(MAKE) aliroot)
290
291profile:
292ifndef ALIQUIET
293 @echo "***** Entering PROFILE mode. *****"
294endif
295 @(export ALIPROFILE=YES && $(MAKE) aliroot)
296
297$(MODULES):
298ifndef ALIQUIET
299 @echo "***** Making $@ *****"
300endif
301 @mkdir -p $@
302
303$(BINPATH):
304ifndef ALIQUIET
305 @echo "***** Making $@ *****"
306endif
307 @mkdir -p $@
308
309$(LIBPATH):
310ifndef ALIQUIET
311 @echo "***** Making $@ *****"
312endif
313 @mkdir -p $@
314
315build/dummy.d: $(EXPORTFILES)
316 @(if [ ! -f $@ ] ; then \
317 touch $@; \
318 fi)
319
320clean:
321 @echo "***** No target clean, use one of these *****"
322 @echo " clean-aliroot : Clean up all aliroot libraries"
323 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
324 @echo " clean-all : Cleans up everything, including cern libraires"
325 @echo " distclean : Like clean-all + clean all tgt_*'s"
326 @echo " clean-modules : Clean all module.mk files in all modules"
327 @echo " clean-libs : Clean all libraries (not object files)"
328 @echo "********************************************"
329
330clean-all: clean-modules clean-libs clean-bins
331ifndef ALIQUIET
332 @echo "***** Cleaning up everything ****"
333endif
334 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
335 $(MUTE)rm -rf $(EXPORTDIR)
336
337distclean: clean-all
338 $(MUTE)rm -rf */tgt_* bin lib
339
340#-------------------------------------------------------------------------------
341# This cleans only libraries that are not CERN-libraries
342
343clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
344
345CHECKMODULES := $(MODULES)
346CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
347CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
348CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
349CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
350CHECKMODULES := $(filter-out LHAPDF,$(CHECKMODULES))
351CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
352
353check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
354
355smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
356
357reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
358
359revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
360
361smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
362
363clean-dicts:
364ifndef ALIQUIET
365 @echo "***** Cleaning up G__ files *****"
366endif
367 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
368
369clean-modules:
370ifndef ALIQUIET
371 @echo "***** Cleaning up module.mk files *****"
372endif
373 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
374
375clean-depend:
376ifndef ALIQUIET
377 @echo "***** Cleaning up dependencies *****"
378endif
379 $(MUTE)echo rm `find . -name "*.d"`
380
381clean-objects:
382ifndef ALIQUIET
383 @echo "***** Cleaning up .o files *****"
384endif
385 $(MUTE)echo rm `find . -name "*.o"`
386
387clean-libs:
388ifndef ALIQUIET
389 @echo "***** Cleaning up library files *****"
390endif
391 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
392
393clean-bins:
394ifndef ALIQUIET
395 @echo "***** Cleaning up binary files *****"
396endif
397 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
398
399clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
400
401clean-smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-smell-%,$(CHECKMODULES))
402
403clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
404
405htmldoc:
406 @rm -rf html/roothtml
407 @rm -f html/picts
408 @rm -f /tmp/macros
409 @cd html ;\
410 aliroot -q -b "mkhtml.C(0,1)" ;\
411 ls ../macros/*.C > /tmp/macros ;\
412 for i in $(ALIROOTMODULES) ; do \
413 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
414 done ;\
415 for i in `cat /tmp/macros` ; do \
416 echo $$i ; \
417 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
418 done ;\
419 ./makeExampleList ;
420 @ln -s ../picts html/picts
421 @ln -s ../../picts html/roothtml/picts
422 @ln -s ../../../picts html/roothtml/src/picts
423 @ln -s ../../../picts html/roothtml/examples/picts