Adding Makefile in the PWG2 module. This makefile will be used for the creation of...
[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
462ee303 6# /* $Id$ */
fe4da5cc 7
b9d0a01d 8ifdef ALIVERBOSE
9MUTE:=
10else
11MUTE:=@
12endif
fe4da5cc 13
8d7652bd 14CLEAN=$(findstring clean,$(MAKECMDGOALS))
bdfb9593 15
462ee303 16#-------------------------------------------------------------------------------
b9d0a01d 17# IRST coding rule check
462ee303 18
b9d0a01d 19IRST_INSTALLDIR=$(ALICE)/local/IRST
50a3b0ee 20IRST_CONFIG_DIR=$(IRST_INSTALLDIR)/userConfig/ALICE
b9d0a01d 21CLASSPATH=$(IRST_INSTALLDIR)
50a3b0ee 22export CLASSPATH IRST_INSTALLDIR IRST_CONFIG_DIR
b9d0a01d 23CODE_CHECK=java rules.ALICE.ALICERuleChecker
24REV_ENG=$(IRST_INSTALLDIR)/scripts/revEng.sh
fe4da5cc 25
118c0ae6 26SMELL_DETECTOR_DIR=$(ALICE)/smell-detector
27
28
462ee303 29#-------------------------------------------------------------------------------
462ee303 30# Include machine dependent macros
fe4da5cc 31
b9d0a01d 32-include build/Makefile.$(ALICE_TARGET)
fe4da5cc 33
462ee303 34#-------------------------------------------------------------------------------
35# Check if called with debug
42865053 36
b9d0a01d 37ifeq ($(ALIDEBUG),YES)
b934f194 38override ALICE_TARGET := $(ALICE_TARGET)DEBUG
39FFLAGS := -g $(filter-out -O%,$(FFLAGS))
4448d4ac 40CXXFLAGS := -g $(filter-out -O%,$(CXXFLAGS))
41CFLAGS := -g $(filter-out -O%,$(CFLAGS))
b934f194 42SOFLAGS := -g $(filter-out -O%,$(SOFLAGS))
43LDFLAGS := -g $(filter-out -O%,$(LDFLAGS))
b9d0a01d 44endif
fe4da5cc 45
462ee303 46#-------------------------------------------------------------------------------
47# Check if called with profile
2d8cad5a 48
49ifeq ($(ALIPROFILE),YES)
b934f194 50override ALICE_TARGET := $(ALICE_TARGET)PROF
51FFLAGS += -pg
2d8cad5a 52CXXFLAGS += -pg
b934f194 53CFLAGS += -pg
54SOFLAGS += -pg
55LDFLAGS += -pg
2d8cad5a 56endif
2d8cad5a 57
462ee303 58#-------------------------------------------------------------------------------
59# Check if DATE is installed
b8f3fa00 60
61ifdef DATE_ROOT
462ee303 62DATEFLAGS = -DALI_DATE -D${DATE_SYS} -DDATE_SYS=${DATE_SYS} -Dlong32=${DATE_LONG32} \
bf25155c 63 -Dlong64='${DATE_LONG64}' -DdatePointer=${DATE_POINTER} -I${DATE_COMMON_DEFS}
b934f194 64CXXFLAGS += $(DATEFLAGS)
65CFLAGS += $(DATEFLAGS)
b8f3fa00 66CINTFLAGS += $(DATEFLAGS)
e506ace2 67DEPINC += $(DATEFLAGS)
68else
8c50acf2 69DATEFLAGS = -D`uname` -DDATE_SYS=`uname` -Dlong32='int' \
e506ace2 70 -Dlong64='long long' -DdatePointer='long'
71CXXFLAGS += $(DATEFLAGS)
72CFLAGS += $(DATEFLAGS)
73CINTFLAGS += $(DATEFLAGS)
b934f194 74DEPINC += $(DATEFLAGS)
0a1aa611 75endif
0a1aa611 76
462ee303 77#-------------------------------------------------------------------------------
e44bc3df 78# Location where to install libraries and binaries and common header files
79
80LIBPATH := lib/tgt_$(ALICE_TARGET)
81BINPATH := bin/tgt_$(ALICE_TARGET)
82EXPORTDIR := $(ALICE_ROOT)/include
83BINLIBDIRS := -L$(ALICE_ROOT)/$(LIBPATH)
84
85#-------------------------------------------------------------------------------
462ee303 86# Modules to build
fe4da5cc 87
e3642d02 88ifeq (ALIVERBOSE,2)
462ee303 89$(warning MAKECMDGOALS=$(MAKECMDGOALS))
90endif
fe4da5cc 91
b934f194 92ALIROOTMODULES := STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS \
b9d0a01d 93 CRT RICH START STRUCT EVGEN RALICE ALIFAST VZERO \
e756ece8 94 THijing MEVSIM TMEVSIM THbtp HBTP EMCAL HBTAN \
cfdc4533 95 THerwig TEPEMGEN EPEMGEN FASTSIM TPHIC RAW MONITOR DISPLAY ANALYSIS \
521bebb4 96 JETAN HLT LHC EVE
41f6cf69 97
b9d0a01d 98ifeq ($(findstring TFluka,$(MAKECMDGOALS)),TFluka)
462ee303 99ALIROOTMODULES += TFluka
b9d0a01d 100endif
101
18d2e4ee 102ifeq ($(findstring PWG0,$(MAKECMDGOALS)),PWG0)
103ALIROOTMODULES += PWG0
104endif
105
04d2c4d5 106ifeq ($(findstring PWG2,$(MAKECMDGOALS)),PWG2)
107ALIROOTMODULES += PWG2
108endif
109
f3fc258a 110ifeq ($(findstring PWG3,$(MAKECMDGOALS)),PWG3)
111ALIROOTMODULES += PWG3
112endif
113
18d2e4ee 114ifeq ($(findstring SHUTTLE,$(MAKECMDGOALS)),SHUTTLE)
115ALIROOTMODULES += SHUTTLE
116endif
117
2830f9fb 118ifeq ($(findstring Flugg,$(MAKECMDGOALS)),Flugg)
462ee303 119ALIROOTMODULES += Flugg
2830f9fb 120endif
b9d0a01d 121
462ee303 122CERNMODULES := PDF PYTHIA6 HIJING MICROCERN HERWIG
b9d0a01d 123
462ee303 124MODULES := $(ALIROOTMODULES) $(CERNMODULES) ALIROOT
b9d0a01d 125
126MODDIRS := $(MODULES)
127
462ee303 128#-------------------------------------------------------------------------------
129# Default include dirs for C++, Fortran, Cint, and dependencies
130# The module directory will be added by each module
b9d0a01d 131
19ca05d1 132GENINC := -I$(ALICE_ROOT)/include -I$(shell root-config --incdir)
19ca05d1 133CXXFLAGS += $(GENINC)
134CXXFLAGSNO += $(GENINC)
135CINTFLAGS += $(GENINC)
136DEPINC += $(GENINC)
b9d0a01d 137
462ee303 138#-------------------------------------------------------------------------------
139# Libraries to link binaries against
140# Libraries will be linked against SHLIB
de6c7cfd 141# ROOT libraries
142
3df2764f 143ROOTCLIBS := $(shell root-config --glibs) -lThread -lMinuit -lHtml -lVMC -lEG -lGeom
b9d0a01d 144
3df2764f 145ROOTPLIBS := -lEGPythia6
de6c7cfd 146
147ALILIBS := -L$(LIBDIR) -lMUON -lTPC -lPMD -lTRD -lFMD -lTOF \
148 -lITS -lPHOS -lCRT -lRICH -lVZERO -lZDC -lSTRUCT \
e756ece8 149 -lSTART -lEVGEN -lSTEER
de6c7cfd 150
151LIBS := $(ROOTCLIBS) $(ROOTPLIBS) $(SYSLIBS)
b9d0a01d 152
462ee303 153#-------------------------------------------------------------------------------
b9d0a01d 154# default target
462ee303 155
4dc83bdb 156default:
0693bbb3 157 $(MUTE)$(MAKE) aliroot
b9d0a01d 158
de6c7cfd 159FORCE:
160
462ee303 161#-------------------------------------------------------------------------------
162# Each module will add to these macros
b9d0a01d 163
164ALLLIBS :=
165ALLEXECS :=
166INCLUDEFILES :=
b934f194 167BINLIBS :=
168EXPORTFILES :=
b9d0a01d 169
462ee303 170#-------------------------------------------------------------------------------
8d7652bd 171# Dependencies of module.mk files if not cleaning
b9d0a01d 172
8ef0bd93 173ifeq ($(CLEAN),)
b9d0a01d 174include build/module.dep
8d7652bd 175endif
b9d0a01d 176
462ee303 177#-------------------------------------------------------------------------------
178# Check if module.mk is present for the library
179
5386b933 180%.mk: build/module.tpl build/header.tpl build/clean.tpl share/alibtool
b9d0a01d 181ifndef ALIQUIET
182 @echo "***** Creating $@ file *****";
183endif
184 @share/alibtool mkmodule $(patsubst %/module.mk,%,$@) > $@;
b9d0a01d 185
462ee303 186#-------------------------------------------------------------------------------
462ee303 187# If making modules, not not include anything
b9d0a01d 188
bdfb9593 189ifeq ($(findstring modules,$(MAKECMDGOALS)),)
b9d0a01d 190
462ee303 191#-------------------------------------------------------------------------------
192# Include the modules
193
b934f194 194-include $(patsubst %,%/module.mk,$(MODULES))
b9d0a01d 195
462ee303 196#-------------------------------------------------------------------------------
bdfb9593 197# If cleaning, do not include dependencies or module.mk files.
198
199ifeq ($(CLEAN),)
200
201#-------------------------------------------------------------------------------
462ee303 202# Include dependencies if not making them!
b9d0a01d 203
462ee303 204ifneq ($(MAKECMDGOALS),depend)
9f1751e4 205ifneq ($(MAKECMDGOALS),)
462ee303 206
e3642d02 207ifeq (ALIVERBOSE,2)
462ee303 208$(warning INCLUDEFILES=$(INCLUDEFILES))
b9d0a01d 209endif
462ee303 210-include $(INCLUDEFILES)
b9d0a01d 211
212endif
213endif
462ee303 214endif
9f1751e4 215endif
462ee303 216
217#-------------------------------------------------------------------------------
218# Include dummy dependency file *MUST* be last includefile
b9d0a01d 219
b9d0a01d 220include build/dummy.d
b9d0a01d 221
222
462ee303 223#-------------------------------------------------------------------------------
224# Targets
b9d0a01d 225
2ea00b17 226.PHONY: alilibs aliroot makedistr clean distclean clean-all \
9f1751e4 227 htmldoc profile modules depend
b9d0a01d 228
b934f194 229modules: $(patsubst %,%/module.mk,$(MODULES))
41f6cf69 230
2d8cad5a 231ifeq ($(ALIPROFILE),YES)
3a5e5a40 232alilibs: $(LIBPATH) modules $(ALLLIBS) $(ALLALIBS)
2d8cad5a 233else
3a5e5a40 234alilibs: $(LIBPATH) modules $(ALLLIBS)
2d8cad5a 235endif
41f6cf69 236
b8205a22 237aliroot: alilibs $(BINPATH) $(ALLEXECS)
9f1751e4 238
462ee303 239#-------------------------------------------------------------------------------
b9d0a01d 240# Single Makefile "distribution": Makefile + modules + mkdepend scripts
b934f194 241makedistr: $(MODULES)
b9d0a01d 242 tar -cvf MakeDistr.tar $(patsubst %,%/*.pkg,$(MODULES)) \
b934f194 243 Makefile create build/*
41f6cf69 244
b9d0a01d 245all: aliroot
41f6cf69 246
b934f194 247depend: $(INCLUDEFILES)
41f6cf69 248
b9d0a01d 249debug:
250ifndef ALIQUIET
251 @echo "***** Entering DEBUG mode. *****"
252endif
e1f602dc 253 @(export ALIDEBUG=YES && $(MAKE) aliroot)
b934f194 254
2d8cad5a 255profile:
256ifndef ALIQUIET
257 @echo "***** Entering PROFILE mode. *****"
258endif
e1f602dc 259 @(export ALIPROFILE=YES && $(MAKE) aliroot)
b934f194 260
b9d0a01d 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"
1aa44b64 289 @echo " distclean : Like clean-all + clean all tgt_*'s"
b934f194 290 @echo " clean-modules : Clean all module.mk files in all modules"
b9d0a01d 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
1aa44b64 302 $(MUTE)rm -rf */tgt_* bin lib
2ea00b17 303
462ee303 304#-------------------------------------------------------------------------------
305# This cleans only libraries that are not CERN-libraries
b9d0a01d 306
307clean-aliroot: $(patsubst %,%/module.mk,$(ALIROOTMODULES)) $(patsubst %,clean-%,$(ALIROOTMODULES))
308
7e96fcc7 309CHECKMODULES := $(MODULES)
2900fa57 310CHECKMODULES := $(filter-out HBTP,$(CHECKMODULES))
311CHECKMODULES := $(filter-out MEVSIM,$(CHECKMODULES))
312CHECKMODULES := $(filter-out EPEMGEN,$(CHECKMODULES))
0b5dd071 313CHECKMODULES := $(filter-out TPHIC,$(CHECKMODULES))
7e96fcc7 314CHECKMODULES := $(filter-out PDF,$(CHECKMODULES))
315CHECKMODULES := $(filter-out MICROCERN,$(CHECKMODULES))
b9d0a01d 316
b934f194 317check-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,check-%,$(CHECKMODULES))
b9d0a01d 318
b934f194 319reveng-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,reveng-%,$(CHECKMODULES))
b9d0a01d 320
b934f194 321revdisp-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,revdisp-%,$(CHECKMODULES))
b9d0a01d 322
118c0ae6 323smell-all: $(patsubst %,%/module.mk,$(CHECKMODULES)) $(patsubst %,smell-%,$(CHECKMODULES))
324
b9d0a01d 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