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