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