Mods for MacOSX
[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
651e35f1 36ifndef PACKLDFLAGS
37@PACKAGE@LDFLAGS:=$(LDFLAGS)
38else
39@PACKAGE@LDFLAGS:=$(PACKLDFLAGS)
40endif
41
810722e6 42ifndef PACKDCXXFLAGS
19ca05d1 43@PACKAGE@DCXXFLAGS:=$(CXXFLAGSNO)
810722e6 44else
117cfc60 45@PACKAGE@DCXXFLAGS:=$(PACKDCXXFLAGS)
810722e6 46endif
47
f0a26826 48
49ifdef DHDR
50WITHDICT=YES
51else
52WITHDICT=
53endif
54
f347de98 55# Headerfiles exported to common place:
56@PACKAGE@EXPORT:=$(EXPORT)
57@PACKAGE@EXPORTDEST:=$(patsubst %,$(EXPORTDIR)/%,$(EXPORT))
58
59
67fd7264 60#Extra include,libs, defines etc.
61
2603dcc4 62@PACKAGE@DEFINE:=$(EDEFINE) -D__MODULE__=\"@MODULE@\"
f347de98 63
64@PACKAGE@INC:=$(patsubst %,-I%,$(EINCLUDE)) -I@MODULE@
65
f0a26826 66@PACKAGE@ELIBS:=$(patsubst %,-l%,$(ELIBS))
87c71321 67@PACKAGE@ELIBSDEP:=$(patsubst %,lib/tgt_$(ALICE_TARGET)/lib%.$(SOEXT),$(ELIBS))
f0a26826 68@PACKAGE@ELIBSDIR:=$(patsubst %,-L%,$(ELIBSDIR))
69
70#c sources and headers
71
72@PACKAGE@CS:=$(patsubst %,$(MODDIR)/%,$(CSRCS))
73@PACKAGE@CH:=$(patsubst %,$(MODDIR)/%,$(CHDRS))
74
75#Fortran sources
76@PACKAGE@FS:=$(patsubst %,$(MODDIR)/%,$(FSRCS))
77
78#c++ sources and header
79@PACKAGE@S:=$(patsubst %,$(MODDIR)/%,$(SRCS))
f347de98 80@PACKAGE@H:=$(patsubst %,$(MODDIR)/%,$(HDRS)) $(EHDRS)
81
eec15521 82#c++ source subdirectories
83@PACKAGE@SDIR:=$(SUBDIR)
84
f347de98 85#############################################################################
86#
87# If special rootcint headerfiles is specified use them
88# else use all headers
f0a26826 89
f347de98 90ifndef CINTHDRS
91@PACKAGE@CINTHDRS:=$(@PACKAGE@H)
92else
93@PACKAGE@CINTHDRS:=$(CINTHDRS)
94endif
95#############################################################################
f0a26826 96
97# Package Dictionary
98
99@PACKAGE@DH:=$(MODDIR)/$(DHDR)
100
101
102#All objects
103@PACKAGE@CO:=$(patsubst %,$(MODDIRO)/%, $(CSRCS:.c=.o))
104TEMP:=$(FSRCS:.F=.o)
105@PACKAGE@FO:=$(patsubst %,$(MODDIRO)/%, $(TEMP:.f=.o))
106@PACKAGE@O:= $(patsubst %,$(MODDIRO)/%, $(SRCS:.cxx=.o)) $(@PACKAGE@FO) $(@PACKAGE@CO)
107
d47d6108 108
109
f0a26826 110ifdef WITHDICT
111 @PACKAGE@DS:=$(MODDIRO)/G__@PACKAGE@.cxx
112 @PACKAGE@DO:=$(MODDIRO)/G__@PACKAGE@.o
113 @PACKAGE@DDEP:=$(@PACKAGE@DO:.o=.d)
114 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d) $(@PACKAGE@DDEP)
115else
116 @PACKAGE@DS:=
117 @PACKAGE@DO:=
118 @PACKAGE@DDEP:=
119 @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d)
120endif
121
122
123#The actual library file
124
125@PACKAGE@LIB:=$(LIBPATH)/lib@PACKAGE@.$(SOEXT)
40c469d5 126
127ifneq ($(DYEXT),)
128@PACKAGE@DLIB:=$(LIBPATH)/lib@PACKAGE@.$(DYEXT)
129endif
130
2d8cad5a 131@PACKAGE@ALIB:=$(LIBPATH)/lib@PACKAGE@.$(AEXT)
f0a26826 132
d47d6108 133#Add this to the modules libs
134@MODULE@LIBS += $(@PACKAGE@LIB)
2d8cad5a 135@MODULE@ALIBS += $(@PACKAGE@ALIB)
40c469d5 136ifneq ($(DYEXT),)
137@MODULE@DLIBS += $(@PACKAGE@DLIB)
138endif
d47d6108 139
f0a26826 140#The actual binary file
141
142@PACKAGE@BIN:=$(BINPATH)/@PACKAGE@
143
d47d6108 144#Add to modules list of binaries
145@MODULE@BINS += $(@PACKAGE@BIN)
f0a26826 146
f347de98 147# Use in the main Makefile
f0a26826 148
149ifeq ($(TYPE),lib)
150ALLLIBS += $(@PACKAGE@LIB)
2d8cad5a 151ALLALIBS += $(@PACKAGE@ALIB)
40c469d5 152ifneq ($(DYEXT),)
153ALLLIBS += $(@PACKAGE@DLIB)
154endif
f0a26826 155BINLIBS += -l@PACKAGE@
156else
157ALLEXECS += $(@PACKAGE@BIN)
158endif
159
40c469d5 160ifeq ($(DYEXT),)
161@PACKAGE@LIB := $(@PACKAGE@LIB)
162else
163@PACKAGE@LIB := $(@PACKAGE@LIB)
164endif
165
87c71321 166# include all dependence files
f0a26826 167INCLUDEFILES +=$(@PACKAGE@DEP)
168
f347de98 169EXPORTFILES += $(@PACKAGE@EXPORTDEST)
f0a26826 170
171#local rules
172
f347de98 173#The exportfiles only include if any!!
174
175ifdef @PACKAGE@EXPORT
896cb507 176#$(@PACKAGE@EXPORTDEST): $(patsubst %,@MODULE@/%,$(@PACKAGE@EXPORT))
177
178$(@PACKAGE@EXPORTDEST): $(EXPORTDIR)/%.h: @MODULE@/%.h
15142e2f 179ifndef ALIQUIET
ba419e66 180 @echo "***** Copying file $^ to $@ *****"
15142e2f 181endif
53f2641c 182 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
ba419e66 183 @cp $^ $@
f347de98 184endif
185
88cb7938 186#------------------------------------------------------------------------
187
f0a26826 188$(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 189ifndef ALIQUIET
f0a26826 190 @echo "***** Linking library $@ *****"
15142e2f 191endif
faeab8a4 192 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
117cfc60 193 export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \
faeab8a4 194 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
043a26ce 195 \rm -f $(CURDIR)/$@ ;\
7930dd19 196 TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\
ce4e6d58 197 $(SHLD) $(@PACKAGE@SOFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(SHLIB);\
198 chmod a-w $(CURDIR)/$@ ;\
fe250300 199 cd $(ALICE_ROOT) ; \rm -rf $$TMPDIR
810722e6 200
40c469d5 201ifneq ($(DYEXT),)
202$(@PACKAGE@DLIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
203ifndef ALIQUIET
204 @echo "***** Linking library $@ *****"
205endif
206 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
117cfc60 207 export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \
40c469d5 208 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
fe250300 209 \rm -f $(CURDIR)/$@ ;\
ce4e6d58 210 $(DYLD) $(@PACKAGE@DYFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(DYLIB);\
211 chmod a-w $(CURDIR)/$@ ;\
fe250300 212 cd $(ALICE_ROOT) ; \rm -rf $$TMPDIR
40c469d5 213endif
214
88cb7938 215#------------------------------------------------------------------------
216
2d8cad5a 217$(@PACKAGE@ALIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
218ifndef ALIQUIET
219 @echo "***** Linking static library $@ *****"
220endif
221 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
117cfc60 222 export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \
2d8cad5a 223 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
7930dd19 224 \rm -f $(CURDIR)/$@ ;\
225 TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\
043a26ce 226 $(ALLD) $(ALFLAGS) $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(ALLIB);\
227 cd $(CURDIR) ; \rm -rf $$TMPDIR
2d8cad5a 228 $(MUTE)chmod a-w $@
229
230
2603dcc4 231$(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 232ifndef ALIQUIET
233 @echo "***** Making executable $@ *****"
234endif
2d8cad5a 235ifeq ($(ALIPROFILE),YES)
651e35f1 236 $(MUTE)$(LD) $(@PACKAGE@LDFLAGS) $(@PACKAGE@O) $(ARLIBS) $(SHLIBS) $(LIBS) $(EXEFLAGS) -o $@
2d8cad5a 237else
651e35f1 238 $(MUTE)$(LD) $(@PACKAGE@LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(LIBS) $(EXEFLAGS) -o $@
2d8cad5a 239endif
f0a26826 240
6bb8c070 241$(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) @MODULE@/module.mk
15142e2f 242ifndef ALIQUIET
f0a26826 243 @echo "***** Creating $@ *****";
15142e2f 244endif
f0a26826 245 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
043a26ce 246 @\rm -f $(patsubst %.cxx,%.d, $@)
67fd7264 247 $(MUTE)rootcint -f $@ -c $(@PACKAGE@DEFINE) $(CINTFLAGS) $(@PACKAGE@INC) $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH)
f0a26826 248
249$(@PACKAGE@DO): $(@PACKAGE@DS)
15142e2f 250ifndef ALIQUIET
251 @echo "***** Compiling $< *****";
252endif
117cfc60 253 $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) -I$(ALICE_ROOT) $< -o $@ $(@PACKAGE@DCXXFLAGS)
f0a26826 254
255#Different targets for the module
256
5edd655b 257ifeq ($(TYPE),lib)
5864aa62 258all-@PACKAGE@: $(@PACKAGE@LIB)
40c469d5 259ifneq ($(DYEXT),)
260all-@PACKAGE@: $(@PACKAGE@DLIB)
261endif
5edd655b 262else
263all-@PACKAGE@: $(@PACKAGE@BIN)
264endif
265
f0a26826 266depend-@PACKAGE@: $(@PACKAGE@DEP)
267
268# determination of object files
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
87c71321 299 @echo "***** Making dependences 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
87c71321 306 @echo "***** Making dependences 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
87c71321 312 @echo "***** Making dependences 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
87c71321 318 @echo "***** Making dependences 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
87c71321 324 @echo "***** Making dependences 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
bdfb9593 329.PRECIOUS: $(patsubst %.cxx,$(MODDIRO)/%.d,$(SRCS))
330.PRECIOUS: $(patsubst %.c,$(MODDIRO)/%.d,$(CSRCS))
331.PRECIOUS: $(patsubst %.F,$(MODDIRO)/%.d,$(patsubst %.f,$(MODDIRO)/%.d,$(FSRCS)))
814cac0f 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
2603dcc4 338@MODULE@/check/%.i : @MODULE@/%.cxx @MODULE@/%.h
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