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