Correction for bug #77355: Generation of PARs
[u/mrichter/AliRoot.git] / EMCAL / Makefile
CommitLineData
07d5ad6b 1# $Id: Makefile 33076 2009-06-19 16:40:17Z akisiel $
2
3include $(ROOTSYS)/test/Makefile.arch
4
5PACKAGE = EMCAL
6
7default-target: lib$(PACKAGE).so
8
9ALICEINC = -I.
10
11### define include dir for local case and par case
12
6b527f8f 13### in case of Root compilation for ANALYSIS, only load EMCALUtils
14### if modification of EMCAL libraries, include STEER and RAW
45040bd3 15ifneq ($(STEERBase_INCLUDE),)
16 ALICEINC += -I../$(STEERBase_INCLUDE)
bd8c7aef 17 ALICEINC += -I../$(ESD_INCLUDE)
18 ALICEINC += -I../$(AOD_INCLUDE)
6b527f8f 19else
20 ALICEINC += -I$(ALICE_ROOT)/include
21 ALICEINC += -I$(ALICE_ROOT)/STEER
22 ALICEINC += -I$(ALICE_ROOT)/RAW
23 ALICEINC += -I$(ALICE_ROOT)/VZERO
45040bd3 24endif
25
6b527f8f 26### in modification of EMCAL libraries, and not modification of EMCALUtils, include EMCAL from aliroot
07d5ad6b 27ifneq ($(EMCALUtils_INCLUDE),)
28 ALICEINC += -I../$(EMCALUtils_INCLUDE)
6b527f8f 29else
30 ALICEINC += -I$(ALICE_ROOT)/EMCAL
07d5ad6b 31endif
32
33ifneq ($(EMCALbase_INCLUDE),)
34 ALICEINC += -I../$(EMCALbase_INCLUDE)
35endif
36
37ifneq ($(EMCALsim_INCLUDE),)
38 ALICEINC += -I../$(EMCALsim_INCLUDE)
39endif
40
41ifneq ($(EMCALrec_INCLUDE),)
42 ALICEINC += -I../$(EMCALrec_INCLUDE)
43endif
44
45# only if no par file was loaded before
46ifeq ($(ALICEINC),-I.)
47 ifneq ($(ALICE_ROOT),)
48 ALICEINC += -I$(ALICE_ROOT)/include
49 ALICEINC += -I$(ALICE_ROOT)/STEER
50 ALICEINC += -I$(ALICE_ROOT)/RAW
51 ALICEINC += -I$(ALICE_ROOT)/EMCAL
52 endif
53endif
54
55
56CXXFLAGS += $(ALICEINC) -g
57F77FLAGS += $(ALICEINC) -g -fPIC
58
59
958d9d26 60SRCS = $(wildcard *.cxx */*.cxx)
61HDRS = $(SRCS:.cxx=.h)
62DHDR = $(PACKAGE)LinkDef.h
07d5ad6b 63
64DHDR_EMCAL := $(DHDR)
65HDRS_EMCAL := $(HDRS)
66SRCS_EMCAL := $(SRCS) G__$(PACKAGE).cxx
67FSCRS_EMCAL := $(FSRCS)
68OBJS_EMCAL := $(SRCS_EMCAL:.cxx=.o) $(FSRCS:.F=.o)
69
70PARFILE = $(PACKAGE).par
71
72lib$(PACKAGE).so: $(OBJS_EMCAL)
73 @echo "Linking" $@ ...
74 @/bin/rm -f $@
75ifeq ($(ARCH),macosx)
76 @$(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ -o $@
77else
78 @$(LD) $(SOFLAGS) $(LDFLAGS) $^ -o $@
79endif
80 @chmod a+x $@
81 @echo "done"
82
83%.o: %.cxx %.h
84 $(CXX) $(CXXFLAGS) -c $< -o $@
85
86%.o: %.F
87 $(F77) $(F77FLAGS) -c $< -o $@
88
89G__$(PACKAGE).cxx G__$(PACKAGE).h: $(HDRS_EMCAL) $(DHDR_EMCAL)
90 @echo "Generating dictionary ..."
91 rootcint -f $@ -c $(CINTFLAGS) $(ALICEINC) $^
92
93clean:
94 @rm -f $(OBJS_EMCAL) *.so G__$(PACKAGE).* $(PARFILE)
95
96### CREATE PAR FILE
97
84d4333f 98$(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_EMCAL) $(SRCS_EMCAL) $(DHDR_EMCAL) Makefile Makefile.arch PROOF-INF))
07d5ad6b 99 @echo "Creating archive" $@ ...
100 @tar cfzh $@ $(PACKAGE)
101 @rm -rf $(PACKAGE)
102 @echo "done"
103
104$(PACKAGE)/Makefile: Makefile #.$(PACKAGE)
105 @echo Copying $< to $@ with transformations
106 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
107 @sed 's/include \$$(ROOTSYS)\/test\/Makefile.arch/include Makefile.arch/' < $^ > $@
108
109$(PACKAGE)/Makefile.arch: $(ROOTSYS)/test/Makefile.arch
110 @echo Copying $< to $@
111 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
112 @cp -a $^ $@
113
114$(PACKAGE)/PROOF-INF: PROOF-INF.$(PACKAGE)
115 @echo Copying $< to $@
116 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
117 @cp -a -r $^ $@
118
119$(PACKAGE)/%: %
120 @echo Copying $< to $@
121 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
122 @cp -a $< $@
123
124test-%.par: %.par
125 @echo "INFO: The file $< is now tested, in case of an error check in par-tmp."
126 @mkdir -p par-tmp
127 @cd par-tmp; tar xfz ../$<; cd $(subst .par,,$<); PROOF-INF/BUILD.sh
128 @rm -rf par-tmp
129 @echo "INFO: Testing succeeded (already cleaned up)"