xref: /freebsd/sys/conf/kern.opts.mk (revision aa24f48b361effe51163877d84f1b70d32b77e04)
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    IPSEC_SUPPORT \
38    ISCSI \
39    KERNEL_SYMBOLS \
40    NETGRAPH \
41    PF \
42    SOURCELESS_HOST \
43    SOURCELESS_UCODE \
44    TESTS \
45    USB_GADGET_EXAMPLES \
46    ZFS
47
48__DEFAULT_NO_OPTIONS = \
49    EXTRA_TCP_STACKS \
50    NAND \
51    OFED \
52    RATELIMIT \
53    REPRODUCIBLE_BUILD
54
55# Some options are totally broken on some architectures. We disable
56# them. If you need to enable them on an experimental basis, you
57# must change this code.
58# Note: These only apply to the list of modules we build by default
59# and sometimes what is in the opt_*.h files by default.
60# Kernel config files are unaffected, though some targets can be
61# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
62
63# Things that don't work based on the CPU
64.if ${MACHINE_CPUARCH} == "arm"
65. if ${MACHINE_ARCH:Marmv6*} == ""
66BROKEN_OPTIONS+= CDDL ZFS
67. endif
68.endif
69
70.if ${MACHINE_CPUARCH} == "mips"
71BROKEN_OPTIONS+= CDDL ZFS SSP
72.endif
73
74.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
75BROKEN_OPTIONS+= ZFS
76.endif
77
78.if ${MACHINE_CPUARCH} == "riscv"
79BROKEN_OPTIONS+= FORMAT_EXTENSIONS
80.endif
81
82# Things that don't work because the kernel doesn't have the support
83# for them.
84.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
85BROKEN_OPTIONS+= OFED
86.endif
87
88# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
89
90# Those that default to yes
91.for var in ${__DEFAULT_YES_OPTIONS}
92.if !defined(MK_${var})
93.if defined(WITHOUT_${var})			# WITHOUT always wins
94MK_${var}:=	no
95.else
96MK_${var}:=	yes
97.endif
98.else
99.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
100.error "Illegal value for MK_${var}: ${MK_${var}}"
101.endif
102.endif # !defined(MK_${var})
103.endfor
104.undef __DEFAULT_YES_OPTIONS
105
106# Those that default to no
107.for var in ${__DEFAULT_NO_OPTIONS}
108.if !defined(MK_${var})
109.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
110MK_${var}:=	yes
111.else
112MK_${var}:=	no
113.endif
114.else
115.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
116.error "Illegal value for MK_${var}: ${MK_${var}}"
117.endif
118.endif # !defined(MK_${var})
119.endfor
120.undef __DEFAULT_NO_OPTIONS
121
122#
123# MK_* options which are always no, usually because they are
124# unsupported/badly broken on this architecture.
125#
126.for var in ${BROKEN_OPTIONS}
127MK_${var}:=	no
128.endfor
129.undef BROKEN_OPTIONS
130#end of bsd.mkopt.mk expanded inline.
131
132#
133# MK_*_SUPPORT options which default to "yes" unless their corresponding
134# MK_* variable is set to "no".
135#
136.for var in \
137    INET \
138    INET6
139.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
140MK_${var}_SUPPORT:= no
141.else
142.if defined(KERNBUILDDIR)	# See if there's an opt_foo.h
143.if !defined(OPT_${var})
144OPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
145.export OPT_${var}
146.endif
147.if ${OPT_${var}} == ""		# nothing -> no
148MK_${var}_SUPPORT:= no
149.else
150MK_${var}_SUPPORT:= yes
151.endif
152.else				# otherwise, yes
153MK_${var}_SUPPORT:= yes
154.endif
155.endif
156.endfor
157
158# Some modules only compile successfully if option FDT is set, due to #ifdef FDT
159# wrapped around declarations.  Module makefiles can optionally compile such
160# things using .if !empty(OPT_FDT)
161.if !defined(OPT_FDT) && defined(KERNBUILDDIR)
162OPT_FDT!= sed -n '/FDT/p' ${KERNBUILDDIR}/opt_platform.h
163.export OPT_FDT
164.endif
165