1265785Simp# $FreeBSD: stable/11/sys/conf/kern.opts.mk 332306 2018-04-08 20:54:13Z emaste $
2265785Simp
3265785Simp# Options set in the build system that affect the kernel somehow.
4265785Simp
5265785Simp#
6265785Simp# Define MK_* variables (which are either "yes" or "no") for users
7265785Simp# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
8265785Simp# make(1) environment.
9265785Simp# These should be tested with `== "no"' or `!= "no"' in makefiles.
10265785Simp# The NO_* variables should only be set by makefiles for variables
11265785Simp# that haven't been converted over.
12265785Simp#
13265785Simp
14269812Simp# Note: bsd.own.mk must be included before the rest of kern.opts.mk to make
15269812Simp# building on 10.x and earlier work. This should be removed when that's no
16269812Simp# longer supported since it confounds the defaults (since it uses the host's
17269812Simp# notion of defaults rather than what's default in current when building
18269812Simp# within sys/modules).
19269812Simp.include <bsd.own.mk>
20269812Simp
21265785Simp# These options are used by the kernel build process (kern.mk and kmod.mk)
22265785Simp# They have to be listed here so we can build modules outside of the
23265785Simp# src tree.
24265785Simp
25265785Simp__DEFAULT_YES_OPTIONS = \
26277728Sngie    AUTOFS \
27277727Sngie    BHYVE \
28269812Simp    BLUETOOTH \
29277678Sngie    CCD \
30269812Simp    CDDL \
31269812Simp    CRYPT \
32277681Sngie    CUSE \
33265791Simp    FORMAT_EXTENSIONS \
34269540Simp    INET \
35269540Simp    INET6 \
36269812Simp    IPFILTER \
37315514Sae    IPSEC_SUPPORT \
38277675Sngie    ISCSI \
39269812Simp    KERNEL_SYMBOLS \
40269812Simp    NETGRAPH \
41269812Simp    PF \
42269812Simp    SOURCELESS_HOST \
43269812Simp    SOURCELESS_UCODE \
44319171Sngie    TESTS \
45269812Simp    USB_GADGET_EXAMPLES \
46269812Simp    ZFS
47265785Simp
48269812Simp__DEFAULT_NO_OPTIONS = \
49269812Simp    EISA \
50301814Sjtl    EXTRA_TCP_STACKS \
51332306Semaste    KERNEL_RETPOLINE \
52269812Simp    NAND \
53312730Semaste    OFED \
54312730Semaste    REPRODUCIBLE_BUILD
55265785Simp
56279899Simp# Some options are totally broken on some architectures. We disable
57279899Simp# them. If you need to enable them on an experimental basis, you
58279899Simp# must change this code.
59280766Simp# Note: These only apply to the list of modules we build by default
60280766Simp# and sometimes what is in the opt_*.h files by default.
61280766Simp# Kernel config files are unaffected, though some targets can be
62280766Simp# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
63279899Simp
64279899Simp# Things that don't work based on the CPU
65279899Simp.if ${MACHINE_CPUARCH} == "arm"
66291103Sandrew. if ${MACHINE_ARCH:Marmv6*} == ""
67297174SianBROKEN_OPTIONS+= CDDL ZFS
68291103Sandrew. endif
69279899Simp.endif
70279899Simp
71279899Simp.if ${MACHINE_CPUARCH} == "mips"
72279899SimpBROKEN_OPTIONS+= CDDL ZFS
73279899Simp.endif
74279899Simp
75279899Simp.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
76279899SimpBROKEN_OPTIONS+= ZFS
77279899Simp.endif
78279899Simp
79279899Simp# Things that don't work because the kernel doesn't have the support
80279899Simp# for them.
81279899Simp.if ${MACHINE} != "i386"
82279899SimpBROKEN_OPTIONS+= EISA
83279899Simp.endif
84279899Simp
85279899Simp.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
86279899SimpBROKEN_OPTIONS+= OFED
87279899Simp.endif
88279899Simp
89332306Semaste# Things that don't work based on toolchain support.
90332306Semaste.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
91332306SemasteBROKEN_OPTIONS+= KERNEL_RETPOLINE
92332306Semaste.endif
93332306Semaste
94269812Simp# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
95269812Simp
96269812Simp# Those that default to yes
97266349Simp.for var in ${__DEFAULT_YES_OPTIONS}
98266349Simp.if !defined(MK_${var})
99266349Simp.if defined(WITHOUT_${var})			# WITHOUT always wins
100266349SimpMK_${var}:=	no
101265898Simp.else
102266349SimpMK_${var}:=	yes
103265898Simp.endif
104278457Simp.else
105278457Simp.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
106278457Simp.error "Illegal value for MK_${var}: ${MK_${var}}"
107266349Simp.endif
108278457Simp.endif # !defined(MK_${var})
109266349Simp.endfor
110266349Simp.undef __DEFAULT_YES_OPTIONS
111269540Simp
112269812Simp# Those that default to no
113269812Simp.for var in ${__DEFAULT_NO_OPTIONS}
114269812Simp.if !defined(MK_${var})
115269812Simp.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
116269812SimpMK_${var}:=	yes
117269812Simp.else
118269812SimpMK_${var}:=	no
119269812Simp.endif
120278457Simp.else
121278457Simp.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
122278457Simp.error "Illegal value for MK_${var}: ${MK_${var}}"
123269812Simp.endif
124278457Simp.endif # !defined(MK_${var})
125269812Simp.endfor
126269812Simp.undef __DEFAULT_NO_OPTIONS
127269812Simp
128269540Simp#
129279898Simp# MK_* options which are always no, usually because they are
130279898Simp# unsupported/badly broken on this architecture.
131279898Simp#
132279898Simp.for var in ${BROKEN_OPTIONS}
133279898SimpMK_${var}:=	no
134279898Simp.endfor
135279898Simp.undef BROKEN_OPTIONS
136279898Simp#end of bsd.mkopt.mk expanded inline.
137279898Simp
138279898Simp#
139269540Simp# MK_*_SUPPORT options which default to "yes" unless their corresponding
140269540Simp# MK_* variable is set to "no".
141269540Simp#
142269540Simp.for var in \
143269540Simp    INET \
144269540Simp    INET6
145269540Simp.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
146269540SimpMK_${var}_SUPPORT:= no
147269540Simp.else
148274529Simp.if defined(KERNBUILDDIR)	# See if there's an opt_foo.h
149296770Sbdrewery.if !defined(OPT_${var})
150274529SimpOPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
151296770Sbdrewery.export OPT_${var}
152296770Sbdrewery.endif
153274529Simp.if ${OPT_${var}} == ""		# nothing -> no
154274529SimpMK_${var}_SUPPORT:= no
155274529Simp.else
156269540SimpMK_${var}_SUPPORT:= yes
157269540Simp.endif
158274529Simp.else				# otherwise, yes
159274529SimpMK_${var}_SUPPORT:= yes
160274529Simp.endif
161274529Simp.endif
162269540Simp.endfor
163300855Sian
164300855Sian# Some modules only compile successfully if option FDT is set, due to #ifdef FDT
165300855Sian# wrapped around declarations.  Module makefiles can optionally compile such
166300855Sian# things using .if !empty(OPT_FDT)
167300855Sian.if !defined(OPT_FDT) && defined(KERNBUILDDIR)
168300855SianOPT_FDT!= sed -n '/FDT/p' ${KERNBUILDDIR}/opt_platform.h
169300855Sian.export OPT_FDT
170300855Sian.endif
171