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
7 ##### include general path/location macros #####
8 override ALICE_ROOT=$(shell pwd)
16 # IRST coding rule check
17 IRST_INSTALLDIR=$(ALICE)/local/IRST
18 CLASSPATH=$(IRST_INSTALLDIR)
19 export CLASSPATH IRST_INSTALLDIR
20 CODE_CHECK=java rules.ALICE.ALICERuleChecker
21 REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh
24 include build/Makefile.config
25 ##################################################################
27 # Where to install libraries and binaries
28 # and common header files
30 LIBPATH=lib/tgt_$(ALICE_TARGET)
31 BINPATH=bin/tgt_$(ALICE_TARGET)
32 EXPORTDIR = $(ALICE_ROOT)/include
33 ##################################################################
35 ##################################################################
36 # include machine dependent macros
38 -include build/Makefile.$(ALICE_TARGET)
39 ##################################################################
41 ##################################################################
43 # Check if called with debug
45 ifeq ($(ALIDEBUG),YES)
46 override ALICE_TARGET:=$(ALICE_TARGET)DEBUG
47 FFLAGS := -g $(filter-out -O%,$(FFLAGS))
48 CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS))
49 CFLAGS := -g $(filter-out -O%,$(CLAGS))
50 SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
51 LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
53 ##################################################################
55 ##################################################################
57 # Check if called with profile
59 ifeq ($(ALIPROFILE),YES)
60 override ALICE_TARGET:=$(ALICE_TARGET)PROF
67 ##################################################################
69 ##################################################################
73 # Uncomment to show some output
74 #$(warning MAKECMDGOALS=$(MAKECMDGOALS))
76 ALIROOTMODULES:= STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
77 CRT RICH START STRUCT EVGEN RALICE ALIFAST VZERO \
78 THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
79 THerwig TEPEMGEN EPEMGEN FASTSIM
81 CERNMODULES:= PDF PYTHIA PYTHIA6 HIJING MICROCERN HERWIG
83 MODULES:=$(ALIROOTMODULES) $(CERNMODULES)
85 ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
89 ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
93 ##################################################################
99 #############################################################
101 # Default include dirs for
102 # C++, Fortran, Cint, and dependencies
103 # The module directory will be added by each module
106 CXXFLAGS += -I$(ALICE_ROOT)/include
107 CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
109 CINTFLAGS += -I$(ALICE_ROOT)/include
110 CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
112 DEPINC += -I$(ALICE_ROOT)/include
113 DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include)
114 #############################################################
117 #############################################################
119 # Libraries to link binaries against
120 # Libraries will be linked againstSHLIB
121 LIBS := $(GLIBS) $(ROOTLIBS) $(SYSLIBS)
122 #############################################################
126 default: alilibs aliroot
129 #############################################################
131 # Each module will add to this
138 #############################################################
140 BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
143 #Dependencies of module.mk files
145 include build/module.dep
147 #############################################################
149 # Check if module.mk is present for the library
150 %.mk: build/module.tpl
152 @echo "***** Creating $@ file *****";
154 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
155 #############################################################
157 # **************************************************************************
159 # If cleaning, do not include
160 # dependencies or module.mk files.
162 ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),)
164 # If making modules, not not include
167 ifneq ($(findstring modules,$(MAKECMDGOALS)),modules)
169 #############################################################
171 # Include the modules
172 -include $(patsubst %,%/module.mk,$(MODULES))
176 #############################################################
178 #############################################################
180 # include dependencies if not making them!
181 ifneq ($(MAKECMDGOALS),depend )
182 # Don't include if cleaning of any sort
183 ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
184 #$(warning INCLUDEFILES=$(INCLUDEFILES))
185 include $(INCLUDEFILES)
188 #############################################################
192 # **************************************************************************
194 #############################################################
196 # include dummy dependency file
197 # *MUST* be last includefile
198 include build/dummy.d
199 #############################################################
204 .PHONY: alilibs aliroot makedistr clean htmldoc profile
206 modules: $(patsubst %,%/module.mk,$(MODULES))
209 aliroot: $(BINPATH) $(ALLEXECS) alilibs bin
211 ifeq ($(ALIPROFILE),YES)
212 alilibs: $(LIBPATH) $(ALLLIBS) $(ALLALIBS) lib modules
214 alilibs: $(LIBPATH) $(ALLLIBS) lib modules
217 # Single Makefile "distribution": Makefile + modules + mkdepend scripts
218 makedistr: $(MODULES)
219 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
220 Makefile create build/*
225 depend: $(INCLUDEFILES)
229 @echo "***** Entering DEBUG mode. *****"
231 @(export ALIDEBUG=YES && $(MAKE))
234 @echo "***** Entering PROFILE mode. *****"
236 @(export ALIPROFILE=YES && $(MAKE))
239 @mkdir lib/tgt_$(ALICE_TARGET)
243 @mkdir bin/tgt_$(ALICE_TARGET)
247 @echo "***** Making $@ *****"
253 @echo "***** Making $@ *****"
259 @echo "***** Making $@ *****"
263 build/dummy.d: $(EXPORTFILES)
264 @(if [ ! -f $@ ] ; then \
269 @echo "***** No targen clean, use one of these *****"
270 @echo " clean-aliroot : Clean up all aliroot libraries"
271 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
272 @echo " clean-all : Cleans up everything, including cern libraires"
273 @echo " clean-modules : Clean all module.mk file in all modules"
274 @echo " clean-libs : Clean all libraries (not object files)"
275 @echo "********************************************"
277 clean-all: clean-modules clean-libs clean-bins
279 @echo "***** Cleaning up everything ****"
281 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
282 $(MUTE)rm -rf $(EXPORTDIR)
284 #This cleans only libraries that are not CERN-libraries
286 clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
288 CHECKMODULES := $(ALIROOTMODULES)
289 CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
290 CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
291 CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
293 check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
295 reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
297 revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
301 @echo "***** Cleaning up G__ files *****"
303 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
307 @echo "***** Cleaning up module.mk files *****"
309 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
313 @echo "***** Cleaning up dependencies *****"
315 $(MUTE)echo rm `find . -name "*.d"`
319 @echo "***** Cleaning up .o files *****"
321 $(MUTE)echo rm `find . -name "*.o"`
325 @echo "***** Cleaning up library files *****"
327 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
331 @echo "***** Cleaning up binary files *****"
333 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
335 clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
337 clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
340 @rm -rf html/roothtml
344 aliroot -q -b "mkhtml.C(0,1)" ;\
345 ls ../macros/*.C > /tmp/macros ;\
346 for i in $(ALIROOTMODULES) ; do \
347 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
349 for i in `cat /tmp/macros` ; do \
351 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
354 @ln -s ../picts html/picts
355 @ln -s ../../picts html/roothtml/picts
356 @ln -s ../../../picts html/roothtml/src/picts
357 @ln -s ../../../picts html/roothtml/examples/picts