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