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