Fixes for the creation of PAR files on Mac (Chiara, Gerri)
[u/mrichter/AliRoot.git] / TTherminator / Makefile
1 # $Id$
2
3 include $(ROOTSYS)/test/Makefile.arch
4
5 default-target: libTTherminator.so
6
7 ALICEINC      = -I. -I$(ALICE_ROOT)/include -ITherminator
8
9 ### define include dir for local case and par case
10 ifneq ($(ALICE_ROOT),)
11   ALICEINC += -I$(ALICE_ROOT)/include -I$(ALICE_ROOT)/PYTHIA6 -I$(ALICE_ROOT)/EVGEN -I$(ALICE_ROOT)/RAW -I$(ALICE_ROOT)/TPC
12 else
13   ifneq ($(STEERBase_INCLUDE),)
14     ALICEINC += -I../$(STEERBase_INCLUDE)
15   endif
16   ifneq ($(ESD_INCLUDE),)
17     ALICEINC += -I../$(ESD_INCLUDE)
18   endif
19 endif
20
21 PACKAGE = TTherminator
22
23 DHDR =
24 HDRS =
25 SRCS =
26 FSRCS =
27 DHDR_TTherminator := $(DHDR)
28 HDRS_TTherminator := $(HDRS)
29 SRCS_TTherminator := $(SRCS) G__$(PACKAGE).cxx
30 OBJS_TTherminator := $(SRCS_TTherminator:.cxx=.o)
31
32 PARFILE       = $(PACKAGE).par
33
34 lib$(PACKAGE).so: $(OBJS_TTherminator)
35         @echo "Linking" $@ ...
36         @/bin/rm -f $@
37 ifeq ($(PLATFORM),macosx)
38 # We need to make both the .dylib and the .so
39                 $(LD) $(SOFLAGS)$@ $(LDFLAGS) $^ $(OutPutOpt) $@
40 ifneq ($(subst $(MACOSX_MINOR),,1234),1234)
41 ifeq ($(MACOSX_MINOR),4)
42                 ln -sf $@ $(subst .$(DllSuf),.so,$@)
43 else
44                 $(LD) -bundle -undefined $(UNDEFOPT) $(LDFLAGS) $^ \
45                    $(OutPutOpt) $(subst .$(DllSuf),.so,$@)
46 endif
47 endif
48 else
49 ifeq ($(PLATFORM),win32)
50                 bindexplib $* $^ > $*.def
51                 lib -nologo -MACHINE:IX86 $^ -def:$*.def \
52                    $(OutPutOpt)$(EVENTLIB)
53                 $(LD) $(SOFLAGS) $(LDFLAGS) $^ $*.exp $(LIBS) \
54                    $(OutPutOpt)$@
55 else
56                 $(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
57 endif
58 endif
59         @chmod a+x $@
60         @echo "done"
61
62 %.o:    %.cxx %.h
63         $(CXX) $(CXXFLAGS) -c $< -o $@ $(ALICEINC)
64
65 G__TTherminator.cxx G__TTherminator.h: $(HDRS_TTherminator) $(DHDR_TTherminator)
66         @echo "Generating dictionary ..."
67         rootcint -f $@ -c $(ALICEINC) $^
68
69 clean:
70         @rm -f $(OBJS_TTherminator) *.so G__TTherminator.* $(PARFILE)
71
72 ### CREATE PAR FILE
73
74 $(PARFILE): $(patsubst %,$(PACKAGE)/%,$(filter-out G__%, $(HDRS_TTherminator) $(SRCS_TTherminator) $(DHDR_TTherminator) Makefile Makefile.arch lib$(PACKAGE).pkg PROOF-INF))
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
100 test-%.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)"
106