xref: /freebsd/share/mk/bsd.mkopt.mk (revision 991554f2c46fdbc7e9acbf87fc8da089618c3a19)
1#
2# $FreeBSD$
3#
4# Generic mechanism to deal with WITH and WITHOUT options and turn them into MK_ options.
5#
6#
7# For each option FOO that defaults to YES, MK_FOO is set to yes, unless WITHOUT_FOO
8# is defined, in which case it is set to no. If both WITH_FOO and WITHOUT_FOO are
9# defined, WITHOUT_FOO wins. The list of default yes options is contained in the
10# __DEFAULT_YES_OPTIONS variable, which is undefined after expansion.
11#
12# For each option FOO that defaults to NO, MK_FOO is set to no, unless WITH_FOO
13# is defined, in which case it is set to yes. If both WITH_FOO and WITHOUT_FOO are
14# defined, WITH_FOO wins. The list of default no options is contained in the
15# __DEFAULT_NO_OPTIONS variable, which is undefined after expansion.
16#
17.for var in ${__DEFAULT_YES_OPTIONS}
18.if !defined(MK_${var})
19.if defined(WITHOUT_${var})	# IF both WITH and WITHOUT defined, WITHOUT wins.
20MK_${var}:=	no
21.else
22MK_${var}:=	yes
23.endif
24.endif
25.endfor
26.undef __DEFAULT_YES_OPTIONS
27
28#
29# MK_* options which default to "no".
30#
31.for var in ${__DEFAULT_NO_OPTIONS}
32.if !defined(MK_${var})
33.if defined(WITH_${var})	# If both WITH and WITHOUT defined, WITH wins
34MK_${var}:=	yes
35.else
36MK_${var}:=	no
37.endif
38.endif
39.endfor
40.undef __DEFAULT_NO_OPTIONS
41