Deleted Added
full compact
bsd.dep.mk (301079) bsd.dep.mk (301284)
1# $FreeBSD: head/share/mk/bsd.dep.mk 301079 2016-05-31 21:22:19Z bdrewery $
1# $FreeBSD: head/share/mk/bsd.dep.mk 301284 2016-06-03 19:25:36Z bdrewery $
2#
3# The include file <bsd.dep.mk> handles Makefile dependencies.
4#
5#
6# +++ variables +++
7#
8# CLEANDEPENDDIRS Additional directories to remove for the cleandepend
9# target.
10#
11# CLEANDEPENDFILES Additional files to remove for the cleandepend target.
12#
13# CTAGS A tags file generation program [gtags]
14#
15# CTAGSFLAGS Options for ctags(1) [not set]
16#
17# DEPENDFILE dependencies file [.depend]
18#
19# GTAGSFLAGS Options for gtags(1) [-o]
20#
21# HTAGSFLAGS Options for htags(1) [not set]
22#
23# SRCS List of source files (c, c++, assembler)
24#
25# DPSRCS List of source files which are needed for generating
26# dependencies, ${SRCS} are always part of it.
27#
28# +++ targets +++
29#
30# cleandepend:
31# remove ${CLEANDEPENDFILES}; remove ${CLEANDEPENDDIRS} and all
32# contents.
33#
34# depend:
35# Make the dependencies for the source files, and store
36# them in the file ${DEPENDFILE}.
37#
38# tags:
39# In "ctags" mode, create a tags file for the source files.
40# In "gtags" mode, create a (GLOBAL) gtags file for the
41# source files. If HTML is defined, htags(1) is also run
42# after gtags(1).
43
44.if !target(__<bsd.init.mk>__)
45.error bsd.dep.mk cannot be included directly.
46.endif
47
48CTAGS?= gtags
49CTAGSFLAGS?=
50GTAGSFLAGS?= -o
51HTAGSFLAGS?=
52
53.if ${MK_DIRDEPS_BUILD} == "no"
54.MAKE.DEPENDFILE= ${DEPENDFILE}
55.endif
56CLEANDEPENDFILES+= ${DEPENDFILE} ${DEPENDFILE}.*
57.if ${MK_META_MODE} == "yes"
58CLEANDEPENDFILES+= *.meta
59.endif
60
61# Keep `tags' here, before SRCS are mangled below for `depend'.
62.if !target(tags) && defined(SRCS) && !defined(NO_TAGS)
63tags: ${SRCS}
64.if ${CTAGS:T} == "gtags"
65 @cd ${.CURDIR} && ${CTAGS} ${GTAGSFLAGS} ${.OBJDIR}
66.if defined(HTML)
67 @cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
68.endif
69.else
70 @${CTAGS} ${CTAGSFLAGS} -f /dev/stdout \
71 ${.ALLSRC:N*.h} | sed "s;${.CURDIR}/;;" > ${.TARGET}
72.endif
73.endif
74
75# Skip reading .depend when not needed to speed up tree-walks
76# and simple lookups.
77.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
78 make(install*) || make(analyze)
79_SKIP_READ_DEPEND= 1
80.if ${MK_DIRDEPS_BUILD} == "no"
81.MAKE.DEPENDFILE= /dev/null
82.endif
83.endif
84
85.if defined(SRCS)
86CLEANFILES?=
87
88.for _S in ${SRCS:N*.[dhly]}
89OBJS_DEPEND_GUESS.${_S:R}.o= ${_S}
90.endfor
91
92# Lexical analyzers
93.for _LSRC in ${SRCS:M*.l:N*/*}
94.for _LC in ${_LSRC:R}.c
2#
3# The include file <bsd.dep.mk> handles Makefile dependencies.
4#
5#
6# +++ variables +++
7#
8# CLEANDEPENDDIRS Additional directories to remove for the cleandepend
9# target.
10#
11# CLEANDEPENDFILES Additional files to remove for the cleandepend target.
12#
13# CTAGS A tags file generation program [gtags]
14#
15# CTAGSFLAGS Options for ctags(1) [not set]
16#
17# DEPENDFILE dependencies file [.depend]
18#
19# GTAGSFLAGS Options for gtags(1) [-o]
20#
21# HTAGSFLAGS Options for htags(1) [not set]
22#
23# SRCS List of source files (c, c++, assembler)
24#
25# DPSRCS List of source files which are needed for generating
26# dependencies, ${SRCS} are always part of it.
27#
28# +++ targets +++
29#
30# cleandepend:
31# remove ${CLEANDEPENDFILES}; remove ${CLEANDEPENDDIRS} and all
32# contents.
33#
34# depend:
35# Make the dependencies for the source files, and store
36# them in the file ${DEPENDFILE}.
37#
38# tags:
39# In "ctags" mode, create a tags file for the source files.
40# In "gtags" mode, create a (GLOBAL) gtags file for the
41# source files. If HTML is defined, htags(1) is also run
42# after gtags(1).
43
44.if !target(__<bsd.init.mk>__)
45.error bsd.dep.mk cannot be included directly.
46.endif
47
48CTAGS?= gtags
49CTAGSFLAGS?=
50GTAGSFLAGS?= -o
51HTAGSFLAGS?=
52
53.if ${MK_DIRDEPS_BUILD} == "no"
54.MAKE.DEPENDFILE= ${DEPENDFILE}
55.endif
56CLEANDEPENDFILES+= ${DEPENDFILE} ${DEPENDFILE}.*
57.if ${MK_META_MODE} == "yes"
58CLEANDEPENDFILES+= *.meta
59.endif
60
61# Keep `tags' here, before SRCS are mangled below for `depend'.
62.if !target(tags) && defined(SRCS) && !defined(NO_TAGS)
63tags: ${SRCS}
64.if ${CTAGS:T} == "gtags"
65 @cd ${.CURDIR} && ${CTAGS} ${GTAGSFLAGS} ${.OBJDIR}
66.if defined(HTML)
67 @cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
68.endif
69.else
70 @${CTAGS} ${CTAGSFLAGS} -f /dev/stdout \
71 ${.ALLSRC:N*.h} | sed "s;${.CURDIR}/;;" > ${.TARGET}
72.endif
73.endif
74
75# Skip reading .depend when not needed to speed up tree-walks
76# and simple lookups.
77.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
78 make(install*) || make(analyze)
79_SKIP_READ_DEPEND= 1
80.if ${MK_DIRDEPS_BUILD} == "no"
81.MAKE.DEPENDFILE= /dev/null
82.endif
83.endif
84
85.if defined(SRCS)
86CLEANFILES?=
87
88.for _S in ${SRCS:N*.[dhly]}
89OBJS_DEPEND_GUESS.${_S:R}.o= ${_S}
90.endfor
91
92# Lexical analyzers
93.for _LSRC in ${SRCS:M*.l:N*/*}
94.for _LC in ${_LSRC:R}.c
95${_LC}: ${_LSRC} ${OP_META}
95${_LC}: ${_LSRC}
96 ${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC}
97OBJS_DEPEND_GUESS.${_LC:R}.o= ${_LC}
98SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
99CLEANFILES+= ${_LC}
100.endfor
101.endfor
102
103# Yacc grammars
104.for _YSRC in ${SRCS:M*.y:N*/*}
105.for _YC in ${_YSRC:R}.c
106SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
107CLEANFILES+= ${_YC}
108.if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h)
109.ORDER: ${_YC} y.tab.h
96 ${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC}
97OBJS_DEPEND_GUESS.${_LC:R}.o= ${_LC}
98SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
99CLEANFILES+= ${_LC}
100.endfor
101.endfor
102
103# Yacc grammars
104.for _YSRC in ${SRCS:M*.y:N*/*}
105.for _YC in ${_YSRC:R}.c
106SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
107CLEANFILES+= ${_YC}
108.if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h)
109.ORDER: ${_YC} y.tab.h
110${_YC}: ${OP_META}
111${_YC} y.tab.h: ${_YSRC}
112 ${YACC} ${YFLAGS} ${.ALLSRC}
113 cp y.tab.c ${_YC}
114CLEANFILES+= y.tab.c y.tab.h
115.elif !empty(YFLAGS:M-d)
116.for _YH in ${_YC:R}.h
117.ORDER: ${_YC} ${_YH}
110${_YC} y.tab.h: ${_YSRC}
111 ${YACC} ${YFLAGS} ${.ALLSRC}
112 cp y.tab.c ${_YC}
113CLEANFILES+= y.tab.c y.tab.h
114.elif !empty(YFLAGS:M-d)
115.for _YH in ${_YC:R}.h
116.ORDER: ${_YC} ${_YH}
118${_YC}: ${OP_META}
119${_YC} ${_YH}: ${_YSRC}
120 ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
121SRCS+= ${_YH}
122CLEANFILES+= ${_YH}
123.endfor
124.else
117${_YC} ${_YH}: ${_YSRC}
118 ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
119SRCS+= ${_YH}
120CLEANFILES+= ${_YH}
121.endfor
122.else
125${_YC}: ${_YSRC} ${OP_META}
123${_YC}: ${_YSRC}
126 ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
127.endif
128OBJS_DEPEND_GUESS.${_YC:R}.o= ${_YC}
129.endfor
130.endfor
131
132# DTrace probe definitions
133.if ${SRCS:M*.d}
134CFLAGS+= -I${.OBJDIR}
135.endif
136.for _DSRC in ${SRCS:M*.d:N*/*}
137.for _D in ${_DSRC:R}
138SRCS+= ${_D}.h
124 ${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
125.endif
126OBJS_DEPEND_GUESS.${_YC:R}.o= ${_YC}
127.endfor
128.endfor
129
130# DTrace probe definitions
131.if ${SRCS:M*.d}
132CFLAGS+= -I${.OBJDIR}
133.endif
134.for _DSRC in ${SRCS:M*.d:N*/*}
135.for _D in ${_DSRC:R}
136SRCS+= ${_D}.h
139${_D}.h: ${_DSRC} ${OP_META}
137${_D}.h: ${_DSRC}
140 ${DTRACE} ${DTRACEFLAGS} -h -s ${.ALLSRC}
141SRCS:= ${SRCS:S/^${_DSRC}$//}
142OBJS+= ${_D}.o
143CLEANFILES+= ${_D}.h ${_D}.o
138 ${DTRACE} ${DTRACEFLAGS} -h -s ${.ALLSRC}
139SRCS:= ${SRCS:S/^${_DSRC}$//}
140OBJS+= ${_D}.o
141CLEANFILES+= ${_D}.h ${_D}.o
144${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//} ${OP_META}
142${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//}
145 @rm -f ${.TARGET}
146 ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
147.if defined(LIB)
148CLEANFILES+= ${_D}.So ${_D}.po
143 @rm -f ${.TARGET}
144 ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
145.if defined(LIB)
146CLEANFILES+= ${_D}.So ${_D}.po
149${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//} ${OP_META}
147${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//}
150 @rm -f ${.TARGET}
151 ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
148 @rm -f ${.TARGET}
149 ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
152${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//} ${OP_META}
150${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
153 @rm -f ${.TARGET}
154 ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
155.endif
156.endfor
157.endfor
158
159
160.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon)
161_meta_filemon= 1
162.endif
163.if ${MAKE_VERSION} < 20160220
164DEPEND_MP?= -MP
165.endif
166# Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to
167# avoid collisions.
168DEPEND_FILTER= C,/,_,g
169DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
170.if !empty(DEPENDSRCS)
171DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,}
172.endif
173DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
174DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
175DEPEND_CFLAGS+= -MT${.TARGET}
176# Skip generating or including .depend.* files if in meta+filemon mode since
177# it will track dependencies itself. OBJS_DEPEND_GUESS is still used though.
178.if !defined(_meta_filemon)
179.if defined(.PARSEDIR)
180# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
181# as those are the only ones we will include.
182DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:M${.TARGET:${DEPEND_FILTER}}}" != ""
183CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
184.else
185CFLAGS+= ${DEPEND_CFLAGS}
186.endif
187.if !defined(_SKIP_READ_DEPEND)
188.for __depend_obj in ${DEPENDFILES_OBJS}
189.if ${MAKE_VERSION} < 20160220
190.sinclude "${.OBJDIR}/${__depend_obj}"
191.else
192.dinclude "${.OBJDIR}/${__depend_obj}"
193.endif
194.endfor
195.endif # !defined(_SKIP_READ_DEPEND)
196.endif # !defined(_meta_filemon)
197.endif # defined(SRCS)
198
199.if ${MK_DIRDEPS_BUILD} == "yes"
200# Prevent meta.autodep.mk from tracking "local dependencies".
201.depend:
202.include <meta.autodep.mk>
203# If using filemon then _EXTRADEPEND is skipped since it is not needed.
204.if empty(.MAKE.MODE:Mnofilemon)
205# this depend: bypasses that below
206# the dependency helps when bootstrapping
207depend: beforedepend ${DPSRCS} ${SRCS} afterdepend
208beforedepend:
209afterdepend: beforedepend
210.endif
211.endif
212
213# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet.
214# For meta+filemon the .meta file is checked for since it is the dependency
215# file used.
216.for __obj in ${DEPENDOBJS:O:u}
217.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \
218 (!defined(_meta_filemon) && !exists(${.OBJDIR}/${DEPENDFILE}.${__obj}))
219${__obj}: ${OBJS_DEPEND_GUESS}
220${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
221.elif defined(_meta_filemon)
222# For meta mode we still need to know which file to depend on to avoid
223# ambiguous suffix transformation rules from .PATH. Meta mode does not
224# use .depend files. We really only need source files, not headers.
225${__obj}: ${OBJS_DEPEND_GUESS:N*.h}
226${__obj}: ${OBJS_DEPEND_GUESS.${__obj}:N*.h}
227.endif
228.endfor
229
230# Always run 'make depend' to generate dependencies early and to avoid the
231# need for manually running it. The dirdeps build should only do this in
232# sub-makes though since MAKELEVEL0 is for dirdeps calculations.
233.if ${MK_DIRDEPS_BUILD} == "no" || ${.MAKE.LEVEL} > 0
234beforebuild: depend
235.endif
236
237.if !target(depend)
238.if defined(SRCS)
239depend: beforedepend ${DEPENDFILE} afterdepend
240
241# Tell bmake not to look for generated files via .PATH
242.NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS}
243
244DPSRCS+= ${SRCS}
245# A .depend file will only be generated if there are commands in
246# beforedepend/_EXTRADEPEND/afterdepend. The target is kept
247# to allow 'make depend' to generate files.
151 @rm -f ${.TARGET}
152 ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
153.endif
154.endfor
155.endfor
156
157
158.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon)
159_meta_filemon= 1
160.endif
161.if ${MAKE_VERSION} < 20160220
162DEPEND_MP?= -MP
163.endif
164# Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to
165# avoid collisions.
166DEPEND_FILTER= C,/,_,g
167DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
168.if !empty(DEPENDSRCS)
169DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,}
170.endif
171DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
172DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
173DEPEND_CFLAGS+= -MT${.TARGET}
174# Skip generating or including .depend.* files if in meta+filemon mode since
175# it will track dependencies itself. OBJS_DEPEND_GUESS is still used though.
176.if !defined(_meta_filemon)
177.if defined(.PARSEDIR)
178# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
179# as those are the only ones we will include.
180DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:M${.TARGET:${DEPEND_FILTER}}}" != ""
181CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
182.else
183CFLAGS+= ${DEPEND_CFLAGS}
184.endif
185.if !defined(_SKIP_READ_DEPEND)
186.for __depend_obj in ${DEPENDFILES_OBJS}
187.if ${MAKE_VERSION} < 20160220
188.sinclude "${.OBJDIR}/${__depend_obj}"
189.else
190.dinclude "${.OBJDIR}/${__depend_obj}"
191.endif
192.endfor
193.endif # !defined(_SKIP_READ_DEPEND)
194.endif # !defined(_meta_filemon)
195.endif # defined(SRCS)
196
197.if ${MK_DIRDEPS_BUILD} == "yes"
198# Prevent meta.autodep.mk from tracking "local dependencies".
199.depend:
200.include <meta.autodep.mk>
201# If using filemon then _EXTRADEPEND is skipped since it is not needed.
202.if empty(.MAKE.MODE:Mnofilemon)
203# this depend: bypasses that below
204# the dependency helps when bootstrapping
205depend: beforedepend ${DPSRCS} ${SRCS} afterdepend
206beforedepend:
207afterdepend: beforedepend
208.endif
209.endif
210
211# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet.
212# For meta+filemon the .meta file is checked for since it is the dependency
213# file used.
214.for __obj in ${DEPENDOBJS:O:u}
215.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \
216 (!defined(_meta_filemon) && !exists(${.OBJDIR}/${DEPENDFILE}.${__obj}))
217${__obj}: ${OBJS_DEPEND_GUESS}
218${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
219.elif defined(_meta_filemon)
220# For meta mode we still need to know which file to depend on to avoid
221# ambiguous suffix transformation rules from .PATH. Meta mode does not
222# use .depend files. We really only need source files, not headers.
223${__obj}: ${OBJS_DEPEND_GUESS:N*.h}
224${__obj}: ${OBJS_DEPEND_GUESS.${__obj}:N*.h}
225.endif
226.endfor
227
228# Always run 'make depend' to generate dependencies early and to avoid the
229# need for manually running it. The dirdeps build should only do this in
230# sub-makes though since MAKELEVEL0 is for dirdeps calculations.
231.if ${MK_DIRDEPS_BUILD} == "no" || ${.MAKE.LEVEL} > 0
232beforebuild: depend
233.endif
234
235.if !target(depend)
236.if defined(SRCS)
237depend: beforedepend ${DEPENDFILE} afterdepend
238
239# Tell bmake not to look for generated files via .PATH
240.NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS}
241
242DPSRCS+= ${SRCS}
243# A .depend file will only be generated if there are commands in
244# beforedepend/_EXTRADEPEND/afterdepend. The target is kept
245# to allow 'make depend' to generate files.
248${DEPENDFILE}: ${DPSRCS} ${OP_META}
246${DEPENDFILE}: ${DPSRCS}
249.if !empty(.MAKE.MODE:Mmeta) || exists(${.OBJDIR}/${DEPENDFILE})
250 rm -f ${DEPENDFILE}
251.endif
252.if target(_EXTRADEPEND)
253_EXTRADEPEND: .USE
254${DEPENDFILE}: _EXTRADEPEND
255.endif
256
257.ORDER: ${DEPENDFILE} afterdepend
258.else
259depend: beforedepend afterdepend
260.endif
261.if !target(beforedepend)
262beforedepend:
263.else
264.ORDER: beforedepend ${DEPENDFILE}
265.ORDER: beforedepend afterdepend
266.endif
267.if !target(afterdepend)
268afterdepend:
269.endif
270.endif
271
272.if defined(SRCS)
273.if ${CTAGS:T} == "gtags"
274CLEANDEPENDFILES+= GPATH GRTAGS GSYMS GTAGS
275.if defined(HTML)
276CLEANDEPENDDIRS+= HTML
277.endif
278.else
279CLEANDEPENDFILES+= tags
280.endif
281.endif
282.if !target(cleandepend)
283cleandepend:
284.if !empty(CLEANDEPENDFILES)
285 rm -f ${CLEANDEPENDFILES}
286.endif
287.if !empty(CLEANDEPENDDIRS)
288 rm -rf ${CLEANDEPENDDIRS}
289.endif
290.endif
291
292.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
293_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g}
294# Ignore -Wl,--start-group/-Wl,--end-group as it might be required in the
295# LDADD list due to unresolved symbols
296_LDADD_CANONICALIZED= ${LDADD:N:R:T:C;^lib(.*)$;-l\1;g:N-Wl,--[es]*-group}
297checkdpadd:
298.if ${_LDADD_FROM_DPADD} != ${_LDADD_CANONICALIZED}
299 @echo ${.CURDIR}
300 @echo "DPADD -> ${_LDADD_FROM_DPADD}"
301 @echo "LDADD -> ${_LDADD_CANONICALIZED}"
302.endif
303.endif
247.if !empty(.MAKE.MODE:Mmeta) || exists(${.OBJDIR}/${DEPENDFILE})
248 rm -f ${DEPENDFILE}
249.endif
250.if target(_EXTRADEPEND)
251_EXTRADEPEND: .USE
252${DEPENDFILE}: _EXTRADEPEND
253.endif
254
255.ORDER: ${DEPENDFILE} afterdepend
256.else
257depend: beforedepend afterdepend
258.endif
259.if !target(beforedepend)
260beforedepend:
261.else
262.ORDER: beforedepend ${DEPENDFILE}
263.ORDER: beforedepend afterdepend
264.endif
265.if !target(afterdepend)
266afterdepend:
267.endif
268.endif
269
270.if defined(SRCS)
271.if ${CTAGS:T} == "gtags"
272CLEANDEPENDFILES+= GPATH GRTAGS GSYMS GTAGS
273.if defined(HTML)
274CLEANDEPENDDIRS+= HTML
275.endif
276.else
277CLEANDEPENDFILES+= tags
278.endif
279.endif
280.if !target(cleandepend)
281cleandepend:
282.if !empty(CLEANDEPENDFILES)
283 rm -f ${CLEANDEPENDFILES}
284.endif
285.if !empty(CLEANDEPENDDIRS)
286 rm -rf ${CLEANDEPENDDIRS}
287.endif
288.endif
289
290.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
291_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g}
292# Ignore -Wl,--start-group/-Wl,--end-group as it might be required in the
293# LDADD list due to unresolved symbols
294_LDADD_CANONICALIZED= ${LDADD:N:R:T:C;^lib(.*)$;-l\1;g:N-Wl,--[es]*-group}
295checkdpadd:
296.if ${_LDADD_FROM_DPADD} != ${_LDADD_CANONICALIZED}
297 @echo ${.CURDIR}
298 @echo "DPADD -> ${_LDADD_FROM_DPADD}"
299 @echo "LDADD -> ${_LDADD_CANONICALIZED}"
300.endif
301.endif