1 # Top level Makefile for AliRoot System
3 # Author: Jan-Erik Revsbech (revsbech@fys.ku.dk)
4 # Developed on idea of Boris Polichtchouk (Boris.Polichtchouk@cern.ch), 15/4/2001
14 CLEAN=$(findstring clean,$(MAKECMDGOALS))
16 #-------------------------------------------------------------------------------
17 # IRST coding rule check
19 IRST_INSTALLDIR=$(ALICE)/local/IRST
20 IRST_CONFIG_DIR=$(IRST_INSTALLDIR)/userConfig/ALICE
21 CLASSPATH=$(IRST_INSTALLDIR)
22 export CLASSPATH IRST_INSTALLDIR IRST_CONFIG_DIR
23 CODE_CHECK=java rules.ALICE.ALICERuleChecker
24 REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh
26 SMELL_DETECTOR_DIR=$(IRST_INSTALLDIR)/smell-detector
29 #-------------------------------------------------------------------------------
30 # Include machine dependent macros
32 -include build/Makefile.$(ALICE_TARGET)
34 #-------------------------------------------------------------------------------
35 # Check if called with debug
37 ifeq ($(ALIDEBUG),YES)
38 override ALICE_TARGET := $(ALICE_TARGET)DEBUG
39 FFLAGS := -g $(filter-out -O%,$(FFLAGS))
40 CXXFLAGS := -g $(filter-out -O%,$(CXXFLAGS))
41 CFLAGS := -g $(filter-out -O%,$(CFLAGS))
42 SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
43 LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
46 #-------------------------------------------------------------------------------
47 # Check if called with profile
49 ifeq ($(ALIPROFILE),YES)
50 override ALICE_TARGET := $(ALICE_TARGET)PROF
58 #-------------------------------------------------------------------------------
59 # Check if DATE is installed
62 DATEFLAGS = -DALI_DATE -D${DATE_SYS} -DDATE_SYS=${DATE_SYS} -Dlong32=${DATE_LONG32} \
63 -Dlong64='${DATE_LONG64}' -DdatePointer=${DATE_POINTER} -I${DATE_COMMON_DEFS} -I${DATE_MONITOR_DIR}
64 CXXFLAGS += $(DATEFLAGS)
65 CFLAGS += $(DATEFLAGS)
66 CINTFLAGS += $(DATEFLAGS)
67 DEPINC += $(DATEFLAGS)
69 DATEFLAGS = -D`uname` -DDATE_SYS=`uname` -Dlong32='int' \
70 -Dlong64='long long' -DdatePointer='long'
71 CXXFLAGS += $(DATEFLAGS)
72 CFLAGS += $(DATEFLAGS)
73 CINTFLAGS += $(DATEFLAGS)
74 DEPINC += $(DATEFLAGS)
77 #-------------------------------------------------------------------------------
78 # Location where to install libraries and binaries and common header files
80 LIBPATH := lib/tgt_$(ALICE_TARGET)
81 BINPATH := bin/tgt_$(ALICE_TARGET)
82 EXPORTDIR := $(ALICE_ROOT)/include
83 BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
85 #-------------------------------------------------------------------------------
89 $(warning MAKECMDGOALS=$(MAKECMDGOALS))
92 ALIROOTMODULES := STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
93 ACORDE HMPID T0 STRUCT EVGEN RALICE VZERO \
94 THijing MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
95 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS \
96 JETAN HLT LHC ESDCheck
98 ifneq ($(wildcard $(ROOTSYS)/include/TGLIncludes.h),)
102 ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
103 ALIROOTMODULES += TFluka
106 ifeq ($(findstring PWG0,$(MAKECMDGOALS)),PWG0)
107 ALIROOTMODULES += PWG0
110 ifeq ($(findstring PWG2,$(MAKECMDGOALS)),PWG2)
111 ALIROOTMODULES += PWG2
114 ifeq ($(findstring PWG3,$(MAKECMDGOALS)),PWG3)
115 ALIROOTMODULES += PWG3
118 ifeq ($(findstring PWG4,$(MAKECMDGOALS)),PWG4)
119 ALIROOTMODULES += PWG4
122 ifeq ($(findstring SHUTTLE,$(MAKECMDGOALS)),SHUTTLE)
123 ALIROOTMODULES += SHUTTLE
126 ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
127 ALIROOTMODULES += Flugg
130 CERNMODULES := LHAPDF HIJING MICROCERN HERWIG
132 ifneq ($(wildcard $(ROOTSYS)/include/TPythia6.h),)
133 CERNMODULES += PYTHIA6
136 MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
138 MODDIRS := $(MODULES)
140 #-------------------------------------------------------------------------------
141 # Default include dirs for C++, Fortran, Cint, and dependencies
142 # The module directory will be added by each module
144 GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
145 CXXFLAGS += $(GENINC)
146 CXXFLAGSNO += $(GENINC)
147 CINTFLAGS += $(GENINC)
150 #-------------------------------------------------------------------------------
151 # Libraries to link binaries against
152 # Libraries will be linked against SHLIB
155 ROOTCLIBS := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO
157 ROOTPLIBS := -lEGPythia6
159 ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \
160 -lITS -lPHOS -lACORDE -lHMPID -lVZERO -lZDC -lSTRUCT \
163 LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS)
165 #-------------------------------------------------------------------------------
169 $(MUTE)$(MAKE) aliroot
173 #-------------------------------------------------------------------------------
174 # Each module will add to these macros
182 #-------------------------------------------------------------------------------
183 # Dependencies of module.mk files if not cleaning
186 include build/module.dep
189 #-------------------------------------------------------------------------------
190 # Check if module.mk is present for the library
192 %.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
194 @echo "***** Creating $@ file *****";
196 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
198 #-------------------------------------------------------------------------------
199 # If making modules, not not include anything
201 ifeq ($(findstring modules,$(MAKECMDGOALS)),)
203 #-------------------------------------------------------------------------------
204 # Include the modules
206 -include $(patsubst %,%/module.mk,$(MODULES))
208 #-------------------------------------------------------------------------------
209 # If cleaning, do not include dependencies or module.mk files.
213 #-------------------------------------------------------------------------------
214 # Include dependencies if not making them!
216 ifneq ($(MAKECMDGOALS),depend)
217 ifneq ($(MAKECMDGOALS),)
220 $(warning INCLUDEFILES=$(INCLUDEFILES))
222 -include $(INCLUDEFILES)
229 #-------------------------------------------------------------------------------
230 # Include dummy dependency file *MUST* be last includefile
232 include build/dummy.d
235 #-------------------------------------------------------------------------------
238 .PHONY: alilibs aliroot makedistr clean distclean clean-all \
239 htmldoc profile modules depend
241 modules: $(patsubst %,%/module.mk,$(MODULES))
243 ifeq ($(ALIPROFILE),YES)
244 alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
246 alilibs: $(LIBPATH) modules $(ALLLIBS)
249 aliroot: alilibs $(BINPATH) $(ALLEXECS)
251 ROOTALIBDIR=$(shell root-config --libdir)
253 alimdc-static: $(LIBPATH) $(BINPATH) $(RAWDatabaseALIB) $(MDCALIB) $(ESDALIB) $(alimdcCXXO)
254 $(MUTE)rm -rf $(LIBPATH)/libAliMDC.a
256 mkdir junk && cd junk && ar x ../$(RAWDatabaseALIB) && ar x ../$(MDCALIB) && ar x ../$(ESDALIB) && ar r ../$(LIBPATH)/libAliMDC.a *.o && cd .. && rm -rf junk
257 $(LD) $(LDFLAGS) -o $(BINPATH)/alimdca $(alimdcCXXO) \
258 $(LIBPATH)/libAliMDC.a \
259 $(ROOTALIBDIR)/libRoot.a \
260 $(ROOTALIBDIR)/libfreetype.a $(ROOTALIBDIR)/libpcre.a \
263 include build/MakefileDA
265 #-------------------------------------------------------------------------------
266 # Single Makefile "distribution": Makefile + modules + mkdepend scripts
267 makedistr: $(MODULES)
268 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
269 Makefile create build/*
273 depend: $(INCLUDEFILES)
277 @echo "***** Entering DEBUG mode. *****"
279 @(export ALIDEBUG=YES && $(MAKE) aliroot)
283 @echo "***** Entering PROFILE mode. *****"
285 @(export ALIPROFILE=YES && $(MAKE) aliroot)
289 @echo "***** Making $@ *****"
295 @echo "***** Making $@ *****"
301 @echo "***** Making $@ *****"
305 build/dummy.d: $(EXPORTFILES)
306 @(if [ ! -f $@ ] ; then \
311 @echo "***** No target clean, use one of these *****"
312 @echo " clean-aliroot : Clean up all aliroot libraries"
313 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
314 @echo " clean-all : Cleans up everything, including cern libraires"
315 @echo " distclean : Like clean-all + clean all tgt_*'s"
316 @echo " clean-modules : Clean all module.mk files in all modules"
317 @echo " clean-libs : Clean all libraries (not object files)"
318 @echo "********************************************"
320 clean-all: clean-modules clean-libs clean-bins
322 @echo "***** Cleaning up everything ****"
324 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
325 $(MUTE)rm -rf $(EXPORTDIR)
328 $(MUTE)rm -rf */tgt_* bin lib
330 #-------------------------------------------------------------------------------
331 # This cleans only libraries that are not CERN-libraries
333 clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
335 CHECKMODULES := $(MODULES)
336 CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
337 CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
338 CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
339 CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
340 CHECKMODULES := $(filter-out LHAPDF,$(CHECKMODULES))
341 CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
343 check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
345 smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
347 reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
349 revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
351 smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
355 @echo "***** Cleaning up G__ files *****"
357 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
361 @echo "***** Cleaning up module.mk files *****"
363 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
367 @echo "***** Cleaning up dependencies *****"
369 $(MUTE)echo rm `find . -name "*.d"`
373 @echo "***** Cleaning up .o files *****"
375 $(MUTE)echo rm `find . -name "*.o"`
379 @echo "***** Cleaning up library files *****"
381 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
385 @echo "***** Cleaning up binary files *****"
387 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
389 clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
391 clean-smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-smell-%,$(CHECKMODULES))
393 clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
396 @rm -rf html/roothtml
400 aliroot -q -b "mkhtml.C(0,1)" ;\
401 ls ../macros/*.C > /tmp/macros ;\
402 for i in $(ALIROOTMODULES) ; do \
403 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
405 for i in `cat /tmp/macros` ; do \
407 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
410 @ln -s ../picts html/picts
411 @ln -s ../../picts html/roothtml/picts
412 @ln -s ../../../picts html/roothtml/src/picts
413 @ln -s ../../../picts html/roothtml/examples/picts