D+ -> K pipi added. (A. Dainese)
[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
88cb7938 21ifndef PACKSOFLAGS
22@PACKAGE@SOFLAGS:=$(SOFLAGS)
23else
24@PACKAGE@SOFLAGS:=$(PACKSOFLAGS)
25endif
26
27ifdef DYEXT
28ifndef PACKDYFLAGS
29@PACKAGE@DYFLAGS:=$(DYFLAGS)
30else
31@PACKAGE@DYFLAGS:=$(PACKDYFLAGS)
32endif
33endif
34
810722e6 35ifndef PACKDCXXFLAGS
36ifeq ($(PLATFORM),linuxicc)
37@PACKAGE@DCXXFLAGS:=$(filter-out -O%,$(CXXFLAGS)) -O0
38else
39@PACKAGE@DCXXFLAGS:=$(filter-out -O%,$(CXXFLAGS))
40endif
41else
42@PACKAGE@DCXXFLAGS:=$(PACKCXXFLAGS)
43endif
44
f0a26826 45
46ifdef DHDR
47WITHDICT=YES
48else
49WITHDICT=
50endif
51
f347de98 52# Headerfiles exported to common place:
53@PACKAGE@EXPORT:=$(EXPORT)
54@PACKAGE@EXPORTDEST:=$(patsubst %,$(EXPORTDIR)/%,$(EXPORT))
55
56
67fd7264 57#Extra include,libs, defines etc.
58
59@PACKAGE@DEFINE:=$(EDEFINE)
f347de98 60
61@PACKAGE@INC:=$(patsubst %,-I%,$(EINCLUDE)) -I@MODULE@
62
f0a26826 63@PACKAGE@ELIBS:=$(patsubst %,-l%,$(ELIBS))
64@PACKAGE@ELIBSDIR:=$(patsubst %,-L%,$(ELIBSDIR))
65
66#c sources and headers
67
68@PACKAGE@CS:=$(patsubst %,$(MODDIR)/%,$(CSRCS))
69@PACKAGE@CH:=$(patsubst %,$(MODDIR)/%,$(CHDRS))
70
71#Fortran sources
72@PACKAGE@FS:=$(patsubst %,$(MODDIR)/%,$(FSRCS))
73
74#c++ sources and header
75@PACKAGE@S:=$(patsubst %,$(MODDIR)/%,$(SRCS))
f347de98 76@PACKAGE@H:=$(patsubst %,$(MODDIR)/%,$(HDRS)) $(EHDRS)
77
eec15521 78#c++ source subdirectories
79@PACKAGE@SDIR:=$(SUBDIR)
80
f347de98 81#############################################################################
82#
83# If special rootcint headerfiles is specified use them
84# else use all headers
f0a26826 85
f347de98 86ifndef CINTHDRS
87@PACKAGE@CINTHDRS:=$(@PACKAGE@H)
88else
89@PACKAGE@CINTHDRS:=$(CINTHDRS)
90endif
91#############################################################################
f0a26826 92
93# Package Dictionary
94
95@PACKAGE@DH:=$(MODDIR)/$(DHDR)
96
97
98#All objects
99@PACKAGE@CO:=$(patsubst %,$(MODDIRO)/%, $(CSRCS:.c=.o))
100TEMP:=$(FSRCS:.F=.o)
101@PACKAGE@FO:=$(patsubst %,$(MODDIRO)/%, $(TEMP:.f=.o))
102@PACKAGE@O:= $(patsubst %,$(MODDIRO)/%, $(SRCS:.cxx=.o)) $(@PACKAGE@FO) $(@PACKAGE@CO)
103
d47d6108 104
105
f0a26826 106ifdef WITHDICT
107 @PACKAGE@DS:=$(MODDIRO)/G__@PACKAGE@.cxx
108 @PACKAGE@DO:=$(MODDIRO)/G__@PACKAGE@.o
109 @PACKAGE@DDEP:=$(@PACKAGE@DO:.o=.d)
110 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d) $(@PACKAGE@DDEP)
111else
112 @PACKAGE@DS:=
113 @PACKAGE@DO:=
114 @PACKAGE@DDEP:=
115 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d)
116endif
117
118
119#The actual library file
120
121@PACKAGE@LIB:=$(LIBPATH)/lib@PACKAGE@.$(SOEXT)
40c469d5 122
123ifneq ($(DYEXT),)
124@PACKAGE@DLIB:=$(LIBPATH)/lib@PACKAGE@.$(DYEXT)
125endif
126
2d8cad5a 127@PACKAGE@ALIB:=$(LIBPATH)/lib@PACKAGE@.$(AEXT)
f0a26826 128
d47d6108 129#Add this to the modules libs
130@MODULE@LIBS += $(@PACKAGE@LIB)
2d8cad5a 131@MODULE@ALIBS += $(@PACKAGE@ALIB)
40c469d5 132ifneq ($(DYEXT),)
133@MODULE@DLIBS += $(@PACKAGE@DLIB)
134endif
d47d6108 135
f0a26826 136#The actual binary file
137
138@PACKAGE@BIN:=$(BINPATH)/@PACKAGE@
139
d47d6108 140#Add to modules list of binaries
141@MODULE@BINS += $(@PACKAGE@BIN)
f0a26826 142
f347de98 143# Use in the main Makefile
f0a26826 144
145ifeq ($(TYPE),lib)
146ALLLIBS += $(@PACKAGE@LIB)
2d8cad5a 147ALLALIBS += $(@PACKAGE@ALIB)
40c469d5 148ifneq ($(DYEXT),)
149ALLLIBS += $(@PACKAGE@DLIB)
150endif
f0a26826 151BINLIBS += -l@PACKAGE@
152else
153ALLEXECS += $(@PACKAGE@BIN)
154endif
155
40c469d5 156ifeq ($(DYEXT),)
157@PACKAGE@LIB := $(@PACKAGE@LIB)
158else
159@PACKAGE@LIB := $(@PACKAGE@LIB)
160endif
161
f0a26826 162# include all dependency files
163INCLUDEFILES +=$(@PACKAGE@DEP)
164
f347de98 165EXPORTFILES += $(@PACKAGE@EXPORTDEST)
f0a26826 166
167#local rules
168
f347de98 169#The exportfiles only include if any!!
170
171ifdef @PACKAGE@EXPORT
896cb507 172#$(@PACKAGE@EXPORTDEST): $(patsubst %,@MODULE@/%,$(@PACKAGE@EXPORT))
173
174$(@PACKAGE@EXPORTDEST): $(EXPORTDIR)/%.h: @MODULE@/%.h
15142e2f 175ifndef ALIQUIET
ba419e66 176 @echo "***** Copying file $^ to $@ *****"
15142e2f 177endif
f347de98 178 @[ -d $(dir $@) ] || mkdir $(dir $@)
ba419e66 179 @cp $^ $@
f347de98 180endif
181
88cb7938 182#------------------------------------------------------------------------
183
f0a26826 184$(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 185ifndef ALIQUIET
f0a26826 186 @echo "***** Linking library $@ *****"
15142e2f 187endif
faeab8a4 188 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
189 export TMPDIR; mkdir $$TMPDIR ; cd $$TMPDIR ; \
190 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
043a26ce 191 \rm -f $(CURDIR)/$@ ;\
7930dd19 192 TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\
ce4e6d58 193 $(SHLD) $(@PACKAGE@SOFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(SHLIB);\
194 chmod a-w $(CURDIR)/$@ ;\
fe250300 195 cd $(ALICE_ROOT) ; \rm -rf $$TMPDIR
810722e6 196
40c469d5 197ifneq ($(DYEXT),)
198$(@PACKAGE@DLIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
199ifndef ALIQUIET
200 @echo "***** Linking library $@ *****"
201endif
202 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
203 export TMPDIR; mkdir $$TMPDIR ; cd $$TMPDIR ; \
204 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
fe250300 205 \rm -f $(CURDIR)/$@ ;\
ce4e6d58 206 $(DYLD) $(@PACKAGE@DYFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(DYLIB);\
207 chmod a-w $(CURDIR)/$@ ;\
fe250300 208 cd $(ALICE_ROOT) ; \rm -rf $$TMPDIR
40c469d5 209endif
210
88cb7938 211#------------------------------------------------------------------------
212
2d8cad5a 213$(@PACKAGE@ALIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
214ifndef ALIQUIET
215 @echo "***** Linking static library $@ *****"
216endif
217 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
218 export TMPDIR; mkdir $$TMPDIR ; cd $$TMPDIR ; \
219 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
7930dd19 220 \rm -f $(CURDIR)/$@ ;\
221 TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\
043a26ce 222 $(ALLD) $(ALFLAGS) $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(ALLIB);\
223 cd $(CURDIR) ; \rm -rf $$TMPDIR
2d8cad5a 224 $(MUTE)chmod a-w $@
225
226
f0a26826 227$(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 228ifndef ALIQUIET
229 @echo "***** Making executable $@ *****"
230endif
2d8cad5a 231ifeq ($(ALIPROFILE),YES)
2d8cad5a 232 $(MUTE)$(LD) $(LDFLAGS) $(@PACKAGE@O) $(ARLIBS) $(SHLIBS) $(LIBS) $(EXEFLAGS) -o $@
2d8cad5a 233else
234 $(MUTE)$(LD) $(LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(LIBS) $(EXEFLAGS) -o $@
235endif
f0a26826 236
6bb8c070 237$(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) @MODULE@/module.mk
15142e2f 238ifndef ALIQUIET
f0a26826 239 @echo "***** Creating $@ *****";
15142e2f 240endif
f0a26826 241 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
043a26ce 242 @\rm -f $(patsubst %.cxx,%.d, $@)
67fd7264 243 $(MUTE)rootcint -f $@ -c $(@PACKAGE@DEFINE) $(CINTFLAGS) $(@PACKAGE@INC) $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH)
f0a26826 244
245$(@PACKAGE@DO): $(@PACKAGE@DS)
15142e2f 246ifndef ALIQUIET
247 @echo "***** Compiling $< *****";
248endif
810722e6 249 $(MUTE)$(CXX) -c $(@PACKAGE@INC) -I$(ALICE_ROOT) $< -o $@ $(@PACKAGE@DCXXFLAGS)
f0a26826 250
251#Different targets for the module
252
5edd655b 253ifeq ($(TYPE),lib)
5864aa62 254all-@PACKAGE@: $(@PACKAGE@LIB)
40c469d5 255ifneq ($(DYEXT),)
256all-@PACKAGE@: $(@PACKAGE@DLIB)
257endif
5edd655b 258else
259all-@PACKAGE@: $(@PACKAGE@BIN)
260endif
261
f0a26826 262depend-@PACKAGE@: $(@PACKAGE@DEP)
263
264# determination of object files
82910ea7 265$(MODDIRO)/%.o: $(MODDIRO)/%.cxx $(MODDIRO)/%.d
266ifndef ALIQUIET
267 @echo "***** Compiling $< *****";
268endif
269 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
270 $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
271
f0a26826 272$(MODDIRO)/%.o: $(MODDIR)/%.cxx $(MODDIRO)/%.d
15142e2f 273ifndef ALIQUIET
274 @echo "***** Compiling $< *****";
275endif
f0a26826 276 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 277 $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 278
279$(MODDIRO)/%.o: $(MODDIR)/%.F $(MODDIRO)/%.d
15142e2f 280ifndef ALIQUIET
281 @echo "***** Compiling $< *****";
282endif
f0a26826 283 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 284 $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
f0a26826 285
286$(MODDIRO)/%.o: $(MODDIR)/%.f $(MODDIRO)/%.d
15142e2f 287ifndef ALIQUIET
288 @echo "***** Compiling $< *****";
289endif
f0a26826 290 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 291 $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
f0a26826 292
293$(MODDIRO)/%.o: $(MODDIR)/%.c $(MODDIRO)/%.d
15142e2f 294ifndef ALIQUIET
295 @echo "***** Compiling $< *****";
296endif
f0a26826 297 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 298 $(MUTE)$(CC) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CFLAGS)
f0a26826 299
300$(@PACKAGE@DDEP): $(@PACKAGE@DS)
15142e2f 301ifndef ALIQUIET
f0a26826 302 @echo "***** Making dependencies for $< *****";
15142e2f 303endif
f0a26826 304 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
305 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
306
d47d6108 307$(MODDIRO)/%.d: $(MODDIRS)/%.cxx
15142e2f 308ifndef ALIQUIET
f0a26826 309 @echo "***** Making dependencies for $< *****";
15142e2f 310endif
f0a26826 311 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 312 @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
896cb507 313$(MODDIRO)/%.d: $(MODDIRS)/%.f
15142e2f 314ifndef ALIQUIET
f0a26826 315 @echo "***** Making dependencies for $< *****";
15142e2f 316endif
f0a26826 317 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 318 @share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
319$(MODDIRO)/%.d: $(MODDIRS)/%.F
15142e2f 320ifndef ALIQUIET
f0a26826 321 @echo "***** Making dependencies for $< *****";
15142e2f 322endif
f0a26826 323 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 324 $(MUTE)share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
896cb507 325$(MODDIRO)/%.d: $(MODDIRS)/%.c
15142e2f 326ifndef ALIQUIET
f0a26826 327 @echo "***** Making dependencies for $< *****";
15142e2f 328endif
f0a26826 329 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 330 @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
b9d0a01d 331
7e96fcc7 332@PACKAGE@CHECKS := $(patsubst %.cxx,@MODULE@/check/%.viol,$(SRCS))
b9d0a01d 333
7e96fcc7 334check-@MODULE@: $(@PACKAGE@CHECKS)
b9d0a01d 335
336# IRST coding rule check
7e96fcc7 337@MODULE@/check/%.i : @MODULE@/%.cxx
b9d0a01d 338 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
339 $(MUTE)$(CXX) -E $(@PACKAGE@DEFINE) $(@PACKAGE@INC) $< > $@ $(@PACKAGE@CXXFLAGS)
340 @cd $(dir $@) ; $(IRST_INSTALLDIR)/patch/patch4alice.prl $(notdir $@)
341
eec15521 342# IRST coding rule check
343@MODULE@/check/$(SUBDIR)/%.viol : @MODULE@/check/$(SUBDIR)/%.i
344 @cd @MODULE@ ; [ -r @MODULE@ ] || ln -s ../@MODULE@ @MODULE@
345 -@echo $@ ; $(CODE_CHECK) $< ./@MODULE@/$(@PACKAGE@SDIR) > $@
346
b9d0a01d 347# IRST coding rule check
7e96fcc7 348@MODULE@/check/%.viol : @MODULE@/check/%.i
349 @cd @MODULE@ ; [ -r @MODULE@ ] || ln -s ../@MODULE@ @MODULE@
350 -@echo $@ ; $(CODE_CHECK) $< ./@MODULE@ > $@
b9d0a01d 351
352@PACKAGE@PREPROC = $(patsubst %.viol,%.i,$(@PACKAGE@CHECKS))
353
354@PACKAGE@REVENGS = $(patsubst %.viol,%.ii,$(@PACKAGE@CHECKS))
355
356.SECONDARY: $(@PACKAGE@REVENGS) $(@PACKAGE@PREPROC)
357
358reveng-@PACKAGE@: @PACKAGE@/check/classDiagram.dot
359
360@PACKAGE@/check/classDiagram.dot: $(@PACKAGE@PREPROC)
361 @$(REV_ENG) $^
362 @-mv classDiagram.dot $@
363
364revdisp-@PACKAGE@: reveng-@PACKAGE@
365 @echo revdisp for @PACKAGE@
366 @cd @PACKAGE@/check ; \
367 $(IRST_INSTALLDIR)/webreveng/create-class-diagram-pages.sh
368 @sed -e "s/\@PACKAGE\@/@PACKAGE@/g" < $(ALICE_ROOT)/build/HomePage.html > @PACKAGE@/check/HomePage.html
369