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