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