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