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