Runloader is updated when moving to next file (quick fix).
[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} \
5fdadcc5 63 -Dlong64='${DATE_LONG64}' -DdatePointer=${DATE_POINTER} -I${DATE_COMMON_DEFS} -I${DATE_MONITOR_DIR}
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 \
b384f8a4 93 ACORDE HMPID T0 STRUCT EVGEN RALICE VZERO \
e756ece8 94 THijing MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
92b443ef 95 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS \
8db084d0 96 JETAN HLT LHC ESDCheck
97
98ifneq ($(wildcard $(ROOTSYS)/include/TGLIncludes.h),)
3b85abd6 99ALIROOTMODULES += EVE
8db084d0 100endif
41f6cf69 101
b9d0a01d 102ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
462ee303 103ALIROOTMODULES += TFluka
b9d0a01d 104endif
105
18d2e4ee 106ifeq ($(findstring PWG0,$(MAKECMDGOALS)),PWG0)
107ALIROOTMODULES += PWG0
108endif
109
04d2c4d5 110ifeq ($(findstring PWG2,$(MAKECMDGOALS)),PWG2)
111ALIROOTMODULES += PWG2
112endif
113
f3fc258a 114ifeq ($(findstring PWG3,$(MAKECMDGOALS)),PWG3)
115ALIROOTMODULES += PWG3
116endif
117
739baceb 118ifeq ($(findstring PWG4,$(MAKECMDGOALS)),PWG4)
119ALIROOTMODULES += PWG4
120endif
121
18d2e4ee 122ifeq ($(findstring SHUTTLE,$(MAKECMDGOALS)),SHUTTLE)
123ALIROOTMODULES += SHUTTLE
124endif
125
2830f9fb 126ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
462ee303 127ALIROOTMODULES += Flugg
2830f9fb 128endif
b9d0a01d 129
8db084d0 130CERNMODULES := LHAPDF HIJING MICROCERN HERWIG
131
132ifneq ($(wildcard $(ROOTSYS)/include/TPythia6.h),)
133CERNMODULES += PYTHIA6
134endif
b9d0a01d 135
462ee303 136MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
b9d0a01d 137
138MODDIRS := $(MODULES)
139
462ee303 140#-------------------------------------------------------------------------------
141# Default include dirs for C++, Fortran, Cint, and dependencies
142# The module directory will be added by each module
b9d0a01d 143
19ca05d1 144GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
19ca05d1 145CXXFLAGS += $(GENINC)
146CXXFLAGSNO += $(GENINC)
147CINTFLAGS += $(GENINC)
148DEPINC += $(GENINC)
b9d0a01d 149
462ee303 150#-------------------------------------------------------------------------------
151# Libraries to link binaries against
152# Libraries will be linked against SHLIB
de6c7cfd 153# ROOT libraries
154
e9f631d2 155ROOTCLIBS := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO
b9d0a01d 156
3df2764f 157ROOTPLIBS := -lEGPythia6
de6c7cfd 158
159ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \
b384f8a4 160 -lITS -lPHOS -lACORDE -lHMPID -lVZERO -lZDC -lSTRUCT \
ababa197 161 -lT0 -lEVGEN -lSTEER
de6c7cfd 162
163LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS)
b9d0a01d 164
462ee303 165#-------------------------------------------------------------------------------
b9d0a01d 166# default target
462ee303 167
4dc83bdb 168default:
0693bbb3 169 $(MUTE)$(MAKE) aliroot
b9d0a01d 170
de6c7cfd 171FORCE:
172
462ee303 173#-------------------------------------------------------------------------------
174# Each module will add to these macros
b9d0a01d 175
176ALLLIBS :=
177ALLEXECS :=
178INCLUDEFILES :=
b934f194 179BINLIBS :=
180EXPORTFILES :=
b9d0a01d 181
462ee303 182#-------------------------------------------------------------------------------
8d7652bd 183# Dependencies of module.mk files if not cleaning
b9d0a01d 184
8ef0bd93 185ifeq ($(CLEAN),)
b9d0a01d 186include build/module.dep
8d7652bd 187endif
b9d0a01d 188
462ee303 189#-------------------------------------------------------------------------------
190# Check if module.mk is present for the library
191
5386b933 192%.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
b9d0a01d 193ifndef ALIQUIET
194 @echo "***** Creating $@ file *****";
195endif
196 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
b9d0a01d 197
462ee303 198#-------------------------------------------------------------------------------
462ee303 199# If making modules, not not include anything
b9d0a01d 200
bdfb9593 201ifeq ($(findstring modules,$(MAKECMDGOALS)),)
b9d0a01d 202
462ee303 203#-------------------------------------------------------------------------------
204# Include the modules
205
b934f194 206-include $(patsubst %,%/module.mk,$(MODULES))
b9d0a01d 207
462ee303 208#-------------------------------------------------------------------------------
bdfb9593 209# If cleaning, do not include dependencies or module.mk files.
210
211ifeq ($(CLEAN),)
212
213#-------------------------------------------------------------------------------
462ee303 214# Include dependencies if not making them!
b9d0a01d 215
462ee303 216ifneq ($(MAKECMDGOALS),depend)
9f1751e4 217ifneq ($(MAKECMDGOALS),)
462ee303 218
e3642d02 219ifeq (ALIVERBOSE,2)
462ee303 220$(warning INCLUDEFILES=$(INCLUDEFILES))
b9d0a01d 221endif
462ee303 222-include $(INCLUDEFILES)
b9d0a01d 223
224endif
225endif
462ee303 226endif
9f1751e4 227endif
462ee303 228
229#-------------------------------------------------------------------------------
230# Include dummy dependency file *MUST* be last includefile
b9d0a01d 231
b9d0a01d 232include build/dummy.d
b9d0a01d 233
234
462ee303 235#-------------------------------------------------------------------------------
236# Targets
b9d0a01d 237
2ea00b17 238.PHONY: alilibs aliroot makedistr clean distclean clean-all \
9f1751e4 239 htmldoc profile modules depend
b9d0a01d 240
b934f194 241modules: $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 242
2d8cad5a 243ifeq ($(ALIPROFILE),YES)
3a5e5a40 244alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
2d8cad5a 245else
3a5e5a40 246alilibs: $(LIBPATH) modules $(ALLLIBS)
2d8cad5a 247endif
41f6cf69 248
b8205a22 249aliroot: alilibs $(BINPATH) $(ALLEXECS)
9f1751e4 250
a6e3afe8 251ROOTALIBDIR=$(shell root-config --libdir)
252
253alimdc-static: $(LIBPATH) $(BINPATH) $(RAWDatabaseALIB) $(MDCALIB) $(ESDALIB) $(alimdcCXXO)
3c1a04dc 254 $(MUTE)rm -rf $(LIBPATH)/libAliMDC.a
255 $(MUTE)rm -rf junk
256 mkdir junk && cd junk && ar x ../$(RAWDatabaseALIB) && ar x ../$(MDCALIB) && ar x ../$(ESDALIB) && ar r ../$(LIBPATH)/libAliMDC.a *.o && cd .. && rm -rf junk
a6e3afe8 257 $(LD) $(LDFLAGS) -o $(BINPATH)/alimdca $(alimdcCXXO) \
258 $(LIBPATH)/libAliMDC.a \
259 $(ROOTALIBDIR)/libRoot.a \
260 $(ROOTALIBDIR)/libfreetype.a $(ROOTALIBDIR)/libpcre.a \
261 -ldl
5fdadcc5 262
e5f9749d 263alilibs-static: $(LIBPATH) modules $(ALLALIBS)
264
5fdadcc5 265include build/MakefileDA
266
462ee303 267#-------------------------------------------------------------------------------
b9d0a01d 268# Single Makefile "distribution": Makefile + modules + mkdepend scripts
b934f194 269makedistr: $(MODULES)
b9d0a01d 270 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
b934f194 271 Makefile create build/*
41f6cf69 272
b9d0a01d 273all: aliroot
41f6cf69 274
b934f194 275depend: $(INCLUDEFILES)
41f6cf69 276
b9d0a01d 277debug:
278ifndef ALIQUIET
279 @echo "***** Entering DEBUG mode. *****"
280endif
e1f602dc 281 @(export ALIDEBUG=YES && $(MAKE) aliroot)
b934f194 282
2d8cad5a 283profile:
284ifndef ALIQUIET
285 @echo "***** Entering PROFILE mode. *****"
286endif
e1f602dc 287 @(export ALIPROFILE=YES && $(MAKE) aliroot)
b934f194 288
b9d0a01d 289$(MODULES):
290ifndef ALIQUIET
291 @echo "***** Making $@ *****"
292endif
293 @mkdir -p $@
294
295$(BINPATH):
296ifndef ALIQUIET
297 @echo "***** Making $@ *****"
298endif
299 @mkdir -p $@
300
301$(LIBPATH):
302ifndef ALIQUIET
303 @echo "***** Making $@ *****"
304endif
305 @mkdir -p $@
306
307build/dummy.d: $(EXPORTFILES)
308 @(if [ ! -f $@ ] ; then \
309 touch $@; \
310 fi)
311
312clean:
2ea00b17 313 @echo "***** No target clean, use one of these *****"
b9d0a01d 314 @echo " clean-aliroot : Clean up all aliroot libraries"
315 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
316 @echo " clean-all : Cleans up everything, including cern libraires"
1aa44b64 317 @echo " distclean : Like clean-all + clean all tgt_*'s"
b934f194 318 @echo " clean-modules : Clean all module.mk files in all modules"
b9d0a01d 319 @echo " clean-libs : Clean all libraries (not object files)"
320 @echo "********************************************"
321
322clean-all: clean-modules clean-libs clean-bins
323ifndef ALIQUIET
324 @echo "***** Cleaning up everything ****"
325endif
326 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
327 $(MUTE)rm -rf $(EXPORTDIR)
328
2ea00b17 329distclean: clean-all
1aa44b64 330 $(MUTE)rm -rf */tgt_* bin lib
2ea00b17 331
462ee303 332#-------------------------------------------------------------------------------
333# This cleans only libraries that are not CERN-libraries
b9d0a01d 334
335clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
336
7e96fcc7 337CHECKMODULES := $(MODULES)
2900fa57 338CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
339CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
340CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
0b5dd071 341CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
af4ebdd2 342CHECKMODULES := $(filter-out LHAPDF,$(CHECKMODULES))
7e96fcc7 343CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
b9d0a01d 344
b934f194 345check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
b9d0a01d 346
5b0f3b29 347smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
348
b934f194 349reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
b9d0a01d 350
b934f194 351revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
b9d0a01d 352
118c0ae6 353smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
354
b9d0a01d 355clean-dicts:
356ifndef ALIQUIET
357 @echo "***** Cleaning up G__ files *****"
358endif
359 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
41f6cf69 360
b9d0a01d 361clean-modules:
362ifndef ALIQUIET
363 @echo "***** Cleaning up module.mk files *****"
364endif
b934f194 365 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 366
b9d0a01d 367clean-depend:
368ifndef ALIQUIET
369 @echo "***** Cleaning up dependencies *****"
370endif
371 $(MUTE)echo rm `find . -name "*.d"`
372
373clean-objects:
374ifndef ALIQUIET
375 @echo "***** Cleaning up .o files *****"
376endif
377 $(MUTE)echo rm `find . -name "*.o"`
378
379clean-libs:
380ifndef ALIQUIET
381 @echo "***** Cleaning up library files *****"
382endif
383 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
384
385clean-bins:
386ifndef ALIQUIET
387 @echo "***** Cleaning up binary files *****"
388endif
389 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
d7a221d0 390
b934f194 391clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
ba546cfd 392
5b0f3b29 393clean-smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-smell-%,$(CHECKMODULES))
394
b934f194 395clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
ba546cfd 396
d7a221d0 397htmldoc:
398 @rm -rf html/roothtml
399 @rm -f html/picts
400 @rm -f /tmp/macros
401 @cd html ;\
402 aliroot -q -b "mkhtml.C(0,1)" ;\
403 ls ../macros/*.C > /tmp/macros ;\
404 for i in $(ALIROOTMODULES) ; do \
405 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
406 done ;\
407 for i in `cat /tmp/macros` ; do \
408 echo $$i ; \
409 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
410 done ;\
411 ./makeExampleList ;
412 @ln -s ../picts html/picts
413 @ln -s ../../picts html/roothtml/picts
414 @ln -s ../../../picts html/roothtml/src/picts
415 @ln -s ../../../picts html/roothtml/examples/picts