]>
Commit | Line | Data |
---|---|---|
1 | #-*- Mode: Makefile -*- | |
2 | ||
3 | ||
4 | ifndef PACKFFLAGS | |
5 | @PACKAGE@FFLAGS:=$(FFLAGS) | |
6 | else | |
7 | @PACKAGE@FFLAGS:=$(PACKFFLAGS) | |
8 | endif | |
9 | ||
10 | ifndef PACKCFLAGS | |
11 | @PACKAGE@CFLAGS:=$(CFLAGS) | |
12 | else | |
13 | @PACKAGE@CFLAGS:=$(PACKCFLAGS) | |
14 | endif | |
15 | ||
16 | ifndef PACKCXXFLAGS | |
17 | @PACKAGE@CXXFLAGS:=$(CXXFLAGS) | |
18 | else | |
19 | @PACKAGE@CXXFLAGS:=$(PACKCXXFLAGS) | |
20 | endif | |
21 | ||
22 | ifndef PACKSOFLAGS | |
23 | @PACKAGE@SOFLAGS:=$(SOFLAGS) | |
24 | else | |
25 | @PACKAGE@SOFLAGS:=$(PACKSOFLAGS) | |
26 | endif | |
27 | ||
28 | ifdef DYEXT | |
29 | ifndef PACKDYFLAGS | |
30 | @PACKAGE@DYFLAGS:=$(DYFLAGS) | |
31 | else | |
32 | @PACKAGE@DYFLAGS:=$(PACKDYFLAGS) | |
33 | endif | |
34 | endif | |
35 | ||
36 | ifndef PACKLDFLAGS | |
37 | @PACKAGE@LDFLAGS:=$(LDFLAGS) | |
38 | else | |
39 | @PACKAGE@LDFLAGS:=$(PACKLDFLAGS) | |
40 | endif | |
41 | ||
42 | ifndef PACKDCXXFLAGS | |
43 | @PACKAGE@DCXXFLAGS:=$(CXXFLAGSNO) | |
44 | else | |
45 | @PACKAGE@DCXXFLAGS:=$(PACKDCXXFLAGS) | |
46 | endif | |
47 | ||
48 | ifndef PACKBLIBS | |
49 | @PACKAGE@BLIBS:=$(LIBS) | |
50 | else | |
51 | @PACKAGE@BLIBS:=$(PACKBLIBS) | |
52 | endif | |
53 | ||
54 | ||
55 | ifdef DHDR | |
56 | WITHDICT=YES | |
57 | else | |
58 | WITHDICT= | |
59 | endif | |
60 | ||
61 | # Headerfiles exported to common place: | |
62 | @PACKAGE@EXPORT:=$(EXPORT) | |
63 | @PACKAGE@EXPORTDEST:=$(patsubst %,$(EXPORTDIR)/%,$(EXPORT)) | |
64 | ||
65 | ||
66 | #Extra include,libs, defines etc. | |
67 | ||
68 | @PACKAGE@DEFINE:=$(EDEFINE) -D__MODULE__=\"@MODULE@\" | |
69 | ||
70 | @PACKAGE@INC:=$(patsubst %,-I%,$(EINCLUDE)) -I@MODULE@ | |
71 | ||
72 | @PACKAGE@ELIBS:=$(patsubst %,-l%,$(ELIBS)) | |
73 | @PACKAGE@ELIBSDEP:=$(patsubst %,lib/tgt_$(ALICE_TARGET)/lib%.$(SOEXT),$(ELIBS)) | |
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)) | |
86 | @PACKAGE@H:=$(patsubst %,$(MODDIR)/%,$(HDRS)) $(EHDRS) | |
87 | ||
88 | ############################################################################# | |
89 | # | |
90 | # If special rootcint headerfiles is specified use them | |
91 | # else use all headers | |
92 | ||
93 | ifndef CINTHDRS | |
94 | @PACKAGE@CINTHDRS:=$(@PACKAGE@H) | |
95 | else | |
96 | @PACKAGE@CINTHDRS:=$(CINTHDRS) | |
97 | endif | |
98 | ############################################################################# | |
99 | ||
100 | # Package Dictionary | |
101 | @PACKAGE@DH:=$(MODDIR)/$(DHDR) | |
102 | ||
103 | #All objects | |
104 | @PACKAGE@CO:=$(patsubst %,$(MODDIRO)/%, $(CSRCS:.c=.o)) | |
105 | TEMP:=$(FSRCS:.F=.o) | |
106 | @PACKAGE@FO:=$(patsubst %,$(MODDIRO)/%, $(TEMP:.f=.o)) | |
107 | @PACKAGE@O:= $(patsubst %,$(MODDIRO)/%, $(SRCS:.cxx=.o)) $(@PACKAGE@FO) $(@PACKAGE@CO) | |
108 | ||
109 | ||
110 | ||
111 | ifdef WITHDICT | |
112 | @PACKAGE@DS:=$(MODDIRO)/G__@PACKAGE@.cxx | |
113 | @PACKAGE@DO:=$(MODDIRO)/G__@PACKAGE@.o | |
114 | @PACKAGE@DDEP:=$(@PACKAGE@DO:.o=.d) | |
115 | @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d) $(@PACKAGE@DDEP) | |
116 | else | |
117 | @PACKAGE@DS:= | |
118 | @PACKAGE@DO:= | |
119 | @PACKAGE@DDEP:= | |
120 | @PACKAGE@DEP:=$(@PACKAGE@O:.o=.d) | |
121 | endif | |
122 | ||
123 | ||
124 | #The actual library file | |
125 | ||
126 | @PACKAGE@LIB:=$(LIBPATH)/lib@PACKAGE@.$(SOEXT) | |
127 | ||
128 | ifneq ($(DYEXT),) | |
129 | @PACKAGE@DLIB:=$(LIBPATH)/lib@PACKAGE@.$(DYEXT) | |
130 | endif | |
131 | ||
132 | @PACKAGE@ALIB:=$(LIBPATH)/lib@PACKAGE@.$(AEXT) | |
133 | ||
134 | #Add this to the modules libs | |
135 | @MODULE@LIBS += $(@PACKAGE@LIB) | |
136 | @MODULE@ALIBS += $(@PACKAGE@ALIB) | |
137 | ifneq ($(DYEXT),) | |
138 | @MODULE@DLIBS += $(@PACKAGE@DLIB) | |
139 | endif | |
140 | ||
141 | #The actual binary file | |
142 | ||
143 | @PACKAGE@BIN:=$(BINPATH)/@PACKAGE@ | |
144 | ||
145 | #Add to modules list of binaries | |
146 | @MODULE@BINS += $(@PACKAGE@BIN) | |
147 | ||
148 | # Use in the main Makefile | |
149 | ||
150 | ifeq ($(TYPE),lib) | |
151 | ALLLIBS += $(@PACKAGE@LIB) | |
152 | ALLALIBS += $(@PACKAGE@ALIB) | |
153 | ifneq ($(DYEXT),) | |
154 | ALLLIBS += $(@PACKAGE@DLIB) | |
155 | endif | |
156 | BINLIBS += -l@PACKAGE@ | |
157 | else | |
158 | ALLEXECS += $(@PACKAGE@BIN) | |
159 | endif | |
160 | ||
161 | ifeq ($(DYEXT),) | |
162 | @PACKAGE@LIB := $(@PACKAGE@LIB) | |
163 | else | |
164 | @PACKAGE@LIB := $(@PACKAGE@LIB) | |
165 | endif | |
166 | ||
167 | # include all dependence files | |
168 | INCLUDEFILES +=$(@PACKAGE@DEP) | |
169 | ||
170 | EXPORTFILES += $(@PACKAGE@EXPORTDEST) | |
171 | ||
172 | #local rules | |
173 | ||
174 | #The exportfiles only include if any!! | |
175 | ||
176 | ifdef @PACKAGE@EXPORT | |
177 | #$(@PACKAGE@EXPORTDEST): $(patsubst %,@MODULE@/%,$(@PACKAGE@EXPORT)) | |
178 | ||
179 | $(@PACKAGE@EXPORTDEST): $(EXPORTDIR)/%.h: @MODULE@/%.h | |
180 | ifndef ALIQUIET | |
181 | @echo "***** Copying file $^ to $@ *****" | |
182 | endif | |
183 | @[ -d $(dir $@) ] || mkdir -p $(dir $@) | |
184 | @cp $^ $@ | |
185 | endif | |
186 | ||
187 | #------------------------------------------------------------------------ | |
188 | ||
189 | ifneq (,$(findstring macosx,$(ALICE_TARGET))) | |
190 | $(@PACKAGE@LIB): $(@PACKAGE@DLIB) $(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk | |
191 | ifndef ALIQUIET | |
192 | @echo "***** Linking library $@ *****" | |
193 | endif | |
194 | $(MUTE)rm -f $@; cd $(dir $@); ln -s $(notdir $(@PACKAGE@DLIB)) $(notdir $@) | |
195 | else | |
196 | $(@PACKAGE@LIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk | |
197 | ifndef ALIQUIET | |
198 | @echo "***** Linking library $@ *****" | |
199 | endif | |
200 | $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \ | |
201 | export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \ | |
202 | find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\ | |
203 | \rm -f $(CURDIR)/$@ ;\ | |
204 | TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\ | |
205 | $(SHLD) $(@PACKAGE@SOFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(SHLIB);\ | |
206 | chmod a-w $(CURDIR)/$@ ;\ | |
207 | cd $(ALICE_ROOT) ; \rm -rf $$TMPDIR | |
208 | endif | |
209 | ||
210 | ifneq ($(DYEXT),) | |
211 | $(@PACKAGE@DLIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk | |
212 | ifndef ALIQUIET | |
213 | @echo "***** Linking library $@ *****" | |
214 | endif | |
215 | $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \ | |
216 | export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \ | |
217 | find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\ | |
218 | \rm -f $(CURDIR)/$@ ;\ | |
219 | $(DYLD) $(@PACKAGE@DYFLAGS) -o $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(DYLIB);\ | |
220 | chmod a-w $(CURDIR)/$@ ;\ | |
221 | cd $(ALICE_ROOT) ; \rm -rf $$TMPDIR | |
222 | endif | |
223 | ||
224 | #------------------------------------------------------------------------ | |
225 | ||
226 | $(@PACKAGE@ALIB):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk | |
227 | ifndef ALIQUIET | |
228 | @echo "***** Linking static library $@ *****" | |
229 | endif | |
230 | $(MUTE)TMPDIR=/tmp/@MODULE@$$$$.`date +%M%S` ; \ | |
231 | export TMPDIR; mkdir -p $$TMPDIR ; cd $$TMPDIR ; \ | |
232 | find $(CURDIR)/@MODULE@/tgt_$(ALICE_TARGET) -name '*.o' -exec ln -s {} . \; ;\ | |
233 | \rm -f $(CURDIR)/$@ ;\ | |
234 | TMPLIB=$(notdir $(@PACKAGE@LIB)); export TMPLIB;\ | |
235 | $(ALLD) $(ALFLAGS) $(CURDIR)/$@ $(notdir $(@PACKAGE@O) $(@PACKAGE@DO)) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(ALLIB);\ | |
236 | cd $(CURDIR) ; \rm -rf $$TMPDIR | |
237 | $(MUTE)chmod a-w $@ | |
238 | ||
239 | ||
240 | $(@PACKAGE@BIN):$(@PACKAGE@O) $(@PACKAGE@DO) @MODULE@/module.mk | |
241 | ifndef ALIQUIET | |
242 | @echo "***** Making executable $@ *****" | |
243 | endif | |
244 | ifeq ($(ALIPROFILE),YES) | |
245 | $(MUTE)$(LD) $(@PACKAGE@LDFLAGS) $(@PACKAGE@O) $(ARLIBS) $(SHLIBS) $(@PACKAGE@BLIBS) $(EXEFLAGS) -o $@ | |
246 | else | |
247 | $(MUTE)$(LD) $(@PACKAGE@LDFLAGS) $(@PACKAGE@O) $(@PACKAGE@DO) $(BINLIBDIRS) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@ELIBS) $(@PACKAGE@BLIBS) $(EXEFLAGS) -o $@ | |
248 | endif | |
249 | ||
250 | $(@PACKAGE@DS): $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) @MODULE@/module.mk @MODULE@/tgt_$(ALICE_TARGET)/@PACKAGE@_srcslist | |
251 | ifndef ALIQUIET | |
252 | @echo "***** Creating $@ *****"; | |
253 | endif | |
254 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
255 | @\rm -f $(patsubst %.cxx,%.d, $@) | |
256 | $(MUTE)rootcint -f $@ -c $(@PACKAGE@DEFINE) $(CINTFLAGS) $(@PACKAGE@INC) $(@PACKAGE@CINTHDRS) $(@PACKAGE@DH) | |
257 | ||
258 | $(@PACKAGE@DO): $(@PACKAGE@DS) | |
259 | ifndef ALIQUIET | |
260 | @echo "***** Compiling $< *****"; | |
261 | endif | |
262 | $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) -I$(ALICE_ROOT) $< -o $@ $(@PACKAGE@DCXXFLAGS) | |
263 | ||
264 | $(MODDIRO)/@PACKAGE@_srcslist: @MODULE@/@TYPE@@PACKAGE@.pkg | |
265 | $(MUTE)if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi | |
266 | $(MUTE)for i in $(@PACKAGE@CS) $(@PACKAGE@S) xyz; do echo $$i; done | sort > $@.new | |
267 | $(MUTE)for j in `diff -w $@ $@.new 2>/dev/null | awk '/^\</{sub(".c.*",".",$$2); print $$2}' | $(XARGS) basename` ;\ | |
268 | do grep -l $$j `find */tgt_$(ALICE_TARGET) -name "*.d"` | $(XARGS) echo \rm -f ;\ | |
269 | (find @MODULE@/tgt_$(ALICE_TARGET) -name "$${j}d" ; find @MODULE@/tgt_$(ALICE_TARGET) -name "$${j}o") | $(XARGS) echo \rm -f ;\ | |
270 | done | |
271 | $(MUTE)diff -q -w >/dev/null 2>&1 $@ $@.new ;\ | |
272 | if [ $$? -ne 0 ]; then \mv $@.new $@; else \rm $@.new; fi | |
273 | ||
274 | #Different targets for the module | |
275 | ||
276 | ifeq ($(TYPE),lib) | |
277 | all-@PACKAGE@: $(@PACKAGE@LIB) | |
278 | ifneq ($(DYEXT),) | |
279 | all-@PACKAGE@: $(@PACKAGE@DLIB) | |
280 | endif | |
281 | else | |
282 | all-@PACKAGE@: $(@PACKAGE@BIN) | |
283 | endif | |
284 | ||
285 | depend-@PACKAGE@: $(@PACKAGE@DEP) | |
286 | ||
287 | # determination of object files | |
288 | $(MODDIRO)/%.o: $(MODDIR)/%.cxx $(MODDIRO)/%.d | |
289 | ifndef ALIQUIET | |
290 | @echo "***** Compiling $< *****"; | |
291 | endif | |
292 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
293 | $(MUTE)$(CXX) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CXXFLAGS) | |
294 | ||
295 | $(MODDIRO)/%.o: $(MODDIR)/%.F $(MODDIRO)/%.d | |
296 | ifndef ALIQUIET | |
297 | @echo "***** Compiling $< *****"; | |
298 | endif | |
299 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
300 | $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS) | |
301 | ||
302 | $(MODDIRO)/%.o: $(MODDIR)/%.f $(MODDIRO)/%.d | |
303 | ifndef ALIQUIET | |
304 | @echo "***** Compiling $< *****"; | |
305 | endif | |
306 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
307 | $(MUTE)$(F77) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@FFLAGS) | |
308 | ||
309 | $(MODDIRO)/%.o: $(MODDIR)/%.c $(MODDIRO)/%.d | |
310 | ifndef ALIQUIET | |
311 | @echo "***** Compiling $< *****"; | |
312 | endif | |
313 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
314 | $(MUTE)$(CC) $(@PACKAGE@DEFINE) -c $(@PACKAGE@INC) $< -o $@ $(@PACKAGE@CFLAGS) | |
315 | ||
316 | $(@PACKAGE@DDEP): $(@PACKAGE@DS) | |
317 | ifndef ALIQUIET | |
318 | @echo "***** Making dependences for $< *****"; | |
319 | endif | |
320 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
321 | @share/alibtool depend "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@ | |
322 | ||
323 | $(MODDIRO)/%.d: $(MODDIRS)/%.cxx | |
324 | ifndef ALIQUIET | |
325 | @echo "***** Making dependences for $< *****"; | |
326 | endif | |
327 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
328 | @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@ | |
329 | $(MODDIRO)/%.d: $(MODDIRS)/%.f | |
330 | ifndef ALIQUIET | |
331 | @echo "***** Making dependences for $< *****"; | |
332 | endif | |
333 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
334 | @share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@ | |
335 | $(MODDIRO)/%.d: $(MODDIRS)/%.F | |
336 | ifndef ALIQUIET | |
337 | @echo "***** Making dependences for $< *****"; | |
338 | endif | |
339 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
340 | $(MUTE)share/alibtool dependF "$(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@ | |
341 | $(MODDIRO)/%.d: $(MODDIRS)/%.c | |
342 | ifndef ALIQUIET | |
343 | @echo "***** Making dependences for $< *****"; | |
344 | endif | |
345 | @(if [ ! -d '$(dir $@)' ]; then echo "***** Making directory $(dir $@) *****"; mkdir -p $(dir $@); fi;) | |
346 | @share/alibtool depend "$(@PACKAGE@DEFINE) $(@PACKAGE@ELIBSDIR) $(@PACKAGE@INC) $(DEPINC) $<" > $@ | |
347 | ||
348 | .PRECIOUS: $(patsubst %.cxx,$(MODDIRO)/%.d,$(SRCS)) | |
349 | .PRECIOUS: $(patsubst %.c,$(MODDIRO)/%.d,$(CSRCS)) | |
350 | .PRECIOUS: $(patsubst %.F,$(MODDIRO)/%.d,$(patsubst %.f,$(MODDIRO)/%.d,$(FSRCS))) | |
351 | ||
352 | @PACKAGE@CHECKS := $(patsubst %.cxx,@MODULE@/check/%.viol,$(SRCS)) | |
353 | ||
354 | check-@MODULE@: $(@PACKAGE@CHECKS) | |
355 | ||
356 | # IRST coding rule check | |
357 | @MODULE@/check/%.i : @MODULE@/%.cxx @MODULE@/tgt_$(ALICE_TARGET)/%.d | |
358 | @[ -d $(dir $@) ] || mkdir -p $(dir $@) | |
359 | $(MUTE)$(CXX) -E $(@PACKAGE@DEFINE) $(@PACKAGE@INC) -I. $< > $@ $(@PACKAGE@CXXFLAGS) | |
360 | @cd $(dir $@) ; $(IRST_INSTALLDIR)/patch/patch4alice.prl $(notdir $@) | |
361 | ||
362 | # IRST coding rule check | |
363 | @MODULE@/check/%.viol : @MODULE@/check/%.i | |
364 | $(MUTE)echo $@ ; $(CODE_CHECK) $< $(shell echo $(dir $<) | sed -e 's:/check::') > $@ | |
365 | ||
366 | @PACKAGE@PREPROC = $(patsubst %.viol,%.i,$(@PACKAGE@CHECKS)) | |
367 | ||
368 | @PACKAGE@REVENGS = $(patsubst %.viol,%.ii,$(@PACKAGE@CHECKS)) | |
369 | ||
370 | .SECONDARY: $(@PACKAGE@REVENGS) $(@PACKAGE@PREPROC) | |
371 | ||
372 | PACKREVENG += $(@PACKAGE@PREPROC) | |
373 |