Mior fixes
[u/mrichter/AliRoot.git] / PWG2 / Makefile
CommitLineData
937bb49a 1# $Id$
2
937bb49a 3include $(ROOTSYS)/test/Makefile.arch
937bb49a 4
378d0357 5PACKAGE = PWG2
6
7default-target: lib$(PACKAGE).so
deb133c5 8
d0a65c9a 9ALICEINC = -I. -I$(ALICE_ROOT)/TOF
937bb49a 10
11### define include dir for local case and par case
378d0357 12ifneq ($(ESD_INCLUDE),)
9d28f090 13 ALICEINC += -I../$(ESD_INCLUDE)
14 ALICEINC += -I../$(AOD_INCLUDE)
15 ALICEINC += -I../$(STEERBase_INCLUDE)
16 ALICEINC += -I../$(ANALYSIS_INCLUDE)
17 ALICEINC += -I../$(ANALYSISalice_INCLUDE)
18 else
19 ifneq ($(ALICE_ROOT),)
958d9d26 20 ALICEINC += -I$(ALICE_ROOT)/include -I$(ALICE_ROOT)/PWG2
9d28f090 21 endif
aca22c05 22endif
23
f35b656f 24ifneq ($(CORRFW_INCLUDE),)
39f2a708 25 ALICEINC += -I../$(CORRFW_INCLUDE)
26endif
27
aad44575 28ifneq ($(PWG2AOD_INCLUDE),)
29 ALICEINC += -I../$(PWG2AOD_INCLUDE)
30endif
31
32ifneq ($(PWG2femtoscopy_INCLUDE),)
33 ALICEINC += -I../$(PWG2femtoscopy_INCLUDE)
958d9d26 34 else
35 ifneq ($(ALICE_ROOT),)
36 ALICEINC += -I$(ALICE_ROOT)/PWG2/AOD
37 endif
aad44575 38endif
39
9d28f090 40ifneq ($(PWG2femtoscopyUser_INCLUDE),)
41 ALICEINC += -I../$(PWG2femtoscopyUser_INCLUDE)
958d9d26 42 else
43 ifneq ($(ALICE_ROOT),)
44 ALICEINC += -I$(ALICE_ROOT)/PWG2/AOD -I$(ALICE_ROOT)/PWG2/FEMTOSCOPY/AliFemto
45 endif
9d28f090 46endif
47
29b61d43 48ifneq ($(PWG2flowCommon_INCLUDE),)
49 ALICEINC += -I../$(PWG2flowCommon_INCLUDE)
50endif
51
52ifneq ($(PWG2flowTasks_INCLUDE),)
53 ALICEINC += -I../$(PWG2flowTasks_INCLUDE)
958d9d26 54 else
55 ifneq ($(ALICE_ROOT),)
56 ALICEINC += -I$(ALICE_ROOT)/PWG2/FLOW/AliFlowCommon
57 endif
29b61d43 58endif
59
8f4eb10f 60ifneq ($(PWG2resonances_INCLUDE),)
61 ALICEINC += -I../$(PWG2resonances_INCLUDE)
958d9d26 62 else
63 ifneq ($(ALICE_ROOT),)
64 ALICEINC += -I$(ALICE_ROOT)/PWG2/RESONANCES
65 endif
8f4eb10f 66endif
67
9d28f090 68ifneq ($(PWG2unicor_INCLUDE),)
69 ALICEINC += -I../$(PWG2unicor_INCLUDE)
70endif
71
72ifneq ($(PWG2evchar_INCLUDE),)
73 ALICEINC += -I../$(PWG2evchar_INCLUDE)
74endif
75
76ifneq ($(PWG2kink_INCLUDE),)
77 ALICEINC += -I../$(PWG2kink_INCLUDE)
78endif
79
f8e5dd12 80ifneq ($(PWG2forward_INCLUDE),)
81 ALICEINC += -I../$(PWG2forward_INCLUDE)
958d9d26 82 else
83 ifneq ($(ALICE_ROOT),)
84 ALICEINC += -I$(ALICE_ROOT)/FMD
85 endif
f8e5dd12 86endif
87
378d0357 88# only if no par file was loaded before
89ifeq ($(ALICEINC),-I.)
90 ifneq ($(ALICE_ROOT),)
91 ALICEINC += -I$(ALICE_ROOT)/include
937bb49a 92 endif
93endif
94
9c19b5fc 95# for building of PWG0dep.par
96#ifneq ($(PWG0base_INCLUDE),)
97# ALICEINC += -I../$(PWG0base_INCLUDE)
98#endif
99
378d0357 100#ALICEINC += -IFEMTOSCOPY/AliFemto -IANALYSIS -IFEMTOSCOPY/AliFemtoUser
deb133c5 101
958d9d26 102# include lib$(PACKAGE).pkg
deb133c5 103
f8e5dd12 104ifneq ($(EINCLUDE),)
105 ALICEINC += $(EINCLUDE:%=-I$(ALICE_ROOT)/%)
106endif
107
108CXXFLAGS += $(ALICEINC) -g
109F77FLAGS += $(ALICEINC) -g -fPIC
110
958d9d26 111DHDR =
112HDRS =
113SRCS =
114FSRCS =
f8e5dd12 115
9c19b5fc 116DHDR_PWG2 := $(DHDR)
117HDRS_PWG2 := $(HDRS)
118SRCS_PWG2 := $(SRCS) G__$(PACKAGE).cxx
aad44575 119FSCRS_PWG2 := $(FSRCS)
120OBJS_PWG2 := $(SRCS_PWG2:.cxx=.o) $(FSRCS:.F=.o)
deb133c5 121
937bb49a 122PARFILE = $(PACKAGE).par
123
9c19b5fc 124lib$(PACKAGE).so: $(OBJS_PWG2)
937bb49a 125 @echo "Linking" $@ ...
126 @/bin/rm -f $@
d86acb69 127ifeq ($(PLATFORM),macosx)
128# We need to make both the .dylib and the .so
129 $(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@
130ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
131ifeq ($(MACOSX_MINOR),4)
132 ln -sf $@ $(subst .$(DllSuf),.so,$@)
937bb49a 133else
d86acb69 134 $(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \
135 $(OutPutOpt) $(subst .$(DllSuf),.so,$@)
136endif
137endif
138else
139ifeq ($(PLATFORM),win32)
140 bindexplib $* $^ > $*.def
141 lib -nologo -MACHINE:IX86 $^ -def:$*.def \
142 $(OutPutOpt)$(EVENTLIB)
143 $(LD) $(SOFLAGS) $(LDFLAGS) $^ $*.exp $(LIBS) \
144 $(OutPutOpt)$@
145else
146 $(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
147endif
937bb49a 148endif
149 @chmod a+x $@
150 @echo "done"
151
152%.o: %.cxx %.h
153 $(CXX) $(CXXFLAGS) -c $< -o $@
154
aad44575 155%.o: %.F
156 $(F77) $(F77FLAGS) -c $< -o $@
157
958d9d26 158G__$(PACKAGE).h:G__$(PACKAGE).cxx
159 @if test -f $@ ; then : ; else rm -f $< ; $(MAKE) $@ ; fi
160
161G__$(PACKAGE).cxx: $(HDRS_PWG2) $(DHDR_PWG2)
937bb49a 162 @echo "Generating dictionary ..."
378d0357 163 rootcint -f $@ -c $(CINTFLAGS) $(ALICEINC) $^
937bb49a 164
deb133c5 165clean:
378d0357 166 @rm -f $(OBJS_PWG2) *.so G__$(PACKAGE).* $(PARFILE)
deb133c5 167
937bb49a 168### CREATE PAR FILE
169
9c19b5fc 170$(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_PWG2) $(SRCS_PWG2) $(DHDR_PWG2) Makefile Makefile.arch lib$(PACKAGE).pkg PROOF-INF))
937bb49a 171 @echo "Creating archive" $@ ...
172 @tar cfzh $@ $(PACKAGE)
173 @rm -rf $(PACKAGE)
174 @echo "done"
175
176$(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
177 @echo Copying $< to $@ with transformations
178 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
179 @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
180
181$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
182 @echo Copying $< to $@
183 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
deb133c5 184 @cp -a $^ $@
937bb49a 185
186$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
187 @echo Copying $< to $@
188 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
deb133c5 189 @cp -a -r $^ $@
937bb49a 190
191$(PACKAGE)/%: %
192 @echo Copying $< to $@
193 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
deb133c5 194 @cp -a $< $@
937bb49a 195
196test-%.par: %.par
197 @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
198 @mkdir -p par-tmp
199 @cd par-tmp; tar xfz ../$<; cd $(subst .par,,$<); PROOF-INF/BUILD.sh
200 @rm -rf par-tmp
201 @echo "INFO: Testing succeeded (already cleaned up)"