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
58 CERNMODULES:= PDF PYTHIA PYTHIA6 GEANT321 MINICERN HIJING
60 MODULES:=$(ALIROOTMODULES) $(CERNMODULES)
62 ##################################################################
68 #############################################################
70 # Default include dirs for
71 # C++, Fortran, Cint, and dependencies
72 # The module directory will be added by each module
75 CXXFLAGS += -I$(ALICE_ROOT)/include
76 CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
78 CINTFLAGS += -I$(ALICE_ROOT)/include
79 CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
81 DEPINC += -I$(ALICE_ROOT)/include
82 DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include)
83 #############################################################
86 #############################################################
88 # Libraries to link binaries against
89 # Libraries will be linked againstSHLIB
90 LIBS := $(ROOTLIBS) $(SYSLIBS) $(GLIBS)
91 #############################################################
95 default: alilibs aliroot
98 #############################################################
100 # Each module will add to this
107 #############################################################
109 BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
112 #Dependencies of module.mk files
114 include build/module.dep
116 #############################################################
118 # Check if module.mk is present for the library
119 %.mk: build/module.tpl
121 @echo "***** Creating $@ file *****";
123 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
124 #############################################################
126 # **************************************************************************
128 # If cleaning, do not include
129 # dependencies or module.mk files.
131 ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),)
133 # If making modules, not not include
136 ifneq ($(findstring modules,$(MAKECMDGOALS)),modules)
138 #############################################################
140 # Include the modules
141 -include $(patsubst %,%/module.mk,$(MODULES))
142 #############################################################
144 #############################################################
146 # include dependencies if not making them!
147 ifneq ($(MAKECMDGOALS),depend )
148 # Don't include if cleaning of any sort
149 ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
150 include $(INCLUDEFILES)
153 #############################################################
157 # **************************************************************************
159 #############################################################
161 # include dummy dependency file
162 # *MUST* be last includefile
163 include build/dummy.d
164 #############################################################
169 .PHONY: alilibs aliroot makedistr clean
171 modules: $(patsubst %,%/module.mk,$(MODULES))
173 aliroot: $(BINPATH) $(ALLEXECS) alilibs bin
175 alilibs: $(LIBPATH) $(ALLLIBS) lib modules
177 # Single Makefile "distribution": Makefile + modules + mkdepend scripts
178 makedistr: $(MODULES)
179 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
180 Makefile create build/*
184 depend: $(INCLUDEFILES)
188 @echo "***** Entering DEBUG mode. *****"
190 @(export ALIDEBUG=YES && $(MAKE) -f Makefile.flat )
193 @mkdir lib/tgt_$(ALICE_TARGET)
197 @mkdir bin/tgt_$(ALICE_TARGET)
201 @echo "***** Making $@ *****"
207 @echo "***** Making $@ *****"
213 @echo "***** Making $@ *****"
217 build/dummy.d: $(EXPORTFILES)
218 @(if [ ! -f $@ ] ; then \
223 @echo "***** No targen clean, use one of these *****"
224 @echo " clean-aliroot : Clean up all aliroot libraries"
225 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
226 @echo " clean-all : Cleans up everything, including cern libraires"
227 @echo " clean-modules : Clean all module.mk file in all modules"
228 @echo " clean-libs : Clean all libraries (not object files)"
229 @echo "********************************************"
231 clean-all: clean-modules clean-libs clean-bins
233 @echo "***** Cleaning up everything ****"
235 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
236 $(MUTE)rm -rf $(EXPORTDIR)
238 #This cleans only libraries that are not CERN-libraries
240 clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
244 @echo "***** Cleaning up G__ files *****"
246 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
250 @echo "***** Cleaning up module.mk files *****"
252 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
256 @echo "***** Cleaning up dependencies *****"
258 $(MUTE)echo rm `find . -name "*.d"`
262 @echo "***** Cleaning up .o files *****"
264 $(MUTE)echo rm `find . -name "*.o"`
268 @echo "***** Cleaning up library files *****"
270 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
274 @echo "***** Cleaning up binary files *****"
276 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)