Correction for bug #77355: Generation of PARs
[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 $@
10dc066e 127ifeq ($(ARCH),macosx)
937bb49a 128 @$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ -o $@
129else
deb133c5 130 @$(LD) $(SOFLAGS) $(LDFLAGS) $^ -o $@
937bb49a 131endif
132 @chmod a+x $@
133 @echo "done"
134
135%.o: %.cxx %.h
136 $(CXX) $(CXXFLAGS) -c $< -o $@
137
aad44575 138%.o: %.F
139 $(F77) $(F77FLAGS) -c $< -o $@
140
958d9d26 141G__$(PACKAGE).h:G__$(PACKAGE).cxx
142 @if test -f $@ ; then : ; else rm -f $< ; $(MAKE) $@ ; fi
143
144G__$(PACKAGE).cxx: $(HDRS_PWG2) $(DHDR_PWG2)
937bb49a 145 @echo "Generating dictionary ..."
378d0357 146 rootcint -f $@ -c $(CINTFLAGS) $(ALICEINC) $^
937bb49a 147
deb133c5 148clean:
378d0357 149 @rm -f $(OBJS_PWG2) *.so G__$(PACKAGE).* $(PARFILE)
deb133c5 150
937bb49a 151### CREATE PAR FILE
152
9c19b5fc 153$(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_PWG2) $(SRCS_PWG2) $(DHDR_PWG2) Makefile Makefile.arch lib$(PACKAGE).pkg PROOF-INF))
937bb49a 154 @echo "Creating archive" $@ ...
155 @tar cfzh $@ $(PACKAGE)
156 @rm -rf $(PACKAGE)
157 @echo "done"
158
159$(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
160 @echo Copying $< to $@ with transformations
161 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
162 @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
163
164$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
165 @echo Copying $< to $@
166 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
deb133c5 167 @cp -a $^ $@
937bb49a 168
169$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
170 @echo Copying $< to $@
171 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
deb133c5 172 @cp -a -r $^ $@
937bb49a 173
174$(PACKAGE)/%: %
175 @echo Copying $< to $@
176 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
deb133c5 177 @cp -a $< $@
937bb49a 178
179test-%.par: %.par
180 @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
181 @mkdir -p par-tmp
182 @cd par-tmp; tar xfz ../$<; cd $(subst .par,,$<); PROOF-INF/BUILD.sh
183 @rm -rf par-tmp
184 @echo "INFO: Testing succeeded (already cleaned up)"