Coding conventions
[u/mrichter/AliRoot.git] / Makefile.flat
CommitLineData
efaab2ef 1# Top level Makefile for AliRoot System
2#
3# Author: Jan-Erik Revsbech (revsbech@fys.ku.dk)
4# Developed on idea of Boris Polichtchouk (Boris.Polichtchouk@cern.ch), 15/4/2001
5
6
7##### include general path/location macros #####
8override ALICE_ROOT=$(shell pwd)
9
15142e2f 10ifdef ALIVERBOSE
11MUTE:=
12else
13MUTE:=@
14endif
15
efaab2ef 16include build/Makefile.config
f347de98 17##################################################################
18#
19# Where to install libraries and binaries
20# and common header files
efaab2ef 21
efaab2ef 22LIBPATH=lib/tgt_$(ALICE_TARGET)
23BINPATH=bin/tgt_$(ALICE_TARGET)
f347de98 24EXPORTDIR = $(ALICE_ROOT)/include
25##################################################################
efaab2ef 26
f347de98 27##################################################################
28# include machine dependent macros
efaab2ef 29
1092afea 30-include build/Makefile.$(ALICE_TARGET)
f347de98 31##################################################################
32
33##################################################################
34#
35# Check if called with debug
efaab2ef 36
efaab2ef 37ifeq ($(ALIDEBUG),YES)
38override ALICE_TARGET:=$(ALICE_TARGET)DEBUG
39FFLAGS := -g $(filter-out -O%,$(FFLAGS))
40CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS))
41CFLAGS := -g $(filter-out -O%,$(CLAGS))
a6e13297 42SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
43LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
efaab2ef 44endif
f347de98 45##################################################################
efaab2ef 46
f347de98 47##################################################################
efaab2ef 48#
f347de98 49# Modules to build
efaab2ef 50
896cb507 51# COMMENTED OUT FOR TEST PURPOSES
1092afea 52
53ALIROOTMODULES:= STEER \
f347de98 54 TGeant3 PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
55 CASTOR RICH START STRUCT EVGEN RALICE ALIFAST \
3634fea4 56 THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
57
58
59GEANT4MODULES:= TGeant4 AliGeant4
60ifeq ($(MAKECMDGOALS),geant4)
61ALIROOTMODULES += $(GEANT4MODULES)
62endif
896cb507 63
1092afea 64CERNMODULES:= PDF PYTHIA PYTHIA6 GEANT321 MINICERN HIJING
65
1092afea 66MODULES:=$(ALIROOTMODULES) $(CERNMODULES)
896cb507 67
f347de98 68##################################################################
efaab2ef 69
70MODULES += ALIROOT
71
72MODDIRS := MODULES
f347de98 73
74#############################################################
75#
76# Default include dirs for
77# C++, Fortran, Cint, and dependencies
78# The module directory will be added by each module
79#
80
f347de98 81CXXFLAGS += -I$(ALICE_ROOT)/include
efaab2ef 82CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
83
f347de98 84CINTFLAGS += -I$(ALICE_ROOT)/include
efaab2ef 85CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
86
f347de98 87DEPINC += -I$(ALICE_ROOT)/include
efaab2ef 88DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include)
f347de98 89#############################################################
efaab2ef 90
91
f347de98 92#############################################################
93#
94# Libraries to link binaries against
95# Libraries will be linked againstSHLIB
efaab2ef 96LIBS := $(ROOTLIBS) $(SYSLIBS) $(GLIBS)
f347de98 97#############################################################
efaab2ef 98
99
100# default target
101default: alilibs aliroot
102
f347de98 103
104#############################################################
105#
106# Each module will add to this
107
15142e2f 108ALLLIBS :=
109ALLEXECS :=
efaab2ef 110INCLUDEFILES :=
15142e2f 111BINLIBS :=
112EXPORTFILES :=
f347de98 113#############################################################
efaab2ef 114
15142e2f 115BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
1092afea 116
efaab2ef 117
118#Dependencies of module.mk files
119
120include build/module.dep
121
f347de98 122#############################################################
123#
124# Check if module.mk is present for the library
ba419e66 125%.mk: build/module.tpl
15142e2f 126ifndef ALIQUIET
efaab2ef 127 @echo "***** Creating $@ file *****";
15142e2f 128endif
896cb507 129 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
f347de98 130#############################################################
131
132# **************************************************************************
133#
134# If cleaning, do not include
135# dependencies or module.mk files.
efaab2ef 136
1092afea 137ifeq ($(findstring $(MAKECMDGOALS), clean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),)
efaab2ef 138
15142e2f 139# If making modules, not not include
896cb507 140# anything
141
142ifneq ($(findstring modules,$(MAKECMDGOALS)),modules)
143
f347de98 144#############################################################
145#
146# Include the modules
1092afea 147-include $(patsubst %,%/module.mk,$(MODULES))
f347de98 148#############################################################
efaab2ef 149
f347de98 150#############################################################
151#
152# include dependencies if not making them!
1092afea 153ifneq ($(MAKECMDGOALS),depend )
154# Don't include if cleaning of any sort
155ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
efaab2ef 156include $(INCLUDEFILES)
157endif
1092afea 158endif
f347de98 159#############################################################
efaab2ef 160
161endif
896cb507 162endif
f347de98 163# **************************************************************************
164
1092afea 165#############################################################
166#
167# include dummy dependency file
168# *MUST* be last includefile
169include build/dummy.d
170#############################################################
171
efaab2ef 172
173# targets
174
3634fea4 175.PHONY: alilibs aliroot geant4 makedistr clean
1092afea 176
896cb507 177modules: $(patsubst %,%/module.mk,$(MODULES))
178
3634fea4 179geant4modules: $(patsubst %,%/module.mk,$(GEANT4MODULES))
180
1092afea 181aliroot: $(BINPATH) $(ALLEXECS) alilibs bin
efaab2ef 182
3634fea4 183geant4: aliroot
184
1092afea 185alilibs: $(LIBPATH) $(ALLLIBS) lib modules
efaab2ef 186
187# Single Makefile "distribution": Makefile + modules + mkdepend scripts
188makedistr: $(MODULES)
189 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
190 Makefile create build/*
191
192all: aliroot
193
f347de98 194depend: $(INCLUDEFILES)
efaab2ef 195
196debug:
15142e2f 197ifndef ALIQUIET
efaab2ef 198 @echo "***** Entering DEBUG mode. *****"
15142e2f 199endif
efaab2ef 200 @(export ALIDEBUG=YES && $(MAKE) -f Makefile.flat )
201lib:
202 @mkdir lib
203 @mkdir lib/tgt_$(ALICE_TARGET)
204
205bin:
206 @mkdir bin
207 @mkdir bin/tgt_$(ALICE_TARGET)
208
209$(MODULES):
15142e2f 210ifndef ALIQUIET
efaab2ef 211 @echo "***** Making $@ *****"
15142e2f 212endif
213 @mkdir -p $@
efaab2ef 214
215$(BINPATH):
15142e2f 216ifndef ALIQUIET
efaab2ef 217 @echo "***** Making $@ *****"
15142e2f 218endif
219 @mkdir -p $@
efaab2ef 220
221$(LIBPATH):
15142e2f 222ifndef ALIQUIET
efaab2ef 223 @echo "***** Making $@ *****"
15142e2f 224endif
225 @mkdir -p $@
efaab2ef 226
1092afea 227build/dummy.d: $(EXPORTFILES)
228 @(if [ ! -f $@ ] ; then \
229 touch $@; \
230 fi)
231
232clean:
15142e2f 233 @echo "***** No targen clean, use one of these *****"
1092afea 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 "********************************************"
240
15142e2f 241clean-all: clean-modules clean-libs clean-bins
242ifndef ALIQUIET
efaab2ef 243 @echo "***** Cleaning up everything ****"
15142e2f 244endif
245 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
246 $(MUTE)rm -rf $(EXPORTDIR)
efaab2ef 247
1092afea 248#This cleans only libraries that are not CERN-libraries
249
250clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
efaab2ef 251
896cb507 252clean-dicts:
15142e2f 253ifndef ALIQUIET
f347de98 254 @echo "***** Cleaning up G__ files *****"
15142e2f 255endif
256 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
257
efaab2ef 258clean-modules:
15142e2f 259ifndef ALIQUIET
efaab2ef 260 @echo "***** Cleaning up module.mk files *****"
15142e2f 261endif
262 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
efaab2ef 263
264clean-depend:
15142e2f 265ifndef ALIQUIET
efaab2ef 266 @echo "***** Cleaning up dependencies *****"
15142e2f 267endif
268 $(MUTE)echo rm `find . -name "*.d"`
efaab2ef 269
270clean-objects:
15142e2f 271ifndef ALIQUIET
efaab2ef 272 @echo "***** Cleaning up .o files *****"
15142e2f 273endif
274 $(MUTE)echo rm `find . -name "*.o"`
efaab2ef 275
276clean-libs:
15142e2f 277ifndef ALIQUIET
efaab2ef 278 @echo "***** Cleaning up library files *****"
15142e2f 279endif
280 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
efaab2ef 281
282clean-bins:
15142e2f 283ifndef ALIQUIET
efaab2ef 284 @echo "***** Cleaning up binary files *****"
15142e2f 285endif
286 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)