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