xref: /dragonfly/contrib/bmake/mk/dpadd.mk (revision 6eef5f0c)
1*6eef5f0cSAntonio Huete Jimenez# $Id: dpadd.mk,v 1.30 2021/12/08 05:56:50 sjg Exp $
25f1e34d9SAlexandre Perrin#
35f1e34d9SAlexandre Perrin#	@(#) Copyright (c) 2004, Simon J. Gerraty
45f1e34d9SAlexandre Perrin#
55f1e34d9SAlexandre Perrin#	This file is provided in the hope that it will
65f1e34d9SAlexandre Perrin#	be of use.  There is absolutely NO WARRANTY.
75f1e34d9SAlexandre Perrin#	Permission to copy, redistribute or otherwise
85f1e34d9SAlexandre Perrin#	use this file is hereby granted provided that
95f1e34d9SAlexandre Perrin#	the above copyright notice and this notice are
105f1e34d9SAlexandre Perrin#	left intact.
115f1e34d9SAlexandre Perrin#
125f1e34d9SAlexandre Perrin#	Please send copies of changes and bug-fixes to:
135f1e34d9SAlexandre Perrin#	sjg@crufty.net
145f1e34d9SAlexandre Perrin#
155f1e34d9SAlexandre Perrin
16ca58f742SDaniel Fojt##
17ca58f742SDaniel Fojt# DESCRIPTION:
18ca58f742SDaniel Fojt#	This makefile manages a number of variables that simplify
19ca58f742SDaniel Fojt#	dealing with libs in a build.
20ca58f742SDaniel Fojt#
21ca58f742SDaniel Fojt#	Primary inputs are DPLIBS, DPADD and SRC_LIBS:
22ca58f742SDaniel Fojt#
23ca58f742SDaniel Fojt#	DPLIBS
24ca58f742SDaniel Fojt#		List of LIB* that we will actually link with
25ca58f742SDaniel Fojt#		should be in correct link order.
26ca58f742SDaniel Fojt#		DPLIBS is a short-cut to ensure that DPADD and LDADD are
27ca58f742SDaniel Fojt#		kept in sync.
28ca58f742SDaniel Fojt#
29ca58f742SDaniel Fojt#	DPADD	List of LIB* that should already be built.
30ca58f742SDaniel Fojt#
31ca58f742SDaniel Fojt#	SRC_LIBS
32ca58f742SDaniel Fojt#		List of LIB* that we want headers from, we do *not*
33ca58f742SDaniel Fojt#		require that such libs have been built.
34ca58f742SDaniel Fojt#
35ca58f742SDaniel Fojt#	The above all get added to DPMAGIC_LIBS which is what we
36ca58f742SDaniel Fojt#	process.
37ca58f742SDaniel Fojt#
38ca58f742SDaniel Fojt#	We expect LIB* to be set to absolute path of a library -
39ca58f742SDaniel Fojt#	suitable for putting in DPADD.
40ca58f742SDaniel Fojt#	eg.
41ca58f742SDaniel Fojt#
42ca58f742SDaniel Fojt#		LIBC ?= ${OBJTOP}/lib/libc/libc.a
43ca58f742SDaniel Fojt#
44ca58f742SDaniel Fojt#	From such a path we can derrive a number of other variables
45ca58f742SDaniel Fojt#	for which we can supply sensible default values.
46ca58f742SDaniel Fojt#	We name all these variables for the basename of the library
47ca58f742SDaniel Fojt#	(libc in our example above -- ${__lib:T:R} in below):
48ca58f742SDaniel Fojt#
49ca58f742SDaniel Fojt#	LDADD_${__lib:T:R}:
50ca58f742SDaniel Fojt#		What should be added to LDADD (eg -lc)
51ca58f742SDaniel Fojt#
52ca58f742SDaniel Fojt#	OBJ_${__lib:T:R}:
53ca58f742SDaniel Fojt#		This is trivial - just the dirname of the built library.
54ca58f742SDaniel Fojt#
55ca58f742SDaniel Fojt#	SRC_${__lib:T:R}:
56ca58f742SDaniel Fojt#		Where the src for ${__lib} is, if LIB* is set as above
57ca58f742SDaniel Fojt#		we can simply substitute ${SRCTOP} for ${OBJTOP} in
58ca58f742SDaniel Fojt#		the dirname.
59ca58f742SDaniel Fojt#
60ca58f742SDaniel Fojt#	INCLUDES_${__lib:T:R}:
61ca58f742SDaniel Fojt#		What should be added to CFLAGS
62ca58f742SDaniel Fojt#
63ca58f742SDaniel Fojt#		If the directory ${SRC_${__lib:T:R}}/h exists we will
64ca58f742SDaniel Fojt#		only add -I${SRC_${__lib:T:R}}/h on the basis that
65ca58f742SDaniel Fojt#		this is where the public api is kept.
66ca58f742SDaniel Fojt#
67ca58f742SDaniel Fojt#		Otherwise default will be -I${OBJ_${__lib:T:R}}
68ca58f742SDaniel Fojt#		-I${SRC_${__lib:T:R}}
69ca58f742SDaniel Fojt#
70ca58f742SDaniel Fojt#	Note much of the above is skipped for staged libs
71ca58f742SDaniel Fojt#	eg.
72ca58f742SDaniel Fojt#		LIBC ?= ${STAGE_OBJTOP}/usr/lib/libc.a
73ca58f742SDaniel Fojt#
74ca58f742SDaniel Fojt#	Since we can safely assume that -I${STAGE_OBJTOP}/usr/include
75ca58f742SDaniel Fojt#	and -L${STAGE_OBJTOP}/usr/lib are sufficient, and we should
76ca58f742SDaniel Fojt#	have no need of anything else.
77ca58f742SDaniel Fojt#
78ca58f742SDaniel Fojt
795f1e34d9SAlexandre Perrin.if !target(__${.PARSEFILE}__)
80*6eef5f0cSAntonio Huete Jimenez__${.PARSEFILE}__: .NOTMAIN
815f1e34d9SAlexandre Perrin
825f1e34d9SAlexandre Perrin# sometimes we play games with .CURDIR etc
835f1e34d9SAlexandre Perrin# _* hold the original values of .*
845f1e34d9SAlexandre Perrin_OBJDIR?= ${.OBJDIR}
855f1e34d9SAlexandre Perrin_CURDIR?= ${.CURDIR}
865f1e34d9SAlexandre Perrin
87f445c897SJohn Marino.if ${_CURDIR} == ${SRCTOP}
885f1e34d9SAlexandre PerrinRELDIR=.
895f1e34d9SAlexandre PerrinRELTOP=.
905f1e34d9SAlexandre Perrin.else
91f445c897SJohn MarinoRELDIR?= ${_CURDIR:S,${SRCTOP}/,,}
92f445c897SJohn Marino.if ${RELDIR} == ${_CURDIR}
93f445c897SJohn MarinoRELDIR?= ${_OBJDIR:S,${OBJTOP}/,,}
945f1e34d9SAlexandre Perrin.endif
955f1e34d9SAlexandre PerrinRELTOP?= ${RELDIR:C,[^/]+,..,g}
965f1e34d9SAlexandre Perrin.endif
975f1e34d9SAlexandre PerrinRELOBJTOP?= ${OBJTOP}
985f1e34d9SAlexandre PerrinRELSRCTOP?= ${SRCTOP}
995f1e34d9SAlexandre Perrin
100f445c897SJohn Marino# we get included just about everywhere so this is handy...
101f445c897SJohn Marino# C*DEBUG_XTRA are for defining on cmd line etc
102f445c897SJohn Marino# so do not use in makefiles.
103f445c897SJohn Marino.ifdef CFLAGS_DEBUG_XTRA
104f445c897SJohn MarinoCFLAGS_LAST += ${CFLAGS_DEBUG_XTRA}
105f445c897SJohn Marino.endif
106f445c897SJohn Marino.ifdef CXXFLAGS_DEBUG_XTRA
107f445c897SJohn MarinoCXXFLAGS_LAST += ${CXXFLAGS_DEBUG_XTRA}
108f445c897SJohn Marino.endif
109f445c897SJohn Marino
110f445c897SJohn Marino.-include <local.dpadd.mk>
111f445c897SJohn Marino
112f445c897SJohn Marino# DPLIBS helps us ensure we keep DPADD and LDADD in sync
113f445c897SJohn MarinoDPLIBS+= ${DPLIBS_LAST}
114f445c897SJohn MarinoDPADD+= ${DPLIBS:N-*}
115ca58f742SDaniel Fojt.for __lib in ${DPLIBS}
116ca58f742SDaniel Fojt.if "${__lib:M-*}" != ""
117f445c897SJohn MarinoLDADD += ${__lib}
118f445c897SJohn Marino.else
119ca58f742SDaniel FojtLDADD += ${LDADD_${__lib:T:R}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
120f445c897SJohn Marino.endif
121f445c897SJohn Marino.endfor
122f445c897SJohn Marino
123f445c897SJohn Marino# DPADD can contain things other than libs
124f445c897SJohn Marino__dpadd_libs := ${DPADD:M*/lib*}
125f445c897SJohn Marino
126ca58f742SDaniel Fojt.if defined(PROG) && ${MK_PROG_LDORDER_MK:Uno} != "no"
127f445c897SJohn Marino# some libs have dependencies...
128f445c897SJohn Marino# DPLIBS_* allows bsd.libnames.mk to flag libs which must be included
129f445c897SJohn Marino# in DPADD for a given library.
130f445c897SJohn Marino# Gather all such dependencies into __ldadd_all_xtras
131f445c897SJohn Marino# dups will be dealt with later.
132f445c897SJohn Marino# Note: libfoo_pic uses DPLIBS_libfoo
133f445c897SJohn Marino__ldadd_all_xtras=
134f445c897SJohn Marino.for __lib in ${__dpadd_libs:@d@${DPLIBS_${d:T:R:S,_pic,,}}@}
135f445c897SJohn Marino__ldadd_all_xtras+= ${LDADD_${__lib}:U${__lib:T:R:S/lib/-l/:C/\.so.*//}}
136f445c897SJohn Marino.if "${DPADD:M${__lib}}" == ""
137f445c897SJohn MarinoDPADD+= ${__lib}
138f445c897SJohn Marino.endif
139f445c897SJohn Marino.endfor
140ca58f742SDaniel Fojt.endif
141f445c897SJohn Marino# Last of all... for libc and libgcc
142f445c897SJohn MarinoDPADD+= ${DPADD_LAST}
143f445c897SJohn Marino
144f445c897SJohn Marino# de-dupuplicate __ldadd_all_xtras into __ldadd_xtras
145f445c897SJohn Marino# in reverse order so that libs end up listed after all that needed them.
146f445c897SJohn Marino__ldadd_xtras=
147f445c897SJohn Marino.for __lib in ${__ldadd_all_xtras:[-1..1]}
148f445c897SJohn Marino.if "${__ldadd_xtras:M${__lib}}" == "" || ${NEED_IMPLICIT_LDADD:tl:Uno} != "no"
149f445c897SJohn Marino__ldadd_xtras+= ${__lib}
150f445c897SJohn Marino.endif
151f445c897SJohn Marino.endfor
152f445c897SJohn Marino
153f445c897SJohn Marino.if !empty(__ldadd_xtras)
154f445c897SJohn Marino# now back to the original order
155f445c897SJohn Marino__ldadd_xtras:= ${__ldadd_xtras:[-1..1]}
156f445c897SJohn MarinoLDADD+= ${__ldadd_xtras}
157f445c897SJohn Marino.endif
158f445c897SJohn Marino
159f445c897SJohn Marino# Convert DPADD into -I and -L options and add them to CPPFLAGS and LDADD
160f445c897SJohn Marino# For the -I's convert the path to a relative one.  For separate objdirs
161f445c897SJohn Marino# the DPADD paths will be to the obj tree so we need to subst anyway.
162f445c897SJohn Marino
163f445c897SJohn Marino# update this
164f445c897SJohn Marino__dpadd_libs := ${DPADD:M*/lib*}
165f445c897SJohn Marino
166f445c897SJohn Marino# Order -L's to search ours first.
167f445c897SJohn Marino# Avoids picking up old versions already installed.
168f445c897SJohn Marino__dpadd_libdirs := ${__dpadd_libs:R:H:S/^/-L/g:O:u:N-L}
169f445c897SJohn MarinoLDADD += ${__dpadd_libdirs:M-L${OBJTOP}/*}
170f445c897SJohn MarinoLDADD += ${__dpadd_libdirs:N-L${OBJTOP}/*:N-L${HOST_LIBDIR:U/usr/lib}}
171f445c897SJohn Marino.if defined(HOST_LIBDIR) && ${HOST_LIBDIR} != "/usr/lib"
172f445c897SJohn MarinoLDADD+= -L${HOST_LIBDIR}
173f445c897SJohn Marino.endif
174f445c897SJohn Marino
1755f1e34d9SAlexandre Perrin.if !make(dpadd)
1765f1e34d9SAlexandre Perrin.ifdef LIB
1775f1e34d9SAlexandre Perrin# Each lib is its own src_lib, we want to include it in SRC_LIBS
1785f1e34d9SAlexandre Perrin# so that the correct INCLUDES_* will be picked up automatically.
1795f1e34d9SAlexandre PerrinSRC_LIBS+= ${_OBJDIR}/lib${LIB}.a
1805f1e34d9SAlexandre Perrin.endif
1815f1e34d9SAlexandre Perrin.endif
1825f1e34d9SAlexandre Perrin
1835f1e34d9SAlexandre Perrin#
1845f1e34d9SAlexandre Perrin# This little bit of magic, assumes that SRC_libfoo will be
1855f1e34d9SAlexandre Perrin# set if it cannot be correctly derrived from ${LIBFOO}
1865f1e34d9SAlexandre Perrin# Note that SRC_libfoo and INCLUDES_libfoo should be named for the
1876a91b982SJohn Marino# actual library name not the variable name that might refer to it.
1885f1e34d9SAlexandre Perrin# 99% of the time the two are the same, but the DPADD logic
1896a91b982SJohn Marino# only has the library name available, so stick to that.
1905f1e34d9SAlexandre Perrin#
1915f1e34d9SAlexandre Perrin
1925f1e34d9SAlexandre PerrinSRC_LIBS?=
193ca58f742SDaniel Fojt# magic_libs includes those we want to link with
194ca58f742SDaniel Fojt# as well as those we might look at
195ca58f742SDaniel Fojt__dpadd_magic_libs += ${__dpadd_libs} ${SRC_LIBS}
196ca58f742SDaniel FojtDPMAGIC_LIBS += ${__dpadd_magic_libs} \
197ca58f742SDaniel Fojt	${__dpadd_magic_libs:@d@${DPMAGIC_LIBS_${d:T:R}}@}
1985f1e34d9SAlexandre Perrin
199f445c897SJohn Marino# we skip this for staged libs
200f445c897SJohn Marino.for __lib in ${DPMAGIC_LIBS:O:u:N${STAGE_OBJTOP:Unot}*/lib/*}
2015f1e34d9SAlexandre Perrin#
2025f1e34d9SAlexandre Perrin# if SRC_libfoo is not set, then we assume that the srcdir corresponding
2035f1e34d9SAlexandre Perrin# to where we found the library is correct.
2045f1e34d9SAlexandre Perrin#
2055f1e34d9SAlexandre PerrinSRC_${__lib:T:R} ?= ${__lib:H:S,${OBJTOP},${RELSRCTOP},}
2065f1e34d9SAlexandre Perrin#
2075f1e34d9SAlexandre Perrin# This is a no-brainer but just to be complete...
2085f1e34d9SAlexandre Perrin#
2095f1e34d9SAlexandre PerrinOBJ_${__lib:T:R} ?= ${__lib:H:S,${OBJTOP},${RELOBJTOP},}
2105f1e34d9SAlexandre Perrin#
2115f1e34d9SAlexandre Perrin# If INCLUDES_libfoo is not set, then we'll use ${SRC_libfoo}/h if it exists,
2125f1e34d9SAlexandre Perrin# else just ${SRC_libfoo}.
2135f1e34d9SAlexandre Perrin#
214*6eef5f0cSAntonio Huete Jimenez.if !empty(SRC_${__lib:T:R})
2155f1e34d9SAlexandre PerrinINCLUDES_${__lib:T:R} ?= -I${exists(${SRC_${__lib:T:R}}/h):?${SRC_${__lib:T:R}}/h:${SRC_${__lib:T:R}}}
216*6eef5f0cSAntonio Huete Jimenez.endif
2175f1e34d9SAlexandre Perrin.endfor
2185f1e34d9SAlexandre Perrin
219f445c897SJohn Marino# even for staged libs we sometimes
220f445c897SJohn Marino# need to allow direct -I to avoid cicular dependencies
221f445c897SJohn Marino.for __lib in ${DPMAGIC_LIBS:O:u:T:R}
222f445c897SJohn Marino.if !empty(SRC_${__lib}) && empty(INCLUDES_${__lib})
223f445c897SJohn Marino# must be a staged lib
224f445c897SJohn Marino.if exists(${SRC_${__lib}}/h)
225f445c897SJohn MarinoINCLUDES_${__lib} = -I${SRC_${__lib}}/h
226f445c897SJohn Marino.else
227f445c897SJohn MarinoINCLUDES_${__lib} = -I${SRC_${__lib}}
228f445c897SJohn Marino.endif
229f445c897SJohn Marino.endif
230f445c897SJohn Marino.endfor
231f445c897SJohn Marino
232f445c897SJohn Marino# when linking a shared lib, avoid non pic libs
233f445c897SJohn MarinoSHLDADD+= ${LDADD:N-[lL]*}
234f445c897SJohn Marino.for __lib in ${__dpadd_libs:u}
235f445c897SJohn Marino.if defined(SHLIB_NAME) && ${LDADD:M-l${__lib:T:R:S,lib,,}} != ""
236f445c897SJohn Marino.if ${__lib:T:N*_pic.a:N*.so} == "" || exists(${__lib:R}.so)
237f445c897SJohn MarinoSHLDADD+= -l${__lib:T:R:S,lib,,}
238f445c897SJohn Marino.elif exists(${__lib:R}_pic.a)
239f445c897SJohn MarinoSHLDADD+= -l${__lib:T:R:S,lib,,}_pic
240f445c897SJohn Marino.else
241f445c897SJohn Marino.warning ${RELDIR}.${TARGET_SPEC} needs ${__lib:T:R}_pic.a
242f445c897SJohn MarinoSHLDADD+= -l${__lib:T:R:S,lib,,}
243f445c897SJohn Marino.endif
244f445c897SJohn MarinoSHLDADD+= -L${__lib:H}
245f445c897SJohn Marino.endif
246f445c897SJohn Marino.endfor
247f445c897SJohn Marino
2485f1e34d9SAlexandre Perrin# Now for the bits we actually need
2495f1e34d9SAlexandre Perrin__dpadd_incs=
2505f1e34d9SAlexandre Perrin.for __lib in ${__dpadd_libs:u}
2515f1e34d9SAlexandre Perrin.if (make(${PROG}_p) || defined(NEED_GPROF)) && exists(${__lib:R}_p.a)
2525f1e34d9SAlexandre Perrin__ldadd=-l${__lib:T:R:S,lib,,}
2535f1e34d9SAlexandre PerrinLDADD := ${LDADD:S,^${__ldadd}$,${__ldadd}_p,g}
2545f1e34d9SAlexandre Perrin.endif
255f445c897SJohn Marino.endfor
2565f1e34d9SAlexandre Perrin
2575f1e34d9SAlexandre Perrin#
2585f1e34d9SAlexandre Perrin# We take care of duplicate suppression later.
259f445c897SJohn Marino# don't apply :T:R too early
260ca58f742SDaniel Fojt__dpadd_incs += ${__dpadd_magic_libs:u:@x@${INCLUDES_${x:T:R}}@}
261ca58f742SDaniel Fojt__dpadd_incs += ${__dpadd_magic_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_${x:T:R}}@}
262f445c897SJohn Marino
263ca58f742SDaniel Fojt__dpadd_last_incs += ${__dpadd_magic_libs:u:@x@${INCLUDES_LAST_${x:T:R}}@}
264ca58f742SDaniel Fojt__dpadd_last_incs += ${__dpadd_magic_libs:O:u:@s@${SRC_LIBS_${s:T:R}:U}@:@x@${INCLUDES_LAST_${x:T:R}}@}
265f445c897SJohn Marino
266ca58f742SDaniel Fojt.if defined(HOSTPROG) || ${MACHINE:Nhost*} == ""
267f445c897SJohn Marino# we want any -I/usr/* last
268f445c897SJohn Marino__dpadd_last_incs := \
269f445c897SJohn Marino	${__dpadd_last_incs:N-I/usr/*} \
270f445c897SJohn Marino	${__dpadd_incs:M-I/usr/*} \
271f445c897SJohn Marino	${__dpadd_last_incs:M-I/usr/*}
272f445c897SJohn Marino__dpadd_incs := ${__dpadd_incs:N-I/usr/*}
273f445c897SJohn Marino.endif
2745f1e34d9SAlexandre Perrin
2755f1e34d9SAlexandre Perrin#
2765f1e34d9SAlexandre Perrin# eliminate any duplicates - but don't mess with the order
2775f1e34d9SAlexandre Perrin# force evaluation now - to avoid giving make a headache
2785f1e34d9SAlexandre Perrin#
2795f1e34d9SAlexandre Perrin.for t in CFLAGS CXXFLAGS
2805f1e34d9SAlexandre Perrin# avoid duplicates
2815f1e34d9SAlexandre Perrin__$t_incs:=${$t:M-I*:O:u}
2825f1e34d9SAlexandre Perrin.for i in ${__dpadd_incs}
2835f1e34d9SAlexandre Perrin.if "${__$t_incs:M$i}" == ""
2845f1e34d9SAlexandre Perrin$t+= $i
2855f1e34d9SAlexandre Perrin__$t_incs+= $i
2865f1e34d9SAlexandre Perrin.endif
2875f1e34d9SAlexandre Perrin.endfor
2885f1e34d9SAlexandre Perrin.endfor
2895f1e34d9SAlexandre Perrin
290f445c897SJohn Marino.for t in CFLAGS_LAST CXXFLAGS_LAST
291f445c897SJohn Marino# avoid duplicates
292f445c897SJohn Marino__$t_incs:=${$t:M-I*:u}
293f445c897SJohn Marino.for i in ${__dpadd_last_incs}
294f445c897SJohn Marino.if "${__$t_incs:M$i}" == ""
295f445c897SJohn Marino$t+= $i
296f445c897SJohn Marino__$t_incs+= $i
297f445c897SJohn Marino.endif
298f445c897SJohn Marino.endfor
299f445c897SJohn Marino.endfor
300f445c897SJohn Marino
3015f1e34d9SAlexandre Perrin# This target is used to gather a list of
3025f1e34d9SAlexandre Perrin# dir: ${DPADD}
3035f1e34d9SAlexandre Perrin# entries
3045f1e34d9SAlexandre Perrin.if make(*dpadd*)
3055f1e34d9SAlexandre Perrin.if !target(dpadd)
3065f1e34d9SAlexandre Perrindpadd:	.NOTMAIN
3075f1e34d9SAlexandre Perrin.if defined(DPADD) && ${DPADD} != ""
3085f1e34d9SAlexandre Perrin	@echo "${RELDIR}: ${DPADD:S,${OBJTOP}/,,}"
3095f1e34d9SAlexandre Perrin.endif
3105f1e34d9SAlexandre Perrin.endif
3115f1e34d9SAlexandre Perrin.endif
3125f1e34d9SAlexandre Perrin
3135f1e34d9SAlexandre Perrin.ifdef SRC_PATHADD
3145f1e34d9SAlexandre Perrin# We don't want to assume that we need to .PATH every element of
3155f1e34d9SAlexandre Perrin# SRC_LIBS, but the Makefile cannot do
3165f1e34d9SAlexandre Perrin# .PATH: ${SRC_libfoo}
3175f1e34d9SAlexandre Perrin# since the value of SRC_libfoo must be available at the time .PATH:
3185f1e34d9SAlexandre Perrin# is read - and we only just worked it out.
3195f1e34d9SAlexandre Perrin# Further, they can't wait until after include of {lib,prog}.mk as
3205f1e34d9SAlexandre Perrin# the .PATH is needed before then.
3215f1e34d9SAlexandre Perrin# So we let the Makefile do
3225f1e34d9SAlexandre Perrin# SRC_PATHADD+= ${SRC_libfoo}
3235f1e34d9SAlexandre Perrin# and we defer the .PATH: until now so that SRC_libfoo will be available.
3245f1e34d9SAlexandre Perrin.PATH: ${SRC_PATHADD}
3255f1e34d9SAlexandre Perrin.endif
3265f1e34d9SAlexandre Perrin
327f445c897SJohn Marino# after all that, if doing -n we don't care
328f445c897SJohn Marino.if ${.MAKEFLAGS:Ux:M-n} != ""
329f445c897SJohn MarinoDPADD =
330f445c897SJohn Marino.elif ${.MAKE.MODE:Mmeta*} != "" && exists(${.MAKE.DEPENDFILE})
331f445c897SJohn MarinoDPADD_CLEAR_DPADD ?= yes
332f445c897SJohn Marino.if ${DPADD_CLEAR_DPADD} == "yes"
333f445c897SJohn Marino# save this
334f445c897SJohn Marino__dpadd_libs := ${__dpadd_libs}
335f445c897SJohn Marino# we have made what use of it we can of DPADD
336f445c897SJohn MarinoDPADD =
337f445c897SJohn Marino.endif
338f445c897SJohn Marino.endif
339f445c897SJohn Marino
3405f1e34d9SAlexandre Perrin.endif
341