Adding Makefile in the PWG2 module. This makefile will be used for the creation of...
[u/mrichter/AliRoot.git] / PWG2 / Makefile
CommitLineData
937bb49a 1# $Id$
2
3PACKAGE = PWG2
4
5include $(ROOTSYS)/test/Makefile.arch
6include lib$(PACKAGE).pkg
7
8ALICEINC = -I.
9
10### define include dir for local case and par case
11ifneq ($(ALICE_ROOT),)
12 ALICEINC += -I$(ALICE_ROOT)/include
13else
14 ifneq ($(STEER_INCLUDE),)
15 ALICEINC += -I../$(STEER_INCLUDE)
16 endif
17 ifneq ($(ESD_INCLUDE),)
18 ALICEINC += -I../$(ESD_INCLUDE)
19 endif
20endif
21
22CXXFLAGS += $(ALICEINC)
23SRCS += dict.cxx
24OBJS = $(SRCS:.cxx=.o)
25PARFILE = $(PACKAGE).par
26
27lib$(PACKAGE).so: $(OBJS)
28 @echo "Linking" $@ ...
29 @/bin/rm -f $@
30ifeq ($(PLATFORM),macosx)
31 @$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ -o $@
32else
33 @$(LD) $(SOFLAGS) $(LDFLAGS) $(OBJS) -o $@
34endif
35 @chmod a+x $@
36 @echo "done"
37
38%.o: %.cxx %.h
39 $(CXX) $(CXXFLAGS) -c $< -o $@
40
41clean:
42 @rm -f $(OBJS) core *~ *.so dict.* $(PARFILE)
43
44dict.cxx dict.h: $(HDRS) $(DHDR)
45 @echo "Generating dictionary ..."
46 @[ -f dict ] || rm -f $@
47 rootcint -f $@ -c $(ALICEINC) $^
48
49### CREATE PAR FILE
50
51$(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out dict.%, $(HDRS) $(SRCS) $(DHDR) $(PKGFILE) Makefile Makefile.arch lib$(PACKAGE).pkg PROOF-INF))
52 @echo "Creating archive" $@ ...
53 @tar cfzh $@ $(PACKAGE)
54 @rm -rf $(PACKAGE)
55 @echo "done"
56
57$(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
58 @echo Copying $< to $@ with transformations
59 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
60 @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
61
62$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
63 @echo Copying $< to $@
64 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
65 @cp $^ $@
66
67$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
68 @echo Copying $< to $@
69 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
70 @cp -r $^ $@
71
72$(PACKAGE)/%: %
73 @echo Copying $< to $@
74 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
75 @cp $< $@
76
77test-%.par: %.par
78 @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
79 @mkdir -p par-tmp
80 @cd par-tmp; tar xfz ../$<; cd $(subst .par,,$<); PROOF-INF/BUILD.sh
81 @rm -rf par-tmp
82 @echo "INFO: Testing succeeded (already cleaned up)"