Fix from Salvatore for new framework
[u/mrichter/AliRoot.git] / PWGLF / Makefile
CommitLineData
b63dbf69 1# $Id: Makefile 50266 2011-06-24 09:37:46Z pulvir $
0a0f6d45 2
b63dbf69 3include $(ROOTSYS)/etc/Makefile.arch
0a0f6d45 4
b63dbf69 5PACKAGE = PWGLFresonancesdev
0a0f6d45 6
7default-target: lib$(PACKAGE).so
8
b63dbf69 9ALICEINC = -I.
10
11ifeq ($(PACKAGE),PWGLFresonances)
12 ALICEINC += -IRESONANCES
13endif
14
15ifeq ($(PACKAGE),PWGLFresonancesdev)
16 ALICEINC += -IRESONANCES_DEV
17endif
0a0f6d45 18
483c140c 19ifeq ($(PACKAGE),PWGLFforward2)
20 ALICEINC += -IFORWARD/analysis2
21endif
22
0a0f6d45 23### define include dir for local case and par case
b63dbf69 24ifneq ($(STEERBase_INCLUDE),)
25 ALICEINC += -I../$(STEERBase_INCLUDE)
0a0f6d45 26 ALICEINC += -I../$(ESD_INCLUDE)
27 ALICEINC += -I../$(AOD_INCLUDE)
0a0f6d45 28 ALICEINC += -I../$(ANALYSIS_INCLUDE)
29 ALICEINC += -I../$(ANALYSISalice_INCLUDE)
b63dbf69 30else
31 ifneq ($(ALICE_ROOT),)
32 ALICEINC += -I$(ALICE_ROOT)/include
33 endif
0a0f6d45 34endif
35
b63dbf69 36ifneq ($(CORRFW_INCLUDE),)
37 ALICEINC += -I../$(CORRFW_INCLUDE)
0a0f6d45 38endif
39
07c50b03 40ifneq ($(OADB_INCLUDE),)
41 ALICEINC += -I../$(OADB_INCLUDE)
42endif
43
b63dbf69 44ifneq ($(PWGLFresonances_INCLUDE),)
45 ALICEINC += -I../$(PWGLFresonances_INCLUDE)
46else
47 ifneq ($(ALICE_ROOT),)
48 ALICEINC += -I$(ALICE_ROOT)/PWGLF -I$(ALICE_ROOT)/PWGLF/RESONANCES
49 endif
0a0f6d45 50endif
51
b63dbf69 52ifneq ($(PWGLFresonancesdev_INCLUDE),)
53 ALICEINC += -I../$(PWGLFresonancesdev_INCLUDE)
0a0f6d45 54else
b63dbf69 55 ifneq ($(ALICE_ROOT),)
56 ALICEINC += -I$(ALICE_ROOT)/PWGLF -I$(ALICE_ROOT)/PWGLF/RESONANCES_DEV
57 endif
0a0f6d45 58endif
59
60# only if no par file was loaded before
b63dbf69 61ifeq ($(ALICEINC),-I.)
0a0f6d45 62 ifneq ($(ALICE_ROOT),)
63 ALICEINC += -I$(ALICE_ROOT)/include
64 endif
b63dbf69 65endif
0a0f6d45 66
67ifneq ($(EINCLUDE),)
68 ALICEINC += $(EINCLUDE:%=-I$(ALICE_ROOT)/%)
69endif
70
71CXXFLAGS += $(ALICEINC) -g
72F77FLAGS += $(ALICEINC) -g -fPIC
73
b63dbf69 74DHDR =
75HDRS =
76SRCS =
77FSRCS =
0a0f6d45 78
b63dbf69 79DHDR_PWG2 := $(DHDR)
80HDRS_PWG2 := $(HDRS)
81SRCS_PWG2 := $(SRCS) G__$(PACKAGE).cxx
82FSCRS_PWG2 := $(FSRCS)
83OBJS_PWG2 := $(SRCS_PWG2:.cxx=.o) $(FSRCS:.F=.o)
0a0f6d45 84
85PARFILE = $(PACKAGE).par
86
b63dbf69 87lib$(PACKAGE).so: $(OBJS_PWG2)
0a0f6d45 88 @echo "Linking" $@ ...
89 @/bin/rm -f $@
b63dbf69 90ifeq ($(PLATFORM),macosx)
91# We need to make both the .dylib and the .so
92 $(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@
93ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
94ifeq ($(MACOSX_MINOR),4)
95 ln -sf $@ $(subst .$(DllSuf),.so,$@)
96else
97 $(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \
98 $(OutPutOpt) $(subst .$(DllSuf),.so,$@)
99endif
100endif
101else
102ifeq ($(PLATFORM),win32)
103 bindexplib $* $^ > $*.def
104 lib -nologo -MACHINE:IX86 $^ -def:$*.def \
105 $(OutPutOpt)$(EVENTLIB)
106 $(LD) $(SOFLAGS) $(LDFLAGS) $^ $*.exp $(LIBS) \
107 $(OutPutOpt)$@
108else
109 $(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
110endif
111endif
0a0f6d45 112 @chmod a+x $@
113 @echo "done"
114
115%.o: %.cxx %.h
116 $(CXX) $(CXXFLAGS) -c $< -o $@
117
118%.o: %.F
119 $(F77) $(F77FLAGS) -c $< -o $@
120
121G__$(PACKAGE).h:G__$(PACKAGE).cxx
122 @if test -f $@ ; then : ; else rm -f $< ; $(MAKE) $@ ; fi
123
b63dbf69 124G__$(PACKAGE).cxx: $(HDRS_PWG2) $(DHDR_PWG2)
0a0f6d45 125 @echo "Generating dictionary ..."
126 rootcint -f $@ -c $(CINTFLAGS) $(ALICEINC) $^
127
128clean:
b63dbf69 129 @rm -f $(OBJS_PWG2) *.so G__$(PACKAGE).* $(PARFILE)
0a0f6d45 130
131### CREATE PAR FILE
132
b63dbf69 133$(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_PWG2) $(SRCS_PWG2) $(DHDR_PWG2) Makefile Makefile.arch PROOF-INF))
0a0f6d45 134 @echo "Creating archive" $@ ...
135 @tar cfzh $@ $(PACKAGE)
136 @rm -rf $(PACKAGE)
137 @echo "done"
138
139$(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
140 @echo Copying $< to $@ with transformations
141 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
142 @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
143
144$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
145 @echo Copying $< to $@
146 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
147 @cp -a $^ $@
148
149$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
150 @echo Copying $< to $@
151 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
152 @cp -a -r $^ $@
153
154$(PACKAGE)/%: %
155 @echo Copying $< to $@
156 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
157 @cp -a $< $@
158
159test-%.par: %.par
160 @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
161 @mkdir -p par-tmp
162 @cd par-tmp; tar xfz ../$<; cd $(subst .par,,$<); PROOF-INF/BUILD.sh
163 @rm -rf par-tmp
164 @echo "INFO: Testing succeeded (already cleaned up)"