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,$(patsubst %clean%,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 #-------------------------------------------------------------------------------
27 # Include library definition
29 include build/Makefile.config
31 #-------------------------------------------------------------------------------
32 # Location where to install libraries and binaries and common header files
34 LIBPATH := lib/tgt_$(ALICE_TARGET)
35 BINPATH := bin/tgt_$(ALICE_TARGET)
36 EXPORTDIR := $(ALICE_ROOT)/include
37 BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
39 #-------------------------------------------------------------------------------
40 # Include machine dependent macros
42 -include build/Makefile.$(ALICE_TARGET)
44 #-------------------------------------------------------------------------------
45 # Check if called with debug
47 ifeq ($(ALIDEBUG),YES)
48 override ALICE_TARGET := $(ALICE_TARGET)DEBUG
49 FFLAGS := -g $(filter-out -O%,$(FFLAGS))
50 CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS))
51 CFLAGS := -g $(filter-out -O%,$(CLAGS))
52 SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
53 LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
56 #-------------------------------------------------------------------------------
57 # Check if called with profile
59 ifeq ($(ALIPROFILE),YES)
60 override ALICE_TARGET := $(ALICE_TARGET)PROF
68 #-------------------------------------------------------------------------------
69 # Check if DATE is installed
72 DATEFLAGS = -DALI_DATE -D${DATE_SYS} -DDATE_SYS=${DATE_SYS} -Dlong32=${DATE_LONG32} \
73 -Dlong64=${DATE_LONG64} -DdatePointer=${DATE_POINTER}
74 CXXFLAGS += $(DATEFLAGS)
75 CFLAGS += $(DATEFLAGS)
76 CINTFLAGS += $(DATEFLAGS)
77 DEPINC += $(DATEFLAGS)
80 #-------------------------------------------------------------------------------
84 $(warning MAKECMDGOALS=$(MAKECMDGOALS))
87 ALIROOTMODULES := STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
88 CRT RICH START STRUCT EVGEN RALICE ALIFAST VZERO \
89 THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
90 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR DISPLAY ANALYSIS \
93 ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
94 ALIROOTMODULES += TFluka
97 ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
98 ALIROOTMODULES += Flugg
101 CERNMODULES := PDF PYTHIA6 HIJING MICROCERN HERWIG
103 MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
105 MODDIRS := $(MODULES)
107 #-------------------------------------------------------------------------------
108 # Default include dirs for C++, Fortran, Cint, and dependencies
109 # The module directory will be added by each module
111 GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
112 CXXFLAGS += $(GENINC)
113 CXXFLAGSNO += $(GENINC)
114 CINTFLAGS += $(GENINC)
117 #-------------------------------------------------------------------------------
118 # Libraries to link binaries against
119 # Libraries will be linked against SHLIB
121 LIBS := $(GLIBS) $(ROOTLIBS) $(SYSLIBS)
123 #-------------------------------------------------------------------------------
128 #-------------------------------------------------------------------------------
129 # Each module will add to these macros
137 #-------------------------------------------------------------------------------
138 # Dependencies of module.mk files
140 include build/module.dep
142 #-------------------------------------------------------------------------------
143 # Check if module.mk is present for the library
145 %.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
147 @echo "***** Creating $@ file *****";
149 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
151 #-------------------------------------------------------------------------------
152 # If making modules, not not include anything
154 ifeq ($(findstring modules,$(MAKECMDGOALS)),)
156 #-------------------------------------------------------------------------------
157 # Include the modules
159 -include $(patsubst %,%/module.mk,$(MODULES))
161 #-------------------------------------------------------------------------------
162 # If cleaning, do not include dependencies or module.mk files.
166 #-------------------------------------------------------------------------------
167 # Include dependencies if not making them!
169 ifneq ($(MAKECMDGOALS),depend)
170 ifneq ($(MAKECMDGOALS),)
173 $(warning INCLUDEFILES=$(INCLUDEFILES))
175 -include $(INCLUDEFILES)
182 #-------------------------------------------------------------------------------
183 # Include dummy dependency file *MUST* be last includefile
185 include build/dummy.d
188 #-------------------------------------------------------------------------------
191 .PHONY: alilibs aliroot makedistr clean distclean clean-all \
192 htmldoc profile modules depend
194 modules: $(patsubst %,%/module.mk,$(MODULES))
196 ifeq ($(ALIPROFILE),YES)
197 alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
199 alilibs: $(LIBPATH) modules $(ALLLIBS)
202 aliroot: alilibs $(BINPATH) $(ALLEXECS)
204 #-------------------------------------------------------------------------------
205 # Single Makefile "distribution": Makefile + modules + mkdepend scripts
206 makedistr: $(MODULES)
207 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
208 Makefile create build/*
212 depend: $(INCLUDEFILES)
216 @echo "***** Entering DEBUG mode. *****"
218 @(export ALIDEBUG=YES && $(MAKE))
222 @echo "***** Entering PROFILE mode. *****"
224 @(export ALIPROFILE=YES && $(MAKE))
228 @echo "***** Making $@ *****"
234 @echo "***** Making $@ *****"
240 @echo "***** Making $@ *****"
244 build/dummy.d: $(EXPORTFILES)
245 @(if [ ! -f $@ ] ; then \
250 @echo "***** No target clean, use one of these *****"
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"
254 @echo " distclean : Like clean-all + clean all tgt_*'s"
255 @echo " clean-modules : Clean all module.mk files in all modules"
256 @echo " clean-libs : Clean all libraries (not object files)"
257 @echo "********************************************"
259 clean-all: clean-modules clean-libs clean-bins
261 @echo "***** Cleaning up everything ****"
263 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
264 $(MUTE)rm -rf $(EXPORTDIR)
267 $(MUTE)rm -rf */tgt_* bin lib
269 #-------------------------------------------------------------------------------
270 # This cleans only libraries that are not CERN-libraries
272 clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
274 CHECKMODULES := $(MODULES)
275 CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
276 CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
277 CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
278 CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
279 CHECKMODULES := $(filter-out PDF,$(CHECKMODULES))
280 CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
282 check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
284 reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
286 revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
290 @echo "***** Cleaning up G__ files *****"
292 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
296 @echo "***** Cleaning up module.mk files *****"
298 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
302 @echo "***** Cleaning up dependencies *****"
304 $(MUTE)echo rm `find . -name "*.d"`
308 @echo "***** Cleaning up .o files *****"
310 $(MUTE)echo rm `find . -name "*.o"`
314 @echo "***** Cleaning up library files *****"
316 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
320 @echo "***** Cleaning up binary files *****"
322 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
324 clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
326 clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
329 @rm -rf html/roothtml
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 ;\
338 for i in `cat /tmp/macros` ; do \
340 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
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