]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/bsd.mkopt.mk
Merge LUA 5.4.6
[FreeBSD/FreeBSD.git] / share / mk / bsd.mkopt.mk
1 #
2 # $FreeBSD$
3 #
4 # Generic mechanism to deal with WITH and WITHOUT options and turn
5 # them into MK_ options.
6 #
7 # For each option FOO in __DEFAULT_YES_OPTIONS, MK_FOO is set to
8 # "yes", unless WITHOUT_FOO is defined, in which case it is set to
9 # "no".
10 #
11 # For each option FOO in __REQUIRED_OPTIONS, MK_FOO is set to "yes".
12 #
13 # For each option FOO in __DEFAULT_NO_OPTIONS, MK_FOO is set to "no",
14 # unless WITH_FOO is defined, in which case it is set to "yes".
15 #
16 # For each entry FOO/BAR in __DEFAULT_DEPENDENT_OPTIONS,
17 # MK_FOO is set to "no" if WITHOUT_FOO is defined,
18 # "yes" if WITH_FOO is defined, otherwise the value of MK_BAR.
19 #
20 # If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and
21 # MK_FOO is set to "no" regardless of which list it was in.
22 #
23 # All of __DEFAULT_YES_OPTIONS, __DEFAULT_NO_OPTIONS and
24 # __DEFAULT_DEPENDENT_OPTIONS are undef'd after all this processing,
25 # allowing this file to be included multiple times with different lists.
26 #
27 # Other parts of the build system will set BROKEN_OPTIONS to a list
28 # of options that are broken on this platform. This will not be unset
29 # before returning. Clients are expected to always += this variable.
30 #
31 # Users should generally define WITH_FOO or WITHOUT_FOO, but the build
32 # system should use MK_FOO={yes,no} when it needs to override the
33 # user's desires or default behavior.
34 #
35
36 #
37 # MK_* options which default to "yes".
38 #
39 .for var in ${__DEFAULT_YES_OPTIONS}
40 .if !defined(MK_${var})
41 .if defined(WITH_${var}) && ${WITH_${var}} == "no"
42 .warning Use WITHOUT_${var}=1 instead of WITH_${var}=no
43 .endif
44 .if defined(WITHOUT_${var})                     # WITHOUT always wins
45 MK_${var}:=     no
46 .else
47 MK_${var}:=     yes
48 .endif
49 .else
50 .if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
51 .error Illegal value for MK_${var}: ${MK_${var}}
52 .endif
53 .endif # !defined(MK_${var})
54 .endfor
55 .undef __DEFAULT_YES_OPTIONS
56
57 #
58 # MK_* options which are always yes, typically as a transitional
59 # step towards removing the options entirely.
60 #
61 .for var in ${__REQUIRED_OPTIONS}
62 .if defined(WITHOUT_${var})
63 .warning WITHOUT_${var} option ignored: it is no longer supported
64 .endif
65 MK_${var}:=     yes
66 .endfor
67
68 #
69 # MK_* options which default to "no".
70 #
71 .for var in ${__DEFAULT_NO_OPTIONS}
72 .if !defined(MK_${var})
73 .if defined(WITH_${var}) && ${WITH_${var}} == "no"
74 .warning Use WITHOUT_${var}=1 instead of WITH_${var}=no
75 .endif
76 .if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
77 MK_${var}:=     yes
78 .else
79 MK_${var}:=     no
80 .endif
81 .else
82 .if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
83 .error Illegal value for MK_${var}: ${MK_${var}}
84 .endif
85 .endif # !defined(MK_${var})
86 .endfor
87 .undef __DEFAULT_NO_OPTIONS
88
89 #
90 # MK_* options which are always no, usually because they are
91 # unsupported/badly broken on this architecture.
92 #
93 .for var in ${BROKEN_OPTIONS}
94 MK_${var}:=     no
95 .endfor
96
97 .for vv in ${__DEFAULT_DEPENDENT_OPTIONS}
98 .if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
99 MK_${vv:H}?= no
100 .elif defined(WITH_${vv:H})
101 MK_${vv:H}?= yes
102 .elif defined(WITHOUT_${vv:H})
103 MK_${vv:H}?= no
104 .else
105 MK_${vv:H}?= ${MK_${vv:T}}
106 .endif
107 MK_${vv:H}:= ${MK_${vv:H}}
108 .endfor
109 .undef __DEFAULT_DEPENDENT_OPTIONS