xref: /freebsd/sys/conf/kern.opts.mk (revision 596596fec79f04e1f413850b44159224ff1fb8dc)
1# $FreeBSD$
2
3# Options set in the build system that affect the kernel somehow.
4
5#
6# Define MK_* variables (which are either "yes" or "no") for users
7# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
8# make(1) environment.
9# These should be tested with `== "no"' or `!= "no"' in makefiles.
10# The NO_* variables should only be set by makefiles for variables
11# that haven't been converted over.
12#
13
14# Note: bsd.own.mk must be included before the rest of kern.opts.mk to make
15# building on 10.x and earlier work. This should be removed when that's no
16# longer supported since it confounds the defaults (since it uses the host's
17# notion of defaults rather than what's default in current when building
18# within sys/modules).
19.include <bsd.own.mk>
20
21# These options are used by the kernel build process (kern.mk and kmod.mk)
22# They have to be listed here so we can build modules outside of the
23# src tree.
24
25__DEFAULT_YES_OPTIONS = \
26    AUTOFS \
27    BHYVE \
28    BLUETOOTH \
29    CCD \
30    CDDL \
31    CRYPT \
32    CUSE \
33    FORMAT_EXTENSIONS \
34    INET \
35    INET6 \
36    IPFILTER \
37    ISCSI \
38    KERNEL_SYMBOLS \
39    NETGRAPH \
40    PF \
41    SOURCELESS_HOST \
42    SOURCELESS_UCODE \
43    USB_GADGET_EXAMPLES \
44    ZFS
45
46__DEFAULT_NO_OPTIONS = \
47    EISA \
48    NAND \
49    OFED
50
51# Some options are totally broken on some architectures. We disable
52# them. If you need to enable them on an experimental basis, you
53# must change this code.
54
55# Things that don't work based on the CPU
56.if ${MACHINE_CPUARCH} == "arm"
57BROKEN_OPTIONS+= CDDL ZFS
58.endif
59
60.if ${MACHINE_CPUARCH} == "mips"
61BROKEN_OPTIONS+= CDDL ZFS
62.endif
63
64.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
65BROKEN_OPTIONS+= ZFS
66.endif
67
68# Things that don't work because the kernel doesn't have the support
69# for them.
70.if ${MACHINE} != "i386"
71BROKEN_OPTIONS+= EISA
72.endif
73
74.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
75BROKEN_OPTIONS+= OFED
76.endif
77
78# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
79
80# Those that default to yes
81.for var in ${__DEFAULT_YES_OPTIONS}
82.if !defined(MK_${var})
83.if defined(WITHOUT_${var})			# WITHOUT always wins
84MK_${var}:=	no
85.else
86MK_${var}:=	yes
87.endif
88.else
89.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
90.error "Illegal value for MK_${var}: ${MK_${var}}"
91.endif
92.endif # !defined(MK_${var})
93.endfor
94.undef __DEFAULT_YES_OPTIONS
95
96# Those that default to no
97.for var in ${__DEFAULT_NO_OPTIONS}
98.if !defined(MK_${var})
99.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
100MK_${var}:=	yes
101.else
102MK_${var}:=	no
103.endif
104.else
105.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
106.error "Illegal value for MK_${var}: ${MK_${var}}"
107.endif
108.endif # !defined(MK_${var})
109.endfor
110.undef __DEFAULT_NO_OPTIONS
111
112#
113# MK_* options which are always no, usually because they are
114# unsupported/badly broken on this architecture.
115#
116.for var in ${BROKEN_OPTIONS}
117MK_${var}:=	no
118.endfor
119.undef BROKEN_OPTIONS
120#end of bsd.mkopt.mk expanded inline.
121
122#
123# MK_*_SUPPORT options which default to "yes" unless their corresponding
124# MK_* variable is set to "no".
125#
126.for var in \
127    INET \
128    INET6
129.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
130MK_${var}_SUPPORT:= no
131.else
132.if defined(KERNBUILDDIR)	# See if there's an opt_foo.h
133OPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
134.if ${OPT_${var}} == ""		# nothing -> no
135MK_${var}_SUPPORT:= no
136.else
137MK_${var}_SUPPORT:= yes
138.endif
139.else				# otherwise, yes
140MK_${var}_SUPPORT:= yes
141.endif
142.endif
143.endfor
144