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