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 IRST_CONFIG_DIR=$(IRST_INSTALLDIR)/userConfig/ALICE
19 CLASSPATH=$(IRST_INSTALLDIR)
20 export CLASSPATH IRST_INSTALLDIR IRST_CONFIG_DIR
21 CODE_CHECK=java rules.ALICE.ALICERuleChecker
22 REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh
25 include build/Makefile.config
26 ##################################################################
28 # Where to install libraries and binaries
29 # and common header files
31 LIBPATH=lib/tgt_$(ALICE_TARGET)
32 BINPATH=bin/tgt_$(ALICE_TARGET)
33 EXPORTDIR = $(ALICE_ROOT)/include
34 ##################################################################
36 ##################################################################
37 # include machine dependent macros
39 -include build/Makefile.$(ALICE_TARGET)
40 ##################################################################
42 ##################################################################
44 # Check if called with debug
46 ifeq ($(ALIDEBUG),YES)
47 override ALICE_TARGET:=$(ALICE_TARGET)DEBUG
48 FFLAGS := -g $(filter-out -O%,$(FFLAGS))
49 CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS))
50 CFLAGS := -g $(filter-out -O%,$(CLAGS))
51 SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
52 LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
54 ##################################################################
56 ##################################################################
58 # Check if called with profile
60 ifeq ($(ALIPROFILE),YES)
61 override ALICE_TARGET:=$(ALICE_TARGET)PROF
68 ##################################################################
70 ##################################################################
74 # Uncomment to show some output
75 #$(warning MAKECMDGOALS=$(MAKECMDGOALS))
77 ALIROOTMODULES:= STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
78 CRT RICH START STRUCT EVGEN RALICE ALIFAST VZERO \
79 THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
80 THerwig TEPEMGEN EPEMGEN FASTSIM
82 CERNMODULES:= PDF PYTHIA PYTHIA6 HIJING MICROCERN HERWIG
84 MODULES:=$(ALIROOTMODULES) $(CERNMODULES)
86 ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
90 ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
94 ##################################################################
100 #############################################################
102 # Default include dirs for
103 # C++, Fortran, Cint, and dependencies
104 # The module directory will be added by each module
107 CXXFLAGS += -I$(ALICE_ROOT)/include
108 CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
110 CINTFLAGS += -I$(ALICE_ROOT)/include
111 CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
113 DEPINC += -I$(ALICE_ROOT)/include
114 DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include)
115 #############################################################
118 #############################################################
120 # Libraries to link binaries against
121 # Libraries will be linked againstSHLIB
122 LIBS := $(GLIBS) $(ROOTLIBS) $(SYSLIBS)
123 #############################################################
127 default: alilibs aliroot
130 #############################################################
132 # Each module will add to this
139 #############################################################
141 BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
144 #Dependencies of module.mk files
146 include build/module.dep
148 #############################################################
150 # Check if module.mk is present for the library
151 %.mk: build/module.tpl
153 @echo "***** Creating $@ file *****";
155 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
156 #############################################################
158 # **************************************************************************
160 # If cleaning, do not include
161 # dependencies or module.mk files.
163 ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),)
165 # If making modules, not not include
168 ifneq ($(findstring modules,$(MAKECMDGOALS)),modules)
170 #############################################################
172 # Include the modules
173 -include $(patsubst %,%/module.mk,$(MODULES))
177 #############################################################
179 #############################################################
181 # include dependencies if not making them!
182 ifneq ($(MAKECMDGOALS),depend )
183 # Don't include if cleaning of any sort
184 ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
185 #$(warning INCLUDEFILES=$(INCLUDEFILES))
186 include $(INCLUDEFILES)
189 #############################################################
193 # **************************************************************************
195 #############################################################
197 # include dummy dependency file
198 # *MUST* be last includefile
199 include build/dummy.d
200 #############################################################
205 .PHONY: alilibs aliroot makedistr clean htmldoc profile
207 modules: $(patsubst %,%/module.mk,$(MODULES))
210 aliroot: $(BINPATH) $(ALLEXECS) alilibs bin
212 ifeq ($(ALIPROFILE),YES)
213 alilibs: $(LIBPATH) $(ALLLIBS) $(ALLALIBS) lib modules
215 alilibs: $(LIBPATH) $(ALLLIBS) lib modules
218 # Single Makefile "distribution": Makefile + modules + mkdepend scripts
219 makedistr: $(MODULES)
220 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
221 Makefile create build/*
226 depend: $(INCLUDEFILES)
230 @echo "***** Entering DEBUG mode. *****"
232 @(export ALIDEBUG=YES && $(MAKE))
235 @echo "***** Entering PROFILE mode. *****"
237 @(export ALIPROFILE=YES && $(MAKE))
240 @mkdir lib/tgt_$(ALICE_TARGET)
244 @mkdir bin/tgt_$(ALICE_TARGET)
248 @echo "***** Making $@ *****"
254 @echo "***** Making $@ *****"
260 @echo "***** Making $@ *****"
264 build/dummy.d: $(EXPORTFILES)
265 @(if [ ! -f $@ ] ; then \
270 @echo "***** No targen clean, use one of these *****"
271 @echo " clean-aliroot : Clean up all aliroot libraries"
272 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
273 @echo " clean-all : Cleans up everything, including cern libraires"
274 @echo " clean-modules : Clean all module.mk file in all modules"
275 @echo " clean-libs : Clean all libraries (not object files)"
276 @echo "********************************************"
278 clean-all: clean-modules clean-libs clean-bins
280 @echo "***** Cleaning up everything ****"
282 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
283 $(MUTE)rm -rf $(EXPORTDIR)
285 #This cleans only libraries that are not CERN-libraries
287 clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
289 CHECKMODULES := $(ALIROOTMODULES)
290 CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
291 CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
292 CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
294 check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
296 reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
298 revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
302 @echo "***** Cleaning up G__ files *****"
304 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
308 @echo "***** Cleaning up module.mk files *****"
310 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
314 @echo "***** Cleaning up dependencies *****"
316 $(MUTE)echo rm `find . -name "*.d"`
320 @echo "***** Cleaning up .o files *****"
322 $(MUTE)echo rm `find . -name "*.o"`
326 @echo "***** Cleaning up library files *****"
328 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
332 @echo "***** Cleaning up binary files *****"
334 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
336 clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
338 clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
341 @rm -rf html/roothtml
345 aliroot -q -b "mkhtml.C(0,1)" ;\
346 ls ../macros/*.C > /tmp/macros ;\
347 for i in $(ALIROOTMODULES) ; do \
348 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
350 for i in `cat /tmp/macros` ; do \
352 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
355 @ln -s ../picts html/picts
356 @ln -s ../../picts html/roothtml/picts
357 @ln -s ../../../picts html/roothtml/src/picts
358 @ln -s ../../../picts html/roothtml/examples/picts