Changes for Mac OSX
[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
796dbee6 188ifneq (,$(findstring macosx,$(ALICE_TARGET)))
f3564e28 189$(@PACKAGE@LIB): $(@PACKAGE@DLIB) $(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
190ifndef ALIQUIET
191 @echo "***** Linking library $@ *****"
192endif
193 $(MUTE)rm -f $@; cd $(dir $@); ln -s $(notdir $(@PACKAGE@DLIB)) $(notdir $@)
194else
f0a26826 195$(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 196ifndef ALIQUIET
f0a26826 197 @echo "***** Linking library $@ *****"
15142e2f 198endif
faeab8a4 199 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
117cfc60 200 export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \
faeab8a4 201 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
043a26ce 202 \rm -f $(CURDIR)/$@ ;\
7930dd19 203 TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\
ce4e6d58 204 $(SHLD) $(@PACKAGE@SOFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(SHLIB);\
205 chmod a-w $(CURDIR)/$@ ;\
fe250300 206 cd $(ALICE_ROOT) ; \rm -rf $$TMPDIR
f3564e28 207endif
810722e6 208
40c469d5 209ifneq ($(DYEXT),)
210$(@PACKAGE@DLIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
211ifndef ALIQUIET
212 @echo "***** Linking library $@ *****"
213endif
214 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
117cfc60 215 export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \
40c469d5 216 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
fe250300 217 \rm -f $(CURDIR)/$@ ;\
ce4e6d58 218 $(DYLD) $(@PACKAGE@DYFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(DYLIB);\
219 chmod a-w $(CURDIR)/$@ ;\
fe250300 220 cd $(ALICE_ROOT) ; \rm -rf $$TMPDIR
40c469d5 221endif
222
88cb7938 223#------------------------------------------------------------------------
224
2d8cad5a 225$(@PACKAGE@ALIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
226ifndef ALIQUIET
227 @echo "***** Linking static library $@ *****"
228endif
229 $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \
117cfc60 230 export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \
2d8cad5a 231 find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\
7930dd19 232 \rm -f $(CURDIR)/$@ ;\
233 TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\
043a26ce 234 $(ALLD) $(ALFLAGS) $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(ALLIB);\
235 cd $(CURDIR) ; \rm -rf $$TMPDIR
2d8cad5a 236 $(MUTE)chmod a-w $@
237
238
2603dcc4 239$(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk
15142e2f 240ifndef ALIQUIET
241 @echo "***** Making executable $@ *****"
242endif
2d8cad5a 243ifeq ($(ALIPROFILE),YES)
651e35f1 244 $(MUTE)$(LD) $(@PACKAGE@LDFLAGS) $(@PACKAGE@O) $(ARLIBS) $(SHLIBS) $(LIBS) $(EXEFLAGS) -o $@
2d8cad5a 245else
651e35f1 246 $(MUTE)$(LD) $(@PACKAGE@LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(LIBS) $(EXEFLAGS) -o $@
2d8cad5a 247endif
f0a26826 248
6bb8c070 249$(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) @MODULE@/module.mk
15142e2f 250ifndef ALIQUIET
f0a26826 251 @echo "***** Creating $@ *****";
15142e2f 252endif
f0a26826 253 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
043a26ce 254 @\rm -f $(patsubst %.cxx,%.d, $@)
67fd7264 255 $(MUTE)rootcint -f $@ -c $(@PACKAGE@DEFINE) $(CINTFLAGS) $(@PACKAGE@INC) $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH)
f0a26826 256
257$(@PACKAGE@DO): $(@PACKAGE@DS)
15142e2f 258ifndef ALIQUIET
259 @echo "***** Compiling $< *****";
260endif
117cfc60 261 $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) -I$(ALICE_ROOT) $< -o $@ $(@PACKAGE@DCXXFLAGS)
f0a26826 262
263#Different targets for the module
264
5edd655b 265ifeq ($(TYPE),lib)
5864aa62 266all-@PACKAGE@: $(@PACKAGE@LIB)
40c469d5 267ifneq ($(DYEXT),)
268all-@PACKAGE@: $(@PACKAGE@DLIB)
269endif
5edd655b 270else
271all-@PACKAGE@: $(@PACKAGE@BIN)
272endif
273
f0a26826 274depend-@PACKAGE@: $(@PACKAGE@DEP)
275
276# determination of object files
277$(MODDIRO)/%.o: $(MODDIR)/%.cxx $(MODDIRO)/%.d
15142e2f 278ifndef ALIQUIET
279 @echo "***** Compiling $< *****";
280endif
f0a26826 281 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 282 $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS)
f0a26826 283
284$(MODDIRO)/%.o: $(MODDIR)/%.F $(MODDIRO)/%.d
15142e2f 285ifndef ALIQUIET
286 @echo "***** Compiling $< *****";
287endif
f0a26826 288 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 289 $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
f0a26826 290
291$(MODDIRO)/%.o: $(MODDIR)/%.f $(MODDIRO)/%.d
15142e2f 292ifndef ALIQUIET
293 @echo "***** Compiling $< *****";
294endif
f0a26826 295 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 296 $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS)
f0a26826 297
298$(MODDIRO)/%.o: $(MODDIR)/%.c $(MODDIRO)/%.d
15142e2f 299ifndef ALIQUIET
300 @echo "***** Compiling $< *****";
301endif
f0a26826 302 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 303 $(MUTE)$(CC) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CFLAGS)
f0a26826 304
305$(@PACKAGE@DDEP): $(@PACKAGE@DS)
15142e2f 306ifndef ALIQUIET
87c71321 307 @echo "***** Making dependences for $< *****";
15142e2f 308endif
f0a26826 309 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
310 @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
311
d47d6108 312$(MODDIRO)/%.d: $(MODDIRS)/%.cxx
15142e2f 313ifndef ALIQUIET
87c71321 314 @echo "***** Making dependences for $< *****";
15142e2f 315endif
f0a26826 316 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 317 @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
896cb507 318$(MODDIRO)/%.d: $(MODDIRS)/%.f
15142e2f 319ifndef ALIQUIET
87c71321 320 @echo "***** Making dependences for $< *****";
15142e2f 321endif
f0a26826 322 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
896cb507 323 @share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
324$(MODDIRO)/%.d: $(MODDIRS)/%.F
15142e2f 325ifndef ALIQUIET
87c71321 326 @echo "***** Making dependences for $< *****";
15142e2f 327endif
f0a26826 328 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
15142e2f 329 $(MUTE)share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
896cb507 330$(MODDIRO)/%.d: $(MODDIRS)/%.c
15142e2f 331ifndef ALIQUIET
87c71321 332 @echo "***** Making dependences for $< *****";
15142e2f 333endif
f0a26826 334 @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;)
67fd7264 335 @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@
b9d0a01d 336
bdfb9593 337.PRECIOUS: $(patsubst %.cxx,$(MODDIRO)/%.d,$(SRCS))
338.PRECIOUS: $(patsubst %.c,$(MODDIRO)/%.d,$(CSRCS))
339.PRECIOUS: $(patsubst %.F,$(MODDIRO)/%.d,$(patsubst %.f,$(MODDIRO)/%.d,$(FSRCS)))
814cac0f 340
7e96fcc7 341@PACKAGE@CHECKS := $(patsubst %.cxx,@MODULE@/check/%.viol,$(SRCS))
b9d0a01d 342
7e96fcc7 343check-@MODULE@: $(@PACKAGE@CHECKS)
b9d0a01d 344
345# IRST coding rule check
2603dcc4 346@MODULE@/check/%.i : @MODULE@/%.cxx @MODULE@/%.h
b9d0a01d 347 @[ -d $(dir $@) ] || mkdir -p $(dir $@)
f684a380 348 $(MUTE)$(CXX) -E $(@PACKAGE@DEFINE) $(@PACKAGE@INC) -I. $< > $@ $(@PACKAGE@CXXFLAGS)
b9d0a01d 349 @cd $(dir $@) ; $(IRST_INSTALLDIR)/patch/patch4alice.prl $(notdir $@)
350
eec15521 351# IRST coding rule check
352@MODULE@/check/$(SUBDIR)/%.viol : @MODULE@/check/$(SUBDIR)/%.i
88eed770 353 $(MUTE)echo $@ ; $(CODE_CHECK) $< ./@MODULE@/$(@PACKAGE@SDIR) > $@
eec15521 354
b9d0a01d 355# IRST coding rule check
7e96fcc7 356@MODULE@/check/%.viol : @MODULE@/check/%.i
88eed770 357 $(MUTE)echo $@ ; $(CODE_CHECK) $< ./@MODULE@ > $@
b9d0a01d 358
359@PACKAGE@PREPROC = $(patsubst %.viol,%.i,$(@PACKAGE@CHECKS))
360
361@PACKAGE@REVENGS = $(patsubst %.viol,%.ii,$(@PACKAGE@CHECKS))
362
363.SECONDARY: $(@PACKAGE@REVENGS) $(@PACKAGE@PREPROC)
364
365reveng-@PACKAGE@: @PACKAGE@/check/classDiagram.dot
366
367@PACKAGE@/check/classDiagram.dot: $(@PACKAGE@PREPROC)
368 @$(REV_ENG) $^
369 @-mv classDiagram.dot $@
370
371revdisp-@PACKAGE@: reveng-@PACKAGE@
372 @echo revdisp for @PACKAGE@
373 @cd @PACKAGE@/check ; \
374 $(IRST_INSTALLDIR)/webreveng/create-class-diagram-pages.sh
375 @sed -e "s/\@PACKAGE\@/@PACKAGE@/g" < $(ALICE_ROOT)/build/HomePage.html > @PACKAGE@/check/HomePage.html
376