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