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