xref: /freebsd-14.2/share/mk/src.opts.mk (revision b8aeb710)
1#
2# Option file for FreeBSD /usr/src builds, at least the userland and boot loader
3# portions of the tree. These options generally chose what parts of the tree to
4# include or omit and are FreeBSD source tree specific.
5#
6# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
7# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
8# with sensible (usually) defaults.
9#
10# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
11# are applicable for that Makefile (typically there are none, but sometimes there
12# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
13# to omit from that make.
14#
15# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
16# variable.
17#
18# Makefiles may also assume that this file is included by src.opts.mk should it
19# need variables defined there prior to the end of the Makefile where
20# bsd.{subdir,lib.bin}.mk is traditionally included.
21#
22# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
23# should be added. Old instances should be removed since they were just to
24# bridge the gap between FreeBSD 4 and FreeBSD 5.
25#
26# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
27# exception is made for _WITHOUT_SRCONF which turns off this mechanism
28# completely inside bsd.*.mk files).
29#
30
31.if !target(__<src.opts.mk>__)
32__<src.opts.mk>__:
33
34.include <bsd.own.mk>
35
36#
37# Define MK_* variables (which are either "yes" or "no") for users
38# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
39# make(1) environment.
40# These should be tested with `== "no"' or `!= "no"' in makefiles.
41# The NO_* variables should only be set by makefiles for variables
42# that haven't been converted over.
43#
44
45# These options are used by the src builds. Those listed in
46# __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned
47# off.  __DEFAULT_NO_OPTIONS will default to 'no' and won't build
48# unless turned on. Any options listed in 'BROKEN_OPTIONS' will be
49# hard-wired to 'no'.  "Broken" here means not working or
50# not-appropriate and/or not supported. It doesn't imply something is
51# wrong with the code. There's not a single good word for this, so
52# BROKEN was selected as the least imperfect one considered at the
53# time. Options are added to BROKEN_OPTIONS list on a per-arch basis.
54# At this time, there's no provision for mutually incompatible options.
55# Options listed in 'REQUIRED_OPTIONS' will be hard-wired to 'yes'; this
56# is intended as a transitional measure while options are in the process
57# of being removed.
58
59__DEFAULT_YES_OPTIONS = \
60    ACCT \
61    ACPI \
62    APM \
63    AT \
64    AUDIT \
65    AUTHPF \
66    AUTOFS \
67    BHYVE \
68    BLACKLIST \
69    BLUETOOTH \
70    BOOT \
71    BOOTPARAMD \
72    BOOTPD \
73    BSD_CPIO \
74    BSDINSTALL \
75    BSNMP \
76    BZIP2 \
77    CALENDAR \
78    CAROOT \
79    CCD \
80    CDDL \
81    CLANG \
82    CLANG_BOOTSTRAP \
83    CLEAN \
84    CPP \
85    CROSS_COMPILER \
86    CRYPT \
87    CUSE \
88    CXGBETOOL \
89    DIALOG \
90    DICT \
91    DMAGENT \
92    DTRACE \
93    DYNAMICROOT \
94    EE \
95    EFI \
96    ELFTOOLCHAIN_BOOTSTRAP \
97    EXAMPLES \
98    FILE \
99    FINGER \
100    FLOPPY \
101    FORTH \
102    FP_LIBC \
103    FREEBSD_UPDATE \
104    FTP \
105    GAMES \
106    GH_BC \
107    GNU_DIFF \
108    GOOGLETEST \
109    GPIO \
110    HAST \
111    HTML \
112    HYPERV \
113    ICONV \
114    INET \
115    INET6 \
116    INETD \
117    IPFILTER \
118    IPFW \
119    ISCSI \
120    JAIL \
121    KDUMP \
122    KVM \
123    LDNS \
124    LDNS_UTILS \
125    LEGACY_CONSOLE \
126    LLD \
127    LLD_BOOTSTRAP \
128    LLD_IS_LD \
129    LLVM_COV \
130    LLVM_CXXFILT \
131    LOADER_GELI \
132    LOADER_KBOOT \
133    LOADER_LUA \
134    LOADER_OFW \
135    LOADER_PXEBOOT \
136    LOADER_UBOOT \
137    LOCALES \
138    LOCATE \
139    LPR \
140    LS_COLORS \
141    MACHDEP_OPTIMIZATIONS \
142    MAIL \
143    MAILWRAPPER \
144    MAKE \
145    MLX5TOOL \
146    NETCAT \
147    NETGRAPH \
148    NETLINK \
149    NETLINK_SUPPORT \
150    NLS_CATALOGS \
151    NS_CACHING \
152    NTP \
153    NUAGEINIT \
154    OFED \
155    OPENSSL \
156    PAM \
157    PF \
158    PKGBOOTSTRAP \
159    PMC \
160    PPP \
161    PTHREADS_ASSERTIONS \
162    QUOTAS \
163    RADIUS_SUPPORT \
164    RBOOTD \
165    REPRODUCIBLE_BUILD \
166    RESCUE \
167    ROUTED \
168    SENDMAIL \
169    SERVICESDB \
170    SETUID_LOGIN \
171    SHAREDOCS \
172    SOURCELESS \
173    SOURCELESS_HOST \
174    SOURCELESS_UCODE \
175    STATS \
176    SYSCONS \
177    SYSTEM_COMPILER \
178    SYSTEM_LINKER \
179    TALK \
180    TCP_WRAPPERS \
181    TCSH \
182    TELNET \
183    TEXTPROC \
184    TFTP \
185    UNBOUND \
186    USB \
187    UTMPX \
188    VI \
189    VT \
190    WIRELESS \
191    WPA_SUPPLICANT_EAPOL \
192    ZFS \
193    LOADER_ZFS \
194    ZONEINFO
195
196__DEFAULT_NO_OPTIONS = \
197    BEARSSL \
198    BHYVE_SNAPSHOT \
199    CLANG_EXTRAS \
200    CLANG_FORMAT \
201    DETECT_TZ_CHANGES \
202    DISK_IMAGE_TOOLS_BOOTSTRAP \
203    DTRACE_ASAN \
204    DTRACE_TESTS \
205    EXPERIMENTAL \
206    HESIOD \
207    LOADER_BIOS_TEXTONLY \
208    LOADER_VERBOSE \
209    LOADER_VERIEXEC_PASS_MANIFEST \
210    LLVM_ASSERTIONS \
211    LLVM_BINUTILS \
212    LLVM_FULL_DEBUGINFO \
213    MALLOC_PRODUCTION \
214    OFED_EXTRA \
215    OPENLDAP \
216    RPCBIND_WARMSTART_SUPPORT \
217    SORT_THREADS \
218    ZONEINFO_LEAPSECONDS_SUPPORT \
219
220__REQUIRED_OPTIONS = \
221    CAPSICUM \
222    CASPER
223
224# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
225# RIGHT option is disabled.
226__DEFAULT_DEPENDENT_OPTIONS= \
227	CLANG_FULL/CLANG \
228	LLVM_TARGET_ALL/CLANG \
229	LOADER_VERIEXEC/BEARSSL \
230	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
231	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
232	VERIEXEC/BEARSSL \
233
234# MK_*_SUPPORT options which default to "yes" unless their corresponding
235# MK_* variable is set to "no".
236#
237.for var in \
238    BLACKLIST \
239    BZIP2 \
240    INET \
241    INET6 \
242    KERBEROS \
243    KVM \
244    NETGRAPH \
245    PAM \
246    TESTS \
247    WIRELESS
248__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
249.endfor
250
251#
252# Default behaviour of some options depends on the architecture.  Unfortunately
253# this means that we have to test TARGET_ARCH (the buildworld case) as well
254# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
255# used at all in bsd.*.mk, but we have to make an exception here if we want
256# to allow defaults for some things like clang to vary by target architecture.
257# Additional, per-target behavior should be rarely added only after much
258# gnashing of teeth and grinding of gears.
259#
260.if defined(TARGET_ARCH)
261__T=${TARGET_ARCH}
262.else
263__T=${MACHINE_ARCH}
264.endif
265
266# All supported backends for LLVM_TARGET_XXX
267__LLVM_TARGETS= \
268		aarch64 \
269		arm \
270		powerpc \
271		riscv \
272		x86
273__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
274.for __llt in ${__LLVM_TARGETS}
275# Default enable the given TARGET's LLVM_TARGET support
276.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
277__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
278# aarch64 needs arm for -m32 support.
279.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
280__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
281# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
282.else
283__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
284.endif
285.endfor
286
287__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
288
289.include <bsd.compiler.mk>
290
291.if ${__T} == "i386" || ${__T} == "amd64"
292__DEFAULT_NO_OPTIONS += FDT
293.else
294__DEFAULT_YES_OPTIONS += FDT
295.endif
296
297.if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
298__DEFAULT_YES_OPTIONS+=LLDB
299.else
300__DEFAULT_NO_OPTIONS+=LLDB
301.endif
302# LIB32 is not supported on all 64-bit architectures.
303.if (${__T} == "amd64" || ${__T:Maarch64*} != "" || ${__T} == "powerpc64")
304__DEFAULT_YES_OPTIONS+=LIB32
305.else
306BROKEN_OPTIONS+=LIB32
307.endif
308# EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
309.if ${__T:Mpowerpc*} || ${__T} == "i386"
310BROKEN_OPTIONS+=EFI
311.endif
312# OFW is only for powerpc, exclude others
313.if ${__T:Mpowerpc*} == ""
314BROKEN_OPTIONS+=LOADER_OFW
315.endif
316# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
317.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
318BROKEN_OPTIONS+=LOADER_KBOOT
319.endif
320# UBOOT is only for arm, and big-endian powerpc
321.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
322BROKEN_OPTIONS+=LOADER_UBOOT
323.endif
324# GELI and Lua in loader currently cause boot failures on powerpc.
325# Further debugging is required -- probably they are just broken on big
326# endian systems generically (they jump to null pointers or try to read
327# crazy high addresses, which is typical of endianness problems).
328.if ${__T:Mpowerpc*}
329BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
330.endif
331
332# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
333.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
334__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
335.else
336__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
337.endif
338
339.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
340    ${__T:Mpowerpc64*} == ""
341BROKEN_OPTIONS+=CXGBETOOL
342BROKEN_OPTIONS+=MLX5TOOL
343.endif
344
345.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
346BROKEN_OPTIONS+=HYPERV
347.endif
348
349.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
350    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
351__DEFAULT_YES_OPTIONS+=OPENMP
352.else
353__DEFAULT_NO_OPTIONS+=OPENMP
354.endif
355
356# Broken on 32-bit arm, kernel module compile errors
357.if ${__T:Marm*} != ""
358BROKEN_OPTIONS+= OFED
359.endif
360
361# MK_host_egacy is set by local.sys.mk so is valid here
362.if ${MACHINE} == "host" && ${MK_host_egacy} == "yes"
363# we cannot expect tests to work
364BROKEN_OPTIONS+= TESTS
365.endif
366
367.-include <site.src.opts.mk>
368
369.include <bsd.mkopt.mk>
370
371#
372# Force some options off if their dependencies are off.
373# Order is somewhat important.
374#
375.if ${MK_CAPSICUM} == "no"
376MK_CASPER:=	no
377.endif
378
379.if ${MK_SOURCELESS} == "no"
380MK_SOURCELESS_HOST:=	no
381MK_SOURCELESS_UCODE:= no
382.endif
383
384.if ${MK_CDDL} == "no"
385MK_CTF:=	no
386MK_DTRACE:=	no
387MK_LOADER_ZFS:=	no
388MK_ZFS:=	no
389.endif
390
391.if ${MK_CRYPT} == "no"
392MK_OPENSSL:=	no
393MK_OPENSSH:=	no
394MK_KERBEROS:=	no
395MK_KERBEROS_SUPPORT:=	no
396.endif
397
398.if ${MK_DIALOG} == "no"
399MK_BSDINSTALL:=	no
400.endif
401
402.if ${MK_DTRACE} == "no"
403MK_CTF:=	no
404.endif
405
406.if ${MK_MAIL} == "no"
407MK_MAILWRAPPER:= no
408MK_SENDMAIL:=	no
409MK_DMAGENT:=	no
410.endif
411
412.if ${MK_NETGRAPH} == "no"
413MK_BLUETOOTH:=	no
414.endif
415
416.if ${MK_NLS} == "no"
417MK_NLS_CATALOGS:= no
418.endif
419
420.if ${MK_OPENSSL} == "no"
421MK_DMAGENT:=	no
422MK_OPENSSH:=	no
423MK_OPENSSL_KTLS:=	no
424MK_KERBEROS:=	no
425MK_KERBEROS_SUPPORT:=	no
426MK_LDNS:=	no
427MK_PKGBOOTSTRAP:=	no
428MK_LOADER_ZFS:=	no
429MK_ZFS:=	no
430.endif
431
432.if ${MK_LDNS} == "no"
433MK_LDNS_UTILS:=	no
434MK_UNBOUND:= no
435.endif
436
437.if ${MK_PF} == "no"
438MK_AUTHPF:=	no
439.endif
440
441.if ${MK_OFED} == "no"
442MK_OFED_EXTRA:=	no
443.endif
444
445.if ${MK_TESTS} == "no"
446MK_DTRACE_TESTS:= no
447.endif
448
449.if ${MK_TESTS_SUPPORT} == "no"
450MK_GOOGLETEST:=	no
451.endif
452
453.if ${MK_ZONEINFO} == "no"
454MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
455.endif
456
457.if ${MK_CROSS_COMPILER} == "no"
458MK_CLANG_BOOTSTRAP:= no
459MK_ELFTOOLCHAIN_BOOTSTRAP:= no
460MK_LLD_BOOTSTRAP:= no
461.endif
462
463.if ${MK_TOOLCHAIN} == "no"
464MK_CLANG:=	no
465MK_LLD:=	no
466MK_LLDB:=	no
467MK_LLVM_BINUTILS:=	no
468.endif
469
470.if ${MK_CLANG} == "no"
471MK_CLANG_EXTRAS:= no
472MK_CLANG_FORMAT:= no
473MK_CLANG_FULL:= no
474MK_LLVM_COV:= no
475.endif
476
477.if ${MK_ASAN} == "yes"
478# In order to get sensible backtraces from ASAN we have to install
479# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
480MK_LLVM_BINUTILS:=	yes
481.endif
482
483.if ${MK_LLVM_BINUTILS} == "yes"
484# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
485# enabled if MK_LLVM_BINUTILS is set.
486MK_LLVM_CXXFILT:=	yes
487.endif
488
489.if ${MK_LOADER_VERIEXEC} == "no"
490MK_LOADER_VERIEXEC_PASS_MANIFEST := no
491.endif
492
493#
494# MK_* options whose default value depends on another option.
495#
496.for vv in \
497    GSSAPI/KERBEROS \
498    MAN_UTILS/MAN
499.if defined(WITH_${vv:H})
500MK_${vv:H}:=	yes
501.elif defined(WITHOUT_${vv:H})
502MK_${vv:H}:=	no
503.else
504MK_${vv:H}:=	${MK_${vv:T}}
505.endif
506.endfor
507
508#
509# Set defaults for the MK_*_SUPPORT variables.
510#
511
512.endif #  !target(__<src.opts.mk>__)
513