coverity
[u/mrichter/AliRoot.git] / ANALYSIS / Makefile
CommitLineData
379c06ec 1
dd4f0396 2include Makefile.arch
b7c8eec1 3
dd4f0396 4PACKAGE = ANALYSISalice
9af2beba 5
6default-target: lib$(PACKAGE).so
b7c8eec1 7
8ALICEINC = -I.
9
3e228187 10# add include paths from other par files
b7c8eec1 11ifneq ($(ESD_INCLUDE),)
12 ALICEINC += -I../$(ESD_INCLUDE)
b7c8eec1 13endif
14
3e228187 15ifneq ($(AOD_INCLUDE),)
16 ALICEINC += -I../$(AOD_INCLUDE)
17endif
18
19ifneq ($(STEERBase_INCLUDE),)
20 ALICEINC += -I../$(STEERBase_INCLUDE)
21endif
22
9af2beba 23ifneq ($(ANALYSIS_INCLUDE),)
24 ALICEINC += -I../$(ANALYSIS_INCLUDE)
25endif
26
a18817ac 27ifneq ($(OADB_INCLUDE),)
28 ALICEINC += -I../$(OADB_INCLUDE)
29endif
30
02fc82ff 31ifneq ($(ANALYSISalice_INCLUDE),)
32 ALICEINC += -I../$(ANALYSISalice_INCLUDE)
33endif
34
3e228187 35# only if no par file was loaded before
36ifeq ($(ALICEINC),-I.)
37 ifneq ($(ALICE_ROOT),)
e144bdbc 38 ALICEINC += -I$(ALICE_ROOT)/include -I$(ALICE_ROOT)/ANALYSIS/Tender -I$(ALICE_ROOT)/TOF -I$(ALICE_ROOT)/TRD/Cal -I$(ALICE_ROOT)/VZERO -I$(ALICE_ROOT)/TPC -I$(ALICE_ROOT)/T0 -I$(ALICE_ROOT)/EMCAL
3e228187 39 endif
b7c8eec1 40endif
41
e9e06a24 42CHECKXML := $(shell root-config --has-xml)
84d4333f 43
dd4f0396 44ifeq ($(CHECKXML),yes)
45 CXXFLAGS += -DWITHXML
46 CINTFLAGS += -DWITHXML
47endif
48
49CXXFLAGS += $(ALICEINC) -g
50
958d9d26 51SRCS = $(wildcard *.cxx)
52HDRS = $(SRCS:.cxx=.h)
53DHDR = $(PACKAGE)LinkDef.h
379c06ec 54
c52c2132 55DHDR_ANALYSIS := $(DHDR)
56HDRS_ANALYSIS := $(HDRS)
57SRCS_ANALYSIS := $(SRCS) G__$(PACKAGE).cxx
58OBJS_ANALYSIS := $(SRCS_ANALYSIS:.cxx=.o)
b7c8eec1 59
60PARFILE = $(PACKAGE).par
61
379c06ec 62
c52c2132 63lib$(PACKAGE).so: $(OBJS_ANALYSIS)
379c06ec 64 @echo "Linking" $@ ...
65 @/bin/rm -f $@
d86acb69 66ifeq ($(PLATFORM),macosx)
67# We need to make both the .dylib and the .so
68 $(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@
69ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
70ifeq ($(MACOSX_MINOR),4)
71 ln -sf $@ $(subst .$(DllSuf),.so,$@)
379c06ec 72else
d86acb69 73 $(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \
74 $(OutPutOpt) $(subst .$(DllSuf),.so,$@)
75endif
76endif
77else
78ifeq ($(PLATFORM),win32)
79 bindexplib $* $^ > $*.def
80 lib -nologo -MACHINE:IX86 $^ -def:$*.def \
81 $(OutPutOpt)$(EVENTLIB)
82 $(LD) $(SOFLAGS) $(LDFLAGS) $^ $*.exp $(LIBS) \
83 $(OutPutOpt)$@
84else
85 $(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
86endif
379c06ec 87endif
88 @chmod a+x $@
89 @echo "done"
90
91%.o: %.cxx %.h
c16bb9ed 92 $(CXX) $(CXXFLAGS) $(PACKCXXFLAGS) -c $< -o $@
379c06ec 93
94clean:
c52c2132 95 @rm -f $(OBJS_ANALYSIS) *.so G__$(PACKAGE).* $(PARFILE)
379c06ec 96
97G__$(PACKAGE).cxx G__$(PACKAGE).h: $(HDRS) $(DHDR)
98 @echo "Generating dictionary ..."
3f4f3116 99 rootcint -f $@ -c $(CINTFLAGS) $(ALICEINC) $^
379c06ec 100
b7c8eec1 101### CREATE PAR FILE
102
84d4333f 103$(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_ANALYSIS) $(SRCS_ANALYSIS) $(DHDR_ANALYSIS) Makefile Makefile.arch PROOF-INF))
b7c8eec1 104 @echo "Creating archive" $@ ...
105 @tar cfzh $@ $(PACKAGE)
106 @rm -rf $(PACKAGE)
107 @echo "done"
108
109$(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
110 @echo Copying $< to $@ with transformations
111 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
112 @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
113
114$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
115 @echo Copying $< to $@
116 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
117 @cp -a $^ $@
118
119$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
120 @echo Copying $< to $@
121 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
122 @cp -a -r $^ $@
123
124$(PACKAGE)/%: %
125 @echo Copying $< to $@
126 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
127 @cp -a $< $@
128
129test-%.par: %.par
130 @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
131 @mkdir -p par-tmp
132 @cd par-tmp; tar xfz ../$<; cd $(subst .par,,$<); PROOF-INF/BUILD.sh
133 @rm -rf par-tmp
134 @echo "INFO: Testing succeeded (already cleaned up)"