introduce platform dependent Makefiles using names as provided by
[u/mrichter/AliRoot.git] / Makefile
CommitLineData
b9d0a01d 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
fe4da5cc 5
fe4da5cc 6
b9d0a01d 7##### include general path/location macros #####
8override ALICE_ROOT=$(shell pwd)
fe4da5cc 9
b9d0a01d 10ifdef ALIVERBOSE
11MUTE:=
12else
13MUTE:=@
14endif
fe4da5cc 15
b9d0a01d 16# IRST coding rule check
17IRST_INSTALLDIR=$(ALICE)/local/IRST
50a3b0ee 18IRST_CONFIG_DIR=$(IRST_INSTALLDIR)/userConfig/ALICE
b9d0a01d 19CLASSPATH=$(IRST_INSTALLDIR)
50a3b0ee 20export CLASSPATH IRST_INSTALLDIR IRST_CONFIG_DIR
b9d0a01d 21CODE_CHECK=java rules.ALICE.ALICERuleChecker
22REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh
fe4da5cc 23
fe4da5cc 24
b9d0a01d 25include build/Makefile.config
26##################################################################
27#
28# Where to install libraries and binaries
29# and common header files
47b969ba 30
b9d0a01d 31LIBPATH=lib/tgt_$(ALICE_TARGET)
32BINPATH=bin/tgt_$(ALICE_TARGET)
33EXPORTDIR = $(ALICE_ROOT)/include
34##################################################################
47b969ba 35
b9d0a01d 36##################################################################
37# include machine dependent macros
fe4da5cc 38
b9d0a01d 39-include build/Makefile.$(ALICE_TARGET)
40##################################################################
fe4da5cc 41
b9d0a01d 42##################################################################
43#
44# Check if called with debug
42865053 45
b9d0a01d 46ifeq ($(ALIDEBUG),YES)
47override ALICE_TARGET:=$(ALICE_TARGET)DEBUG
48FFLAGS := -g $(filter-out -O%,$(FFLAGS))
49CXXFLAGS := -g $(filter-out -O%,$(CXXLAGS))
50CFLAGS := -g $(filter-out -O%,$(CLAGS))
51SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
52LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
53endif
54##################################################################
fe4da5cc 55
2d8cad5a 56##################################################################
57#
58# Check if called with profile
59
60ifeq ($(ALIPROFILE),YES)
61override ALICE_TARGET:=$(ALICE_TARGET)PROF
62FFLAGS += -pg
63CXXFLAGS += -pg
64CFLAGS += -pg
65SOFLAGS += -pg
66LDFLAGS += -pg
67endif
68##################################################################
69
b8f3fa00 70##################################################################
71#
72# check if DATE is installed
73
74ifdef DATE_ROOT
75DATEFLAGS = -DALI_DATE -D${DATE_SYS} -DDATE_SYS=${DATE_SYS} -Dlong32=${DATE_LONG32} -Dlong64=${DATE_LONG64} -DdatePointer=${DATE_POINTER}
76CXXFLAGS += $(DATEFLAGS)
77CFLAGS += $(DATEFLAGS)
78CINTFLAGS += $(DATEFLAGS)
79DEPINC += $(DATEFLAGS)
0a1aa611 80endif
81##################################################################
82
b9d0a01d 83##################################################################
84#
85# Modules to build
fe4da5cc 86
b9d0a01d 87# Uncomment to show some output
88#$(warning MAKECMDGOALS=$(MAKECMDGOALS))
fe4da5cc 89
b9d0a01d 90ALIROOTMODULES:= STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
91 CRT RICH START STRUCT EVGEN RALICE ALIFAST VZERO \
92 THijing CONTAINERS MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
cfdc4533 93 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR DISPLAY ANALYSIS \
94 JETAN HLT
41f6cf69 95
c7fd5c1c 96CERNMODULES:= PDF PYTHIA6 HIJING MICROCERN HERWIG
b9d0a01d 97
98MODULES:=$(ALIROOTMODULES) $(CERNMODULES)
99
100ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
101MODULES += TFluka
102endif
103
2830f9fb 104ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
105MODULES += Flugg
106endif
b9d0a01d 107
108##################################################################
109
110MODULES += ALIROOT
111
112MODDIRS := $(MODULES)
113
114#############################################################
115#
116# Default include dirs for
117# C++, Fortran, Cint, and dependencies
118# The module directory will be added by each module
119#
120
121CXXFLAGS += -I$(ALICE_ROOT)/include
122CXXFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
123
124CINTFLAGS += -I$(ALICE_ROOT)/include
125CINTFLAGS += $(patsubst %,-I%,$(ROOTSYS)/include)
126
127DEPINC += -I$(ALICE_ROOT)/include
128DEPINC += $(patsubst %,-I%,$(ROOTSYS)/include)
129#############################################################
130
131
132#############################################################
133#
134# Libraries to link binaries against
135# Libraries will be linked againstSHLIB
136LIBS := $(GLIBS) $(ROOTLIBS) $(SYSLIBS)
137#############################################################
138
139
140# default target
141default: alilibs aliroot
142
143
144#############################################################
145#
146# Each module will add to this
147
148ALLLIBS :=
149ALLEXECS :=
150INCLUDEFILES :=
151BINLIBS :=
152EXPORTFILES :=
153#############################################################
154
155BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
156
157
158#Dependencies of module.mk files
159
160include build/module.dep
161
162#############################################################
163#
164# Check if module.mk is present for the library
165%.mk: build/module.tpl
166ifndef ALIQUIET
167 @echo "***** Creating $@ file *****";
168endif
169 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
170#############################################################
171
172# **************************************************************************
173#
174# If cleaning, do not include
175# dependencies or module.mk files.
176
2ea00b17 177ifeq ($(findstring $(MAKECMDGOALS), clean distclean clean-all clean-dicts clean-modules clean-depend clean-objects clean-libs clean-bins),)
b9d0a01d 178
179# If making modules, not not include
180# anything
181
182ifneq ($(findstring modules,$(MAKECMDGOALS)),modules)
183
184#############################################################
185#
186# Include the modules
187-include $(patsubst %,%/module.mk,$(MODULES))
188
189#
190#
191#############################################################
192
193#############################################################
194#
195# include dependencies if not making them!
196ifneq ($(MAKECMDGOALS),depend )
197# Don't include if cleaning of any sort
198ifneq ($(findstring clean,$(MAKECMDGOALS)),clean)
2830f9fb 199#$(warning INCLUDEFILES=$(INCLUDEFILES))
776dc587 200-include $(INCLUDEFILES)
b9d0a01d 201endif
202endif
203#############################################################
204
205endif
206endif
207# **************************************************************************
208
209#############################################################
210#
211# include dummy dependency file
212# *MUST* be last includefile
213include build/dummy.d
214#############################################################
215
216
217# targets
218
2ea00b17 219.PHONY: alilibs aliroot makedistr clean distclean clean-all \
220 htmldoc profile
b9d0a01d 221
222modules: $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 223
3e27ea2b 224
b9d0a01d 225aliroot: $(BINPATH) $(ALLEXECS) alilibs bin
3e27ea2b 226
2d8cad5a 227ifeq ($(ALIPROFILE),YES)
228alilibs: $(LIBPATH) $(ALLLIBS) $(ALLALIBS) lib modules
229else
b9d0a01d 230alilibs: $(LIBPATH) $(ALLLIBS) lib modules
2d8cad5a 231endif
41f6cf69 232
b9d0a01d 233# Single Makefile "distribution": Makefile + modules + mkdepend scripts
234makedistr: $(MODULES)
235 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
236 Makefile create build/*
41f6cf69 237
b9d0a01d 238all: aliroot
41f6cf69 239
240
b9d0a01d 241depend: $(INCLUDEFILES)
41f6cf69 242
b9d0a01d 243debug:
244ifndef ALIQUIET
245 @echo "***** Entering DEBUG mode. *****"
246endif
247 @(export ALIDEBUG=YES && $(MAKE))
2d8cad5a 248profile:
249ifndef ALIQUIET
250 @echo "***** Entering PROFILE mode. *****"
251endif
252 @(export ALIPROFILE=YES && $(MAKE))
b9d0a01d 253lib:
254 @mkdir lib
255 @mkdir lib/tgt_$(ALICE_TARGET)
256
257bin:
258 @mkdir bin
259 @mkdir bin/tgt_$(ALICE_TARGET)
260
261$(MODULES):
262ifndef ALIQUIET
263 @echo "***** Making $@ *****"
264endif
265 @mkdir -p $@
266
267$(BINPATH):
268ifndef ALIQUIET
269 @echo "***** Making $@ *****"
270endif
271 @mkdir -p $@
272
273$(LIBPATH):
274ifndef ALIQUIET
275 @echo "***** Making $@ *****"
276endif
277 @mkdir -p $@
278
279build/dummy.d: $(EXPORTFILES)
280 @(if [ ! -f $@ ] ; then \
281 touch $@; \
282 fi)
283
284clean:
2ea00b17 285 @echo "***** No target clean, use one of these *****"
b9d0a01d 286 @echo " clean-aliroot : Clean up all aliroot libraries"
287 @echo " clean-MODULENAME : Clean everything from module MODULENAME"
288 @echo " clean-all : Cleans up everything, including cern libraires"
2ea00b17 289 @echo " distclean : Idem clean-all"
b9d0a01d 290 @echo " clean-modules : Clean all module.mk file in all modules"
291 @echo " clean-libs : Clean all libraries (not object files)"
292 @echo "********************************************"
293
294clean-all: clean-modules clean-libs clean-bins
295ifndef ALIQUIET
296 @echo "***** Cleaning up everything ****"
297endif
298 $(MUTE)rm -rf $(patsubst %,%/tgt_$(ALICE_TARGET),$(MODULES))
299 $(MUTE)rm -rf $(EXPORTDIR)
300
2ea00b17 301distclean: clean-all
302
b9d0a01d 303#This cleans only libraries that are not CERN-libraries
304
305clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
306
7e96fcc7 307CHECKMODULES := $(MODULES)
2900fa57 308CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
309CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
310CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
0b5dd071 311CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
7e96fcc7 312CHECKMODULES := $(filter-out PDF,$(CHECKMODULES))
313CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
b9d0a01d 314
315check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
316
317reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
318
319revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
320
321clean-dicts:
322ifndef ALIQUIET
323 @echo "***** Cleaning up G__ files *****"
324endif
325 $(MUTE)rm -rf */tgt_$(ALICE_TARGET)/G__*
41f6cf69 326
b9d0a01d 327clean-modules:
328ifndef ALIQUIET
329 @echo "***** Cleaning up module.mk files *****"
330endif
331 $(MUTE)rm -rf $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 332
b9d0a01d 333clean-depend:
334ifndef ALIQUIET
335 @echo "***** Cleaning up dependencies *****"
336endif
337 $(MUTE)echo rm `find . -name "*.d"`
338
339clean-objects:
340ifndef ALIQUIET
341 @echo "***** Cleaning up .o files *****"
342endif
343 $(MUTE)echo rm `find . -name "*.o"`
344
345clean-libs:
346ifndef ALIQUIET
347 @echo "***** Cleaning up library files *****"
348endif
349 $(MUTE)rm -rf lib/tgt_$(ALICE_TARGET)/*
350
351clean-bins:
352ifndef ALIQUIET
353 @echo "***** Cleaning up binary files *****"
354endif
355 $(MUTE)rm -rf bin/tgt_$(ALICE_TARGET)
d7a221d0 356
ba546cfd 357clean-check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-check-%,$(CHECKMODULES))
358
359clean-reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,clean-reveng-%,$(CHECKMODULES))
360
d7a221d0 361htmldoc:
362 @rm -rf html/roothtml
363 @rm -f html/picts
364 @rm -f /tmp/macros
365 @cd html ;\
366 aliroot -q -b "mkhtml.C(0,1)" ;\
367 ls ../macros/*.C > /tmp/macros ;\
368 for i in $(ALIROOTMODULES) ; do \
369 ls ../$$i/*.C 2>/dev/null >> /tmp/macros ;\
370 done ;\
371 for i in `cat /tmp/macros` ; do \
372 echo $$i ; \
373 aliroot -b -q "mkhtml.C(\"$$i\")" > /dev/null ;\
374 done ;\
375 ./makeExampleList ;
376 @ln -s ../picts html/picts
377 @ln -s ../../picts html/roothtml/picts
378 @ln -s ../../../picts html/roothtml/src/picts
379 @ln -s ../../../picts html/roothtml/examples/picts