Changes towards speeding up the code. Thanks to Marian Ivanov.
[u/mrichter/AliRoot.git] / build / module.tpl
CommitLineData
f0a26826 1
f347de98 2
f0a26826 3ifndef PACKFFLAGS
4@PACKAGE@FFLAGS:=$(FFLAGS)
5else
6@PACKAGE@FFLAGS:=$(PACKFFLAGS)
7endif
8
9ifndef PACKCFLAGS
10@PACKAGE@CFLAGS:=$(CFLAGS)
11else
12@PACKAGE@CFLAGS:=$(PACKCFLAGS)
13endif
14
15ifndef PACKCXXFLAGS
16@PACKAGE@CXXFLAGS:=$(CXXFLAGS)
17else
18@PACKAGE@CXXFLAGS:=$(PACKCXXFLAGS)
19endif
20
21
22ifdef DHDR
23WITHDICT=YES
24else
25WITHDICT=
26endif
27
f347de98 28# Headerfiles exported to common place:
29@PACKAGE@EXPORT:=$(EXPORT)
30@PACKAGE@EXPORTDEST:=$(patsubst %,$(EXPORTDIR)/%,$(EXPORT))
31
32
f0a26826 33#Extra include,libs etc.
f347de98 34
35@PACKAGE@INC:=$(patsubst %,-I%,$(EINCLUDE)) -I@MODULE@
36
f0a26826 37@PACKAGE@ELIBS:=$(patsubst %,-l%,$(ELIBS))
38@PACKAGE@ELIBSDIR:=$(patsubst %,-L%,$(ELIBSDIR))
39
40#c sources and headers
41
42@PACKAGE@CS:=$(patsubst %,$(MODDIR)/%,$(CSRCS))
43@PACKAGE@CH:=$(patsubst %,$(MODDIR)/%,$(CHDRS))
44
45#Fortran sources
46@PACKAGE@FS:=$(patsubst %,$(MODDIR)/%,$(FSRCS))
47
48#c++ sources and header
49@PACKAGE@S:=$(patsubst %,$(MODDIR)/%,$(SRCS))
f347de98 50@PACKAGE@H:=$(patsubst %,$(MODDIR)/%,$(HDRS)) $(EHDRS)
51
52#############################################################################
53#
54# If special rootcint headerfiles is specified use them
55# else use all headers
f0a26826 56
f347de98 57ifndef CINTHDRS
58@PACKAGE@CINTHDRS:=$(@PACKAGE@H)
59else
60@PACKAGE@CINTHDRS:=$(CINTHDRS)
61endif
62#############################################################################
f0a26826 63
64# Package Dictionary
65
66@PACKAGE@DH:=$(MODDIR)/$(DHDR)
67
68
69#All objects
70@PACKAGE@CO:=$(patsubst %,$(MODDIRO)/%, $(CSRCS:.c=.o))
71TEMP:=$(FSRCS:.F=.o)
72@PACKAGE@FO:=$(patsubst %,$(MODDIRO)/%, $(TEMP:.f=.o))
73@PACKAGE@O:= $(patsubst %,$(MODDIRO)/%, $(SRCS:.cxx=.o)) $(@PACKAGE@FO) $(@PACKAGE@CO)
74
d47d6108 75
76
f0a26826 77ifdef WITHDICT
78 @PACKAGE@DS:=$(MODDIRO)/G__@PACKAGE@.cxx
79 @PACKAGE@DO:=$(MODDIRO)/G__@PACKAGE@.o
80 @PACKAGE@DDEP:=$(@PACKAGE@DO:.o=.d)
81 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d) $(@PACKAGE@DDEP)
82else
83 @PACKAGE@DS:=
84 @PACKAGE@DO:=
85 @PACKAGE@DDEP:=
86 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d)
87endif
88
89
90#The actual library file
91
92@PACKAGE@LIB:=$(LIBPATH)/lib@PACKAGE@.$(SOEXT)
93
d47d6108 94#Add this to the modules libs
95@MODULE@LIBS += $(@PACKAGE@LIB)
96
f0a26826 97#The actual binary file
98
99@PACKAGE@BIN:=$(BINPATH)/@PACKAGE@
100
d47d6108 101#Add to modules list of binaries
102@MODULE@BINS += $(@PACKAGE@BIN)
f0a26826 103
f347de98 104# Use in the main Makefile
f0a26826 105
106ifeq ($(TYPE),lib)
107ALLLIBS += $(@PACKAGE@LIB)
108BINLIBS += -l@PACKAGE@
109else
110ALLEXECS += $(@PACKAGE@BIN)
111endif
112
113# include all dependency files
114INCLUDEFILES +=$(@PACKAGE@DEP)
115
f347de98 116EXPORTFILES += $(@PACKAGE@EXPORTDEST)
f0a26826 117
118#local rules
119
f347de98 120#The exportfiles only include if any!!
121
122ifdef @PACKAGE@EXPORT
896cb507 123#$(@PACKAGE@EXPORTDEST): $(patsubst %,@MODULE@/%,$(@PACKAGE@EXPORT))
124
125$(@PACKAGE@EXPORTDEST): $(EXPORTDIR)/%.h: @MODULE@/%.h
15142e2f 126ifndef ALIQUIET
ca816b72 127 @echo "***** Copying file @MODULE@/$(notdir $@) to $@ *****"
15142e2f 128endif
f347de98 129 @[ -d $(dir $@) ] || mkdir $(dir $@)
896cb507 130 @cp @MODULE@/$(notdir $@) $@
f347de98 131endif
132
f0a26826 133$(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 134ifndef ALIQUIET
f0a26826 135 @echo "***** Linking library $@ *****"
15142e2f 136endif
137 $(MUTE)$(SHLD) $(SOFLAGS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) -o $@ $(@PACKAGE@O) $(@PACKAGE@DO) $(SHLIB)
f347de98 138
f0a26826 139$(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 140ifndef ALIQUIET
141 @echo "***** Making executable $@ *****"
142endif
143 $(MUTE)$(LD) $(LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(LIBS) $(@PACKAGE@ELIBS) $(EXEFLAGS) -o $@
f0a26826 144
6bb8c070 145$(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) @MODULE@/module.mk
15142e2f 146ifndef ALIQUIET
f0a26826 147 @echo "***** Creating $@ *****";
15142e2f 148endif
f0a26826 149 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
6bb8c070 150 $(MUTE)rootcint -f $@ -c $(CINTFLAGS) $(@PACKAGE@INC) $(shell echo $^ | sed -e 's/@MODULE@\/module\.mk//')
f0a26826 151
152$(@PACKAGE@DO): $(@PACKAGE@DS)
15142e2f 153ifndef ALIQUIET
154 @echo "***** Compiling $< *****";
155endif
156 $(MUTE)$(CXX) -c $(@PACKAGE@INC) -I$(ALICE_ROOT) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 157
158#Different targets for the module
159
160all-@PACKAGE@: $(@PACKAGE@LIB)
161
f0a26826 162depend-@PACKAGE@: $(@PACKAGE@DEP)
163
164# determination of object files
165$(MODDIRO)/%.o: $(MODDIR)/%.cxx $(MODDIRO)/%.d
15142e2f 166ifndef ALIQUIET
167 @echo "***** Compiling $< *****";
168endif
f0a26826 169 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 170 $(MUTE)$(CXX) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 171
172$(MODDIRO)/%.o: $(MODDIR)/%.F $(MODDIRO)/%.d
15142e2f 173ifndef ALIQUIET
174 @echo "***** Compiling $< *****";
175endif
f0a26826 176 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 177 $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
f0a26826 178
179$(MODDIRO)/%.o: $(MODDIR)/%.f $(MODDIRO)/%.d
15142e2f 180ifndef ALIQUIET
181 @echo "***** Compiling $< *****";
182endif
f0a26826 183 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 184 $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
f0a26826 185
186$(MODDIRO)/%.o: $(MODDIR)/%.c $(MODDIRO)/%.d
15142e2f 187ifndef ALIQUIET
188 @echo "***** Compiling $< *****";
189endif
f0a26826 190 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 191 $(MUTE)$(CC) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CFLAGS)
f0a26826 192
193$(@PACKAGE@DDEP): $(@PACKAGE@DS)
15142e2f 194ifndef ALIQUIET
f0a26826 195 @echo "***** Making dependencies for $< *****";
15142e2f 196endif
f0a26826 197 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
198 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
199
d47d6108 200$(MODDIRO)/%.d: $(MODDIRS)/%.cxx
15142e2f 201ifndef ALIQUIET
f0a26826 202 @echo "***** Making dependencies for $< *****";
15142e2f 203endif
f0a26826 204 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 205 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
206$(MODDIRO)/%.d: $(MODDIRS)/%.f
15142e2f 207ifndef ALIQUIET
f0a26826 208 @echo "***** Making dependencies for $< *****";
15142e2f 209endif
f0a26826 210 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 211 @share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
212$(MODDIRO)/%.d: $(MODDIRS)/%.F
15142e2f 213ifndef ALIQUIET
f0a26826 214 @echo "***** Making dependencies for $< *****";
15142e2f 215endif
f0a26826 216 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 217 $(MUTE)share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
896cb507 218$(MODDIRO)/%.d: $(MODDIRS)/%.c
15142e2f 219ifndef ALIQUIET
f0a26826 220 @echo "***** Making dependencies for $< *****";
15142e2f 221endif
f0a26826 222 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 223 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@