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