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