warning fixes
[u/mrichter/AliRoot.git] / PWG0 / Makefile
1 # $Id$
2
3 include Makefile.arch
4
5 PACKAGE = PWG0base
6 default-target: lib$(PACKAGE).so
7
8 ALICEINC      = -I.
9
10 ### define include dir for local case and par case
11 ifneq ($(ESD_INCLUDE),)
12    ALICEINC += -I../$(ESD_INCLUDE)
13         ifneq ($(STEERBase_INCLUDE),)
14                 ALICEINC += -I../$(STEERBase_INCLUDE)
15         endif                           
16         ifneq ($(AOD_INCLUDE),)
17                 ALICEINC += -I../$(AOD_INCLUDE)
18         endif
19         ifneq ($(ANALYSIS_INCLUDE),)
20                 ALICEINC += -I../$(ANALYSIS_INCLUDE)
21         endif
22         ifneq ($(ANALYSISalice_INCLUDE),)
23                 ALICEINC += -I../$(ANALYSISalice_INCLUDE)
24         endif
25 else
26   ifneq ($(ALICE_ROOT),)
27     ALICEINC += -I$(ALICE_ROOT)/include -I$(ALICE_ROOT)/PYTHIA6 -I$(ALICE_ROOT)/EVGEN -I$(ALICE_ROOT)/RAW -I$(ALICE_ROOT)/TPC  -I$(ALICE_ROOT)/PWG0
28 else
29   endif
30 endif
31
32 # for building of PWG0dep.par
33 ifneq ($(PWG0base_INCLUDE),)
34   ALICEINC += -I../$(PWG0base_INCLUDE)
35 endif
36
37 CXXFLAGS     += $(ALICEINC) -g
38
39 SRCS     = $(wildcard *.cxx */*.cxx)
40 HDRS     = $(SRCS:.cxx=.h)
41 DHDR     = $(PACKAGE)LinkDef.h
42
43 DHDR_PWG0base := $(DHDR)
44 HDRS_PWG0base := $(HDRS)
45 SRCS_PWG0base := $(SRCS) G__$(PACKAGE).cxx
46 OBJS_PWG0base := $(SRCS_PWG0base:.cxx=.o)
47
48 PARFILE       = $(PACKAGE).par
49
50 lib$(PACKAGE).so: $(OBJS_PWG0base)
51         @echo "Linking" $@ ...
52         @/bin/rm -f $@
53 ifeq ($(ARCH),macosx)
54         @$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ -o $@
55 else
56         @$(LD) $(SOFLAGS) $(LDFLAGS) $^ -o $@
57 endif
58         @chmod a+x $@
59         @echo "done"
60
61 %.o:    %.cxx %.h
62         $(CXX) $(CXXFLAGS) -c $< -o $@
63
64 G__$(PACKAGE).cxx G__$(PACKAGE).h: $(HDRS_PWG0base) $(DHDR_PWG0base)
65         @echo "Generating dictionary ..."
66         rootcint -f $@ -c $(ALICEINC) $^
67
68 clean:
69         @rm -f $(OBJS_PWG0base) $(OBJS_PWG0dep) $(OBJS_PWG0selectors) *.so G__PWG0base.* G__PWG0dep.* G__PWG0selectors.* $(PARFILE)
70
71 ### CREATE PAR FILE
72
73 $(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_PWG0base) $(SRCS_PWG0base) $(DHDR_PWG0base) Makefile Makefile.arch PROOF-INF))
74         @echo "Creating archive" $@ ...
75         @tar cfzh $@ $(PACKAGE)
76         @rm -rf $(PACKAGE)
77         @echo "done"
78
79 $(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
80         @echo Copying $< to $@ with transformations
81         @[ -d $(dir $@) ] || mkdir -p $(dir $@)
82         @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
83
84 $(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
85         @echo Copying $< to $@
86         @[ -d $(dir $@) ] || mkdir -p $(dir $@)
87         @cp -a $^ $@
88
89 $(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
90         @echo Copying $< to $@
91         @[ -d $(dir $@) ] || mkdir -p $(dir $@)
92         @cp -a -r $^ $@
93
94 $(PACKAGE)/%: %
95         @echo Copying $< to $@
96         @[ -d $(dir $@) ] || mkdir -p $(dir $@)
97         @cp -a $< $@
98
99 test-%.par: %.par
100         @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
101         @mkdir -p par-tmp
102         @cd par-tmp; tar xfz ../$<;     cd $(subst .par,,$<); PROOF-INF/BUILD.sh
103         @rm -rf par-tmp
104         @echo "INFO: Testing succeeded (already cleaned up)"