xref: /freebsd-14-stable/share/mk/src.opts.mk (revision ac5378d93ce0bcb639a53b91b546b4d7d24af52b)
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    JEMALLOC_LG_VADDR_WIDE \
122    KDUMP \
123    KVM \
124    LDNS \
125    LDNS_UTILS \
126    LEGACY_CONSOLE \
127    LLD \
128    LLD_BOOTSTRAP \
129    LLD_IS_LD \
130    LLVM_COV \
131    LLVM_CXXFILT \
132    LOADER_BIOS_TEXTONLY \
133    LOADER_GELI \
134    LOADER_KBOOT \
135    LOADER_LUA \
136    LOADER_OFW \
137    LOADER_PXEBOOT \
138    LOADER_UBOOT \
139    LOADER_IA32 \
140    LOCALES \
141    LOCATE \
142    LPR \
143    LS_COLORS \
144    MACHDEP_OPTIMIZATIONS \
145    MAIL \
146    MAILWRAPPER \
147    MAKE \
148    MLX5TOOL \
149    NETCAT \
150    NETGRAPH \
151    NETLINK \
152    NETLINK_SUPPORT \
153    NLS_CATALOGS \
154    NS_CACHING \
155    NTP \
156    NUAGEINIT \
157    OFED \
158    OPENSSL \
159    PAM \
160    PF \
161    PKGBOOTSTRAP \
162    PMC \
163    PPP \
164    PTHREADS_ASSERTIONS \
165    QUOTAS \
166    RADIUS_SUPPORT \
167    RBOOTD \
168    REPRODUCIBLE_BUILD \
169    RESCUE \
170    ROUTED \
171    SENDMAIL \
172    SERVICESDB \
173    SETUID_LOGIN \
174    SHAREDOCS \
175    SOURCELESS \
176    SOURCELESS_HOST \
177    SOURCELESS_UCODE \
178    STATS \
179    SYSCONS \
180    SYSTEM_COMPILER \
181    SYSTEM_LINKER \
182    TALK \
183    TCP_WRAPPERS \
184    TCSH \
185    TELNET \
186    TEXTPROC \
187    TFTP \
188    UNBOUND \
189    USB \
190    UTMPX \
191    VI \
192    VT \
193    WIRELESS \
194    WPA_SUPPLICANT_EAPOL \
195    ZFS \
196    ZFS_TESTS \
197    LOADER_ZFS \
198    ZONEINFO
199
200__DEFAULT_NO_OPTIONS = \
201    BEARSSL \
202    BHYVE_SNAPSHOT \
203    CLANG_EXTRAS \
204    CLANG_FORMAT \
205    DETECT_TZ_CHANGES \
206    DISK_IMAGE_TOOLS_BOOTSTRAP \
207    DTRACE_ASAN \
208    DTRACE_TESTS \
209    EXPERIMENTAL \
210    HESIOD \
211    LOADER_VERBOSE \
212    LOADER_VERIEXEC_PASS_MANIFEST \
213    LLVM_ASSERTIONS \
214    LLVM_BINUTILS \
215    LLVM_FULL_DEBUGINFO \
216    MALLOC_PRODUCTION \
217    OFED_EXTRA \
218    OPENLDAP \
219    RPCBIND_WARMSTART_SUPPORT \
220    SORT_THREADS \
221    ZONEINFO_LEAPSECONDS_SUPPORT \
222
223__REQUIRED_OPTIONS = \
224    CAPSICUM \
225    CASPER
226
227# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
228# RIGHT option is disabled.
229__DEFAULT_DEPENDENT_OPTIONS= \
230	CLANG_FULL/CLANG \
231	LLVM_TARGET_ALL/CLANG \
232	LOADER_VERIEXEC/BEARSSL \
233	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
234	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
235	VERIEXEC/BEARSSL \
236
237# MK_*_SUPPORT options which default to "yes" unless their corresponding
238# MK_* variable is set to "no".
239#
240.for var in \
241    BLACKLIST \
242    BZIP2 \
243    INET \
244    INET6 \
245    KERBEROS \
246    KVM \
247    NETGRAPH \
248    PAM \
249    TESTS \
250    WIRELESS
251__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
252.endfor
253
254#
255# Default behaviour of some options depends on the architecture.  Unfortunately
256# this means that we have to test TARGET_ARCH (the buildworld case) as well
257# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
258# used at all in bsd.*.mk, but we have to make an exception here if we want
259# to allow defaults for some things like clang to vary by target architecture.
260# Additional, per-target behavior should be rarely added only after much
261# gnashing of teeth and grinding of gears.
262#
263.if defined(TARGET_ARCH)
264__T=${TARGET_ARCH}
265.else
266__T=${MACHINE_ARCH}
267.endif
268
269# All supported backends for LLVM_TARGET_XXX
270__LLVM_TARGETS= \
271		aarch64 \
272		arm \
273		powerpc \
274		riscv \
275		x86
276__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
277.for __llt in ${__LLVM_TARGETS}
278# Default enable the given TARGET's LLVM_TARGET support
279.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
280__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
281# aarch64 needs arm for -m32 support.
282.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
283__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
284# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
285.else
286__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
287.endif
288.endfor
289
290__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
291
292.include <bsd.compiler.mk>
293
294.if ${__T} == "i386" || ${__T} == "amd64"
295__DEFAULT_NO_OPTIONS += FDT
296.else
297__DEFAULT_YES_OPTIONS += FDT
298.endif
299
300.if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
301__DEFAULT_YES_OPTIONS+=LLDB
302.else
303__DEFAULT_NO_OPTIONS+=LLDB
304.endif
305# LIB32 is not supported on all 64-bit architectures.
306.if (${__T} == "amd64" || ${__T:Maarch64*} != "" || ${__T} == "powerpc64")
307__DEFAULT_YES_OPTIONS+=LIB32
308.else
309BROKEN_OPTIONS+=LIB32
310.endif
311# EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
312.if ${__T:Mpowerpc*} || ${__T} == "i386"
313BROKEN_OPTIONS+=EFI
314.endif
315# OFW is only for powerpc, exclude others
316.if ${__T:Mpowerpc*} == ""
317BROKEN_OPTIONS+=LOADER_OFW
318.endif
319# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
320.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
321BROKEN_OPTIONS+=LOADER_KBOOT
322.endif
323# UBOOT is only for arm, and big-endian powerpc
324.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
325BROKEN_OPTIONS+=LOADER_UBOOT
326.endif
327# The 32-bit UEFI loader is only for amd64
328.if ${__T} != "amd64"
329BROKEN_OPTIONS+=LOADER_IA32
330.endif
331# GELI and Lua in loader currently cause boot failures on powerpc.
332# Further debugging is required -- probably they are just broken on big
333# endian systems generically (they jump to null pointers or try to read
334# crazy high addresses, which is typical of endianness problems).
335.if ${__T:Mpowerpc*}
336BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
337.endif
338
339# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
340.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
341__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
342.else
343__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
344.endif
345
346.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
347    ${__T:Mpowerpc64*} == ""
348BROKEN_OPTIONS+=CXGBETOOL
349BROKEN_OPTIONS+=MLX5TOOL
350.endif
351
352.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
353BROKEN_OPTIONS+=HYPERV
354.endif
355
356.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
357    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
358__DEFAULT_YES_OPTIONS+=OPENMP
359.else
360__DEFAULT_NO_OPTIONS+=OPENMP
361.endif
362
363# Broken on 32-bit arm, kernel module compile errors
364.if ${__T:Marm*} != ""
365BROKEN_OPTIONS+= OFED
366.endif
367
368# MK_host_egacy is set by local.sys.mk so is valid here
369.if ${MACHINE} == "host" && ${MK_host_egacy} == "yes"
370# we cannot expect tests to work
371BROKEN_OPTIONS+= TESTS
372.endif
373
374.-include <site.src.opts.mk>
375
376.include <bsd.mkopt.mk>
377
378#
379# Force some options off if their dependencies are off.
380# Order is somewhat important.
381#
382.if ${MK_CAPSICUM} == "no"
383MK_CASPER:=	no
384.endif
385
386.if ${MK_SOURCELESS} == "no"
387MK_SOURCELESS_HOST:=	no
388MK_SOURCELESS_UCODE:= no
389.endif
390
391.if ${MK_CDDL} == "no"
392MK_CTF:=	no
393MK_DTRACE:=	no
394MK_LOADER_ZFS:=	no
395MK_ZFS:=	no
396.endif
397
398.if ${MK_CRYPT} == "no"
399MK_OPENSSL:=	no
400MK_OPENSSH:=	no
401MK_KERBEROS:=	no
402MK_KERBEROS_SUPPORT:=	no
403.endif
404
405.if ${MK_DIALOG} == "no"
406MK_BSDINSTALL:=	no
407.endif
408
409.if ${MK_DTRACE} == "no"
410MK_CTF:=	no
411.endif
412
413.if ${MK_MAIL} == "no"
414MK_MAILWRAPPER:= no
415MK_SENDMAIL:=	no
416MK_DMAGENT:=	no
417.endif
418
419.if ${MK_NETGRAPH} == "no"
420MK_BLUETOOTH:=	no
421.endif
422
423.if ${MK_NLS} == "no"
424MK_NLS_CATALOGS:= no
425.endif
426
427.if ${MK_OPENSSL} == "no"
428MK_DMAGENT:=	no
429MK_OPENSSH:=	no
430MK_OPENSSL_KTLS:=	no
431MK_KERBEROS:=	no
432MK_KERBEROS_SUPPORT:=	no
433MK_LDNS:=	no
434MK_PKGBOOTSTRAP:=	no
435MK_LOADER_ZFS:=	no
436MK_ZFS:=	no
437.endif
438
439.if ${MK_LDNS} == "no"
440MK_LDNS_UTILS:=	no
441MK_UNBOUND:= no
442.endif
443
444.if ${MK_PF} == "no"
445MK_AUTHPF:=	no
446.endif
447
448.if ${MK_OFED} == "no"
449MK_OFED_EXTRA:=	no
450.endif
451
452.if ${MK_TESTS} == "no"
453MK_DTRACE_TESTS:= no
454MK_ZFS_TESTS:= no
455.endif
456
457.if ${MK_ZFS} == "no"
458MK_ZFS_TESTS:=	no
459.endif
460
461.if ${MK_TESTS_SUPPORT} == "no"
462MK_GOOGLETEST:=	no
463.endif
464
465.if ${MK_ZONEINFO} == "no"
466MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
467.endif
468
469.if ${MK_CROSS_COMPILER} == "no"
470MK_CLANG_BOOTSTRAP:= no
471MK_ELFTOOLCHAIN_BOOTSTRAP:= no
472MK_LLD_BOOTSTRAP:= no
473.endif
474
475.if ${MK_TOOLCHAIN} == "no"
476MK_CLANG:=	no
477MK_LLD:=	no
478MK_LLDB:=	no
479MK_LLVM_BINUTILS:=	no
480.endif
481
482.if ${MK_CLANG} == "no"
483MK_CLANG_EXTRAS:= no
484MK_CLANG_FORMAT:= no
485MK_CLANG_FULL:= no
486MK_LLVM_COV:= no
487.endif
488
489.if ${MK_ASAN} == "yes"
490# In order to get sensible backtraces from ASAN we have to install
491# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
492MK_LLVM_BINUTILS:=	yes
493.endif
494
495.if ${MK_LLVM_BINUTILS} == "yes"
496# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
497# enabled if MK_LLVM_BINUTILS is set.
498MK_LLVM_CXXFILT:=	yes
499.endif
500
501.if ${MK_LOADER_VERIEXEC} == "no"
502MK_LOADER_VERIEXEC_PASS_MANIFEST := no
503.endif
504
505#
506# MK_* options whose default value depends on another option.
507#
508.for vv in \
509    GSSAPI/KERBEROS \
510    MAN_UTILS/MAN
511.if defined(WITH_${vv:H})
512MK_${vv:H}:=	yes
513.elif defined(WITHOUT_${vv:H})
514MK_${vv:H}:=	no
515.else
516MK_${vv:H}:=	${MK_${vv:T}}
517.endif
518.endfor
519
520#
521# Set defaults for the MK_*_SUPPORT variables.
522#
523
524.endif #  !target(__<src.opts.mk>__)
525