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