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