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