fixing bug in par file creation when package name was equally to a directory name...
[u/mrichter/AliRoot.git] / ANALYSIS / Makefile
CommitLineData
379c06ec 1
b7c8eec1 2include $(ROOTSYS)/test/Makefile.arch
3
9af2beba 4PACKAGE = ANALYSIS
5
6default-target: lib$(PACKAGE).so
b7c8eec1 7
8ALICEINC = -I.
9
3e228187 10# add include paths from other par files
b7c8eec1 11ifneq ($(ESD_INCLUDE),)
12 ALICEINC += -I../$(ESD_INCLUDE)
b7c8eec1 13endif
14
3e228187 15ifneq ($(AOD_INCLUDE),)
16 ALICEINC += -I../$(AOD_INCLUDE)
17endif
18
19ifneq ($(STEERBase_INCLUDE),)
20 ALICEINC += -I../$(STEERBase_INCLUDE)
21endif
22
9af2beba 23ifneq ($(ANALYSIS_INCLUDE),)
24 ALICEINC += -I../$(ANALYSIS_INCLUDE)
25endif
26
02fc82ff 27ifneq ($(ANALYSISalice_INCLUDE),)
28 ALICEINC += -I../$(ANALYSISalice_INCLUDE)
29endif
30
3e228187 31# only if no par file was loaded before
32ifeq ($(ALICEINC),-I.)
33 ifneq ($(ALICE_ROOT),)
dcea967f 34 ALICEINC += -I$(ALICE_ROOT)/include -I$(ALICE_ROOT)/ANALYSIS/Tender -I$(ALICE_ROOT)/TOF
3e228187 35 endif
b7c8eec1 36endif
37
38CXXFLAGS += $(ALICEINC) -g
39
e9e06a24 40CHECKXML := $(shell root-config --has-xml)
379c06ec 41include lib$(PACKAGE).pkg
42
c52c2132 43DHDR_ANALYSIS := $(DHDR)
44HDRS_ANALYSIS := $(HDRS)
45SRCS_ANALYSIS := $(SRCS) G__$(PACKAGE).cxx
46OBJS_ANALYSIS := $(SRCS_ANALYSIS:.cxx=.o)
b7c8eec1 47
48PARFILE = $(PACKAGE).par
49
379c06ec 50
c52c2132 51lib$(PACKAGE).so: $(OBJS_ANALYSIS)
379c06ec 52 @echo "Linking" $@ ...
53 @/bin/rm -f $@
10dc066e 54ifeq ($(ARCH),macosx)
379c06ec 55 @$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ -o $@
56else
57 @$(LD) $(SOFLAGS) $(LDFLAGS) $^ -o $@
58endif
59 @chmod a+x $@
60 @echo "done"
61
62%.o: %.cxx %.h
c16bb9ed 63 $(CXX) $(CXXFLAGS) $(PACKCXXFLAGS) -c $< -o $@
379c06ec 64
65clean:
c52c2132 66 @rm -f $(OBJS_ANALYSIS) *.so G__$(PACKAGE).* $(PARFILE)
379c06ec 67
68G__$(PACKAGE).cxx G__$(PACKAGE).h: $(HDRS) $(DHDR)
69 @echo "Generating dictionary ..."
3f4f3116 70 rootcint -f $@ -c $(CINTFLAGS) $(ALICEINC) $^
379c06ec 71
b7c8eec1 72### CREATE PAR FILE
73
c52c2132 74$(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_ANALYSIS) $(SRCS_ANALYSIS) $(DHDR_ANALYSIS) Makefile Makefile.arch lib$(PACKAGE).pkg PROOF-INF))
b7c8eec1 75 @echo "Creating archive" $@ ...
76 @tar cfzh $@ $(PACKAGE)
77 @rm -rf $(PACKAGE)
78 @echo "done"
79
80$(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
81 @echo Copying $< to $@ with transformations
82 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
83 @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
84
85$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
86 @echo Copying $< to $@
87 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
88 @cp -a $^ $@
89
90$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
91 @echo Copying $< to $@
92 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
93 @cp -a -r $^ $@
94
95$(PACKAGE)/%: %
96 @echo Copying $< to $@
97 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
98 @cp -a $< $@
99
100test-%.par: %.par
101 @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
102 @mkdir -p par-tmp
103 @cd par-tmp; tar xfz ../$<; cd $(subst .par,,$<); PROOF-INF/BUILD.sh
104 @rm -rf par-tmp
105 @echo "INFO: Testing succeeded (already cleaned up)"