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 include build/Makefile.config
17 ##################################################################
19 # Where to install libraries and binaries
20 # and common header files
22 LIBPATH=lib/tgt_$(ALICE_TARGET)
23 BINPATH=bin/tgt_$(ALICE_TARGET)
24 EXPORTDIR = $(ALICE_ROOT)/include
25 ##################################################################
27 ##################################################################
28 # include machine dependent macros
30 -include build/Makefile.$(ALICE_TARGET)
31 ##################################################################
33 ##################################################################
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%,$(CXXLAGS))
41 CFLAGS := -g $(filter-out -O%,$(CLAGS))
42 SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
43 LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
45 ##################################################################
47 ##################################################################
51 # COMMENTED OUT FOR TEST PURPOSES
53 ALIROOTMODULES:= STEER \
54 TGeant3 PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
55 CASTOR RICH START STRUCT EVGEN RALICE ALIFAST \
56 THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
59 GEANT4MODULES:= TGeant4 AliGeant4
60 ifeq ($(MAKECMDGOALS),geant4)
61 ALIROOTMODULES += $(GEANT4MODULES)
64 CERNMODULES:= PDF PYTHIA PYTHIA6 GEANT321 MINICERN HIJING
66 MODULES:=$(ALIROOTMODULES) $(CERNMODULES)
68 ##################################################################
74 #############################################################
76 # Default include dirs for
77 # C++, Fortran, Cint, and dependencies
78 # The module directory will be added by each module
81 CXXFLAGS += -I$(ALICE_ROOT)/include
82 CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
84 CINTFLAGS += -I$(ALICE_ROOT)/include
85 CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
87 DEPINC += -I$(ALICE_ROOT)/include
88 DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include)
89 #############################################################
92 #############################################################
94 # Libraries to link binaries against
95 # Libraries will be linked againstSHLIB
96 LIBS := $(ROOTLIBS) $(SYSLIBS) $(GLIBS)
97 #############################################################
101 default: alilibs aliroot
104 #############################################################
106 # Each module will add to this
113 #############################################################
115 BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
118 #Dependencies of module.mk files
120 include build/module.dep
122 #############################################################
124 # Check if module.mk is present for the library
125 %.mk: build/module.tpl
127 @echo "***** Creating $@ file *****";
129 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
130 #############################################################
132 # **************************************************************************
134 # If cleaning, do not include
135 # dependencies or module.mk files.
137 ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),)
139 # If making modules, not not include
142 ifneq ($(findstring modules,$(MAKECMDGOALS)),modules)
144 #############################################################
146 # Include the modules
147 -include $(patsubst %,%/module.mk,$(MODULES))
148 #############################################################
150 #############################################################
152 # include dependencies if not making them!
153 ifneq ($(MAKECMDGOALS),depend )
154 # Don't include if cleaning of any sort
155 ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
156 include $(INCLUDEFILES)
159 #############################################################
163 # **************************************************************************
165 #############################################################
167 # include dummy dependency file
168 # *MUST* be last includefile
169 include build/dummy.d
170 #############################################################
175 .PHONY: alilibs aliroot geant4 makedistr clean
177 modules: $(patsubst %,%/module.mk,$(MODULES))
179 geant4modules: $(patsubst %,%/module.mk,$(GEANT4MODULES))
181 aliroot: $(BINPATH) $(ALLEXECS) alilibs bin
185 alilibs: $(LIBPATH) $(ALLLIBS) lib modules
187 # Single Makefile "distribution": Makefile + modules + mkdepend scripts
188 makedistr: $(MODULES)
189 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
190 Makefile create build/*
194 depend: $(INCLUDEFILES)
198 @echo "***** Entering DEBUG mode. *****"
200 @(export ALIDEBUG=YES && $(MAKE) -f Makefile.flat )
203 @mkdir lib/tgt_$(ALICE_TARGET)
207 @mkdir bin/tgt_$(ALICE_TARGET)
211 @echo "***** Making $@ *****"
217 @echo "***** Making $@ *****"
223 @echo "***** Making $@ *****"
227 build/dummy.d: $(EXPORTFILES)
228 @(if [ ! -f $@ ] ; then \
233 @echo "***** No targen clean, use one of these *****"
234 @echo " clean-aliroot : Clean up all aliroot libraries"
235 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
236 @echo " clean-all : Cleans up everything, including cern libraires"
237 @echo " clean-modules : Clean all module.mk file in all modules"
238 @echo " clean-libs : Clean all libraries (not object files)"
239 @echo "********************************************"
241 clean-all: clean-modules clean-libs clean-bins
243 @echo "***** Cleaning up everything ****"
245 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
246 $(MUTE)rm -rf $(EXPORTDIR)
248 #This cleans only libraries that are not CERN-libraries
250 clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
254 @echo "***** Cleaning up G__ files *****"
256 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
260 @echo "***** Cleaning up module.mk files *****"
262 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
266 @echo "***** Cleaning up dependencies *****"
268 $(MUTE)echo rm `find . -name "*.d"`
272 @echo "***** Cleaning up .o files *****"
274 $(MUTE)echo rm `find . -name "*.o"`
278 @echo "***** Cleaning up library files *****"
280 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
284 @echo "***** Cleaning up binary files *****"
286 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)