kern.opts.mk revision 319171
1265785Simp# $FreeBSD: stable/11/sys/conf/kern.opts.mk 319171 2017-05-30 03:02:07Z ngie $
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 \
51269812Simp    NAND \
52312730Semaste    OFED \
53312730Semaste    REPRODUCIBLE_BUILD
54265785Simp
55279899Simp# Some options are totally broken on some architectures. We disable
56279899Simp# them. If you need to enable them on an experimental basis, you
57279899Simp# must change this code.
58280766Simp# Note: These only apply to the list of modules we build by default
59280766Simp# and sometimes what is in the opt_*.h files by default.
60280766Simp# Kernel config files are unaffected, though some targets can be
61280766Simp# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
62279899Simp
63279899Simp# Things that don't work based on the CPU
64279899Simp.if ${MACHINE_CPUARCH} == "arm"
65291103Sandrew. if ${MACHINE_ARCH:Marmv6*} == ""
66297174SianBROKEN_OPTIONS+= CDDL ZFS
67291103Sandrew. endif
68279899Simp.endif
69279899Simp
70279899Simp.if ${MACHINE_CPUARCH} == "mips"
71279899SimpBROKEN_OPTIONS+= CDDL ZFS
72279899Simp.endif
73279899Simp
74279899Simp.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
75279899SimpBROKEN_OPTIONS+= ZFS
76279899Simp.endif
77279899Simp
78279899Simp# Things that don't work because the kernel doesn't have the support
79279899Simp# for them.
80279899Simp.if ${MACHINE} != "i386"
81279899SimpBROKEN_OPTIONS+= EISA
82279899Simp.endif
83279899Simp
84279899Simp.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
85279899SimpBROKEN_OPTIONS+= OFED
86279899Simp.endif
87279899Simp
88269812Simp# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
89269812Simp
90269812Simp# Those that default to yes
91266349Simp.for var in ${__DEFAULT_YES_OPTIONS}
92266349Simp.if !defined(MK_${var})
93266349Simp.if defined(WITHOUT_${var})			# WITHOUT always wins
94266349SimpMK_${var}:=	no
95265898Simp.else
96266349SimpMK_${var}:=	yes
97265898Simp.endif
98278457Simp.else
99278457Simp.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
100278457Simp.error "Illegal value for MK_${var}: ${MK_${var}}"
101266349Simp.endif
102278457Simp.endif # !defined(MK_${var})
103266349Simp.endfor
104266349Simp.undef __DEFAULT_YES_OPTIONS
105269540Simp
106269812Simp# Those that default to no
107269812Simp.for var in ${__DEFAULT_NO_OPTIONS}
108269812Simp.if !defined(MK_${var})
109269812Simp.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
110269812SimpMK_${var}:=	yes
111269812Simp.else
112269812SimpMK_${var}:=	no
113269812Simp.endif
114278457Simp.else
115278457Simp.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
116278457Simp.error "Illegal value for MK_${var}: ${MK_${var}}"
117269812Simp.endif
118278457Simp.endif # !defined(MK_${var})
119269812Simp.endfor
120269812Simp.undef __DEFAULT_NO_OPTIONS
121269812Simp
122269540Simp#
123279898Simp# MK_* options which are always no, usually because they are
124279898Simp# unsupported/badly broken on this architecture.
125279898Simp#
126279898Simp.for var in ${BROKEN_OPTIONS}
127279898SimpMK_${var}:=	no
128279898Simp.endfor
129279898Simp.undef BROKEN_OPTIONS
130279898Simp#end of bsd.mkopt.mk expanded inline.
131279898Simp
132279898Simp#
133269540Simp# MK_*_SUPPORT options which default to "yes" unless their corresponding
134269540Simp# MK_* variable is set to "no".
135269540Simp#
136269540Simp.for var in \
137269540Simp    INET \
138269540Simp    INET6
139269540Simp.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
140269540SimpMK_${var}_SUPPORT:= no
141269540Simp.else
142274529Simp.if defined(KERNBUILDDIR)	# See if there's an opt_foo.h
143296770Sbdrewery.if !defined(OPT_${var})
144274529SimpOPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
145296770Sbdrewery.export OPT_${var}
146296770Sbdrewery.endif
147274529Simp.if ${OPT_${var}} == ""		# nothing -> no
148274529SimpMK_${var}_SUPPORT:= no
149274529Simp.else
150269540SimpMK_${var}_SUPPORT:= yes
151269540Simp.endif
152274529Simp.else				# otherwise, yes
153274529SimpMK_${var}_SUPPORT:= yes
154274529Simp.endif
155274529Simp.endif
156269540Simp.endfor
157300855Sian
158300855Sian# Some modules only compile successfully if option FDT is set, due to #ifdef FDT
159300855Sian# wrapped around declarations.  Module makefiles can optionally compile such
160300855Sian# things using .if !empty(OPT_FDT)
161300855Sian.if !defined(OPT_FDT) && defined(KERNBUILDDIR)
162300855SianOPT_FDT!= sed -n '/FDT/p' ${KERNBUILDDIR}/opt_platform.h
163300855Sian.export OPT_FDT
164300855Sian.endif
165