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