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