xref: /freebsd/sys/conf/kern.opts.mk (revision 7d8f797b725e3efc0a4256554654780df83c456c)
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# Note: These only apply to the list of modules we build by default
55# and sometimes what is in the opt_*.h files by default.
56# Kernel config files are unaffected, though some targets can be
57# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
58
59# Things that don't work based on the CPU
60.if ${MACHINE_CPUARCH} == "arm"
61BROKEN_OPTIONS+= CDDL ZFS
62.endif
63
64.if ${MACHINE_CPUARCH} == "mips"
65BROKEN_OPTIONS+= CDDL ZFS
66.endif
67
68.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
69BROKEN_OPTIONS+= ZFS
70.endif
71
72# Things that don't work because the kernel doesn't have the support
73# for them.
74.if ${MACHINE} != "i386"
75BROKEN_OPTIONS+= EISA
76.endif
77
78.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
79BROKEN_OPTIONS+= OFED
80.endif
81
82# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
83
84# Those that default to yes
85.for var in ${__DEFAULT_YES_OPTIONS}
86.if !defined(MK_${var})
87.if defined(WITHOUT_${var})			# WITHOUT always wins
88MK_${var}:=	no
89.else
90MK_${var}:=	yes
91.endif
92.else
93.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
94.error "Illegal value for MK_${var}: ${MK_${var}}"
95.endif
96.endif # !defined(MK_${var})
97.endfor
98.undef __DEFAULT_YES_OPTIONS
99
100# Those that default to no
101.for var in ${__DEFAULT_NO_OPTIONS}
102.if !defined(MK_${var})
103.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
104MK_${var}:=	yes
105.else
106MK_${var}:=	no
107.endif
108.else
109.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
110.error "Illegal value for MK_${var}: ${MK_${var}}"
111.endif
112.endif # !defined(MK_${var})
113.endfor
114.undef __DEFAULT_NO_OPTIONS
115
116#
117# MK_* options which are always no, usually because they are
118# unsupported/badly broken on this architecture.
119#
120.for var in ${BROKEN_OPTIONS}
121MK_${var}:=	no
122.endfor
123.undef BROKEN_OPTIONS
124#end of bsd.mkopt.mk expanded inline.
125
126#
127# MK_*_SUPPORT options which default to "yes" unless their corresponding
128# MK_* variable is set to "no".
129#
130.for var in \
131    INET \
132    INET6
133.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
134MK_${var}_SUPPORT:= no
135.else
136.if defined(KERNBUILDDIR)	# See if there's an opt_foo.h
137OPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
138.if ${OPT_${var}} == ""		# nothing -> no
139MK_${var}_SUPPORT:= no
140.else
141MK_${var}_SUPPORT:= yes
142.endif
143.else				# otherwise, yes
144MK_${var}_SUPPORT:= yes
145.endif
146.endif
147.endfor
148