1 # $NetBSD: pkg-build-options.mk,v 1.8 2009/03/20 19:25:01 joerg Exp $
3 # This procedure determines the PKG_OPTIONS that have been in effect
4 # when the package ${pkgbase} has been built. When the package is not
5 # yet installed, the current PKG_OPTIONS are queried.
9 # The basename of the package.
12 # PKG_BUILD_OPTIONS.${pkgbase}
13 # The build options of the package.
17 # .include "../../mk/pkg-build-options.mk"
19 # Keywords: options pkg-build-options PKG_BUILD_OPTIONS
22 .
include "bsd.fast.prefs.mk"
24 # For the check for inclusion from non-buildlink3.mk, it is irrelevant
25 # whether BUILDLINK_TREE was empty or undefined, so defining it here
26 # avoids dealing one case.
29 # Counting words doesn't work as expected for empty strings, they
30 # still have one word. Older make doesn't like the code without
31 # variable assignment for unknown reasons.
32 _BUILDLINK_TREE_WITH
:= ${BUILDLINK_TREE
:M-
*:[\
#]}
33 _BUILDLINK_TREE_WITHOUT
:= ${BUILDLINK_TREE
:N-
*:[\
#]}
34 .if
(empty
(BUILDLINK_TREE
:M-
*) && empty
(BUILDLINK_TREE
:N-
*)) || \
35 (!empty
(BUILDLINK_TREE
:M-
*) && !empty
(BUILDLINK_TREE
:N-
*) && \
36 ${_BUILDLINK_TREE_WITH} == ${_BUILDLINK_TREE_WITHOUT})
38 PKG_BUILD_OPTIONS.
${b}=
39 PKG_FAIL_REASON
+= "[pkg-build-options.mk] This file may only be included from a buildlink3.mk file (pkgbase=${b})."
43 . if
!defined
(PKG_BUILD_OPTIONS.
${b})
44 PKG_BUILD_OPTIONS.
${b} != \
46 ${PKG_INFO} -Q PKG_OPTIONS
${b} 2>/dev
/null \
47 ||
{ cd
${BUILDLINK_PKGSRCDIR.
${b}} \
48 && ${MAKE} ${MAKEFLAGS} show-var VARNAME
=PKG_OPTIONS
; }
50 MAKEFLAGS
+= PKG_BUILD_OPTIONS.
${b}=${PKG_BUILD_OPTIONS.
${b}:Q
}
53 MAKEVARS
+= PKG_BUILD_OPTIONS.
${b}