xref: /freebsd/share/mk/src.opts.mk (revision 240c614d48cb0484bfe7876decdf6bbdcc99ba73)
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>__:	.NOTMAIN
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    BLOCKLIST \
70    BLUETOOTH \
71    BOOT \
72    BOOTPARAMD \
73    BOOTPD \
74    BSD_CPIO \
75    BSDINSTALL \
76    BSNMP \
77    BZIP2 \
78    CALENDAR \
79    CAROOT \
80    CCD \
81    CDDL \
82    CLANG \
83    CLANG_BOOTSTRAP \
84    CPP \
85    CROSS_COMPILER \
86    CRYPT \
87    CUSE \
88    CXGBETOOL \
89    DEPEND_CLEANUP \
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    FREEBSD_UPDATE \
103    FTP \
104    GAMES \
105    GNU_DIFF \
106    GOOGLETEST \
107    GPIO \
108    HAST \
109    HTML \
110    HYPERV \
111    ICONV \
112    INET \
113    INET6 \
114    INETD \
115    IPFILTER \
116    IPFW \
117    ISCSI \
118    JAIL \
119    JEMALLOC_LG_VADDR_WIDE \
120    KDUMP \
121    KVM \
122    LDNS \
123    LDNS_UTILS \
124    LEGACY_CONSOLE \
125    LLD \
126    LLD_BOOTSTRAP \
127    LLVM_ASSERTIONS \
128    LLVM_BINUTILS \
129    LLVM_COV \
130    LLVM_CXXFILT \
131    LOADER_BIOS_TEXTONLY \
132    LOADER_GELI \
133    LOADER_KBOOT \
134    LOADER_LUA \
135    LOADER_OFW \
136    LOADER_PXEBOOT \
137    LOADER_UBOOT \
138    LOADER_IA32 \
139    LOCALES \
140    LOCATE \
141    LPR \
142    LS_COLORS \
143    MACHDEP_OPTIMIZATIONS \
144    MAIL \
145    MAILWRAPPER \
146    MAKE \
147    MITKRB5 \
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    RESCUE \
169    ROUTED \
170    SENDMAIL \
171    SERVICESDB \
172    SETUID_LOGIN \
173    SHAREDOCS \
174    SOUND \
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    CLEAN \
206    DIALOG \
207    DETECT_TZ_CHANGES \
208    DISK_IMAGE_TOOLS_BOOTSTRAP \
209    DTRACE_ASAN \
210    DTRACE_TESTS \
211    EXPERIMENTAL \
212    HESIOD \
213    IPFILTER_IPFS \
214    LOADER_VERBOSE \
215    LOADER_VERIEXEC_PASS_MANIFEST \
216    LLVM_FULL_DEBUGINFO \
217    LLVM_LINK_STATIC_LIBRARIES \
218    MALLOC_PRODUCTION \
219    OFED_EXTRA \
220    OPENLDAP \
221    RPCBIND_WARMSTART_SUPPORT \
222    SORT_THREADS \
223    ZONEINFO_LEAPSECONDS_SUPPORT \
224
225__REQUIRED_OPTIONS = \
226    CASPER
227
228# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
229# RIGHT option is disabled.
230__DEFAULT_DEPENDENT_OPTIONS= \
231	CLANG_FULL/CLANG \
232	LLVM_TARGET_ALL/CLANG \
233	LOADER_VERIEXEC/BEARSSL \
234	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
235	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
236	VERIEXEC/BEARSSL \
237
238__SINGLE_OPTIONS = \
239	LIBC_MALLOC
240
241__LIBC_MALLOC_OPTIONS=	jemalloc
242__LIBC_MALLOC_DEFAULT=	jemalloc
243
244# MK_*_SUPPORT options which default to "yes" unless their corresponding
245# MK_* variable is set to "no".
246#
247.for var in \
248    BLACKLIST \
249    BLOCKLIST \
250    BZIP2 \
251    INET \
252    INET6 \
253    KERBEROS \
254    KVM \
255    NETGRAPH \
256    PAM \
257    TESTS \
258    WIRELESS
259__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
260.endfor
261
262#
263# Default behaviour of some options depends on the architecture.  Unfortunately
264# this means that we have to test TARGET_ARCH (the buildworld case) as well
265# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
266# used at all in bsd.*.mk, but we have to make an exception here if we want
267# to allow defaults for some things like clang to vary by target architecture.
268# Additional, per-target behavior should be rarely added only after much
269# gnashing of teeth and grinding of gears.
270#
271.if defined(TARGET_ARCH)
272__T=${TARGET_ARCH}
273.else
274__T=${MACHINE_ARCH}
275.endif
276
277# All supported backends for LLVM_TARGET_XXX
278__LLVM_TARGETS= \
279		aarch64 \
280		arm \
281		powerpc \
282		riscv \
283		x86
284__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
285.for __llt in ${__LLVM_TARGETS}
286# Default enable the given TARGET's LLVM_TARGET support
287.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
288__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
289# aarch64 needs arm for -m32 support.
290.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
291__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
292# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
293.else
294__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
295.endif
296.endfor
297
298__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
299
300.include <bsd.compiler.mk>
301
302.if ${__T} == "i386" || ${__T} == "amd64"
303__DEFAULT_NO_OPTIONS+=FDT
304.else
305__DEFAULT_YES_OPTIONS+=FDT
306.endif
307
308.if ${__T:Mriscv64*} == ""
309__DEFAULT_YES_OPTIONS+=LLDB
310.else
311__DEFAULT_NO_OPTIONS+=LLDB
312.endif
313# LIB32 is not supported on all 64-bit architectures.
314.if (${__T:Maarch64*} != "" && ((defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} != "gcc") || (!defined(X_COMPILER_TYPE) && ${COMPILER_TYPE} != "gcc"))) || ${__T} == "amd64" || ${__T} == "powerpc64"
315__DEFAULT_YES_OPTIONS+=LIB32
316.else
317BROKEN_OPTIONS+=LIB32
318.endif
319# EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
320.if ${__T:Mpowerpc*} || ${__T} == "i386"
321BROKEN_OPTIONS+=EFI
322.endif
323# Bad coupling for libsecure stuff with bearssl and efi, so broken on EFI
324.if ${__T:Mpowerpc*}
325BROKEN_OPTIONS+=BEARSSL		# bearssl brings in secure efi stuff xxx
326.endif
327# OFW is only for powerpc, exclude others
328.if ${__T:Mpowerpc*} == ""
329BROKEN_OPTIONS+=LOADER_OFW
330.endif
331# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
332.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
333BROKEN_OPTIONS+=LOADER_KBOOT
334.endif
335# UBOOT is only for arm, and big-endian powerpc
336.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
337BROKEN_OPTIONS+=LOADER_UBOOT
338.endif
339# The 32-bit UEFI loader is only for amd64
340.if ${__T} != "amd64"
341BROKEN_OPTIONS+=LOADER_IA32
342.endif
343# GELI and Lua in loader currently cause boot failures on powerpc.
344# Further debugging is required -- probably they are just broken on big
345# endian systems generically (they jump to null pointers or try to read
346# crazy high addresses, which is typical of endianness problems).
347.if ${__T:Mpowerpc*}
348BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
349.endif
350
351# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
352.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
353__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
354.else
355__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
356.endif
357
358.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
359    ${__T:Mpowerpc64*} == ""
360BROKEN_OPTIONS+=CXGBETOOL
361BROKEN_OPTIONS+=MLX5TOOL
362.endif
363
364.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
365BROKEN_OPTIONS+=HYPERV
366.endif
367
368.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
369    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
370__DEFAULT_YES_OPTIONS+=OPENMP
371.else
372__DEFAULT_NO_OPTIONS+=OPENMP
373.endif
374
375# Broken on 32-bit arm, kernel module compile errors
376.if ${__T:Marm*} != ""
377BROKEN_OPTIONS+= OFED
378.endif
379
380# MK_host_egacy is set by local.sys.mk so is valid here
381.if ${MACHINE:Nhost*} == "" && ${MK_host_egacy} == "yes"
382# we cannot expect tests to work
383BROKEN_OPTIONS+= TESTS
384.endif
385
386.if ${__T} != "amd64"
387BROKEN_OPTIONS+=BHYVE_SNAPSHOT
388.endif
389
390.-include <site.src.opts.mk>
391
392.include <bsd.mkopt.mk>
393
394#
395# Force some options off if their dependencies are off.
396# Order is somewhat important.
397#
398.if ${MK_SOURCELESS} == "no"
399MK_SOURCELESS_HOST:=	no
400MK_SOURCELESS_UCODE:= no
401.endif
402
403.if ${MK_BLACKLIST} == "no"
404MK_BLOCKLIST:=	no
405.endif
406
407.if ${MK_BLACKLIST_SUPPORT} == "no"
408MK_BLOCKLIST_SUPPORT:=	no
409.endif
410
411.if ${MK_CDDL} == "no"
412MK_CTF:=	no
413MK_DTRACE:=	no
414MK_LOADER_ZFS:=	no
415MK_ZFS:=	no
416.endif
417
418.if ${MK_CRYPT} == "no"
419MK_OPENSSL:=	no
420MK_OPENSSH:=	no
421MK_KERBEROS:=	no
422MK_KERBEROS_SUPPORT:=	no
423MK_MITKRB5:=	no
424.endif
425
426.if ${MK_DTRACE} == "no"
427MK_CTF:=	no
428.endif
429
430.if ${MK_MAIL} == "no"
431MK_MAILWRAPPER:= no
432MK_SENDMAIL:=	no
433MK_DMAGENT:=	no
434.endif
435
436.if ${MK_NETGRAPH} == "no"
437MK_BLUETOOTH:=	no
438.endif
439
440.if ${MK_NLS} == "no"
441MK_NLS_CATALOGS:= no
442.endif
443
444.if ${MK_OPENSSL} == "no"
445MK_DMAGENT:=	no
446MK_OPENSSH:=	no
447MK_OPENSSL_KTLS:=	no
448MK_KERBEROS:=	no
449MK_KERBEROS_SUPPORT:=	no
450MK_MITKRB5:=	no
451MK_LDNS:=	no
452MK_PKGBOOTSTRAP:=	no
453MK_LOADER_ZFS:=	no
454MK_ZFS:=	no
455.endif
456
457.if ${MK_LDNS} == "no"
458MK_LDNS_UTILS:=	no
459MK_UNBOUND:= no
460.endif
461
462.if ${MK_PF} == "no"
463MK_AUTHPF:=	no
464.endif
465
466.if ${MK_OFED} == "no"
467MK_OFED_EXTRA:=	no
468.endif
469
470.if ${MK_TESTS} == "no"
471MK_DTRACE_TESTS:= no
472MK_ZFS_TESTS:= no
473.endif
474
475.if ${MK_ZFS} == "no"
476MK_ZFS_TESTS:=	no
477.endif
478
479.if ${MK_TESTS_SUPPORT} == "no"
480MK_GOOGLETEST:=	no
481.endif
482
483.if ${MK_ZONEINFO} == "no"
484MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
485.endif
486
487.if ${MK_CROSS_COMPILER} == "no"
488MK_CLANG_BOOTSTRAP:= no
489MK_ELFTOOLCHAIN_BOOTSTRAP:= no
490MK_LLD_BOOTSTRAP:= no
491.endif
492
493.if ${MK_TOOLCHAIN} == "no"
494MK_CLANG:=	no
495MK_LLD:=	no
496MK_LLDB:=	no
497MK_LLVM_BINUTILS:=	no
498.endif
499
500.if ${MK_CLANG} == "no"
501MK_CLANG_EXTRAS:= no
502MK_CLANG_FORMAT:= no
503MK_CLANG_FULL:= no
504MK_LLVM_COV:= no
505.endif
506
507# CUSE is needed only by virtual_oss, but virtual_oss is part of MK_SOUND.
508.if ${MK_CUSE} == "no"
509MK_SOUND:= no
510.endif
511
512.if ${MK_ASAN} == "yes"
513# In order to get sensible backtraces from ASAN we have to install
514# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
515MK_LLVM_BINUTILS:=	yes
516.endif
517
518.if ${MK_LLVM_BINUTILS} == "yes"
519# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
520# enabled if MK_LLVM_BINUTILS is set.
521MK_LLVM_CXXFILT:=	yes
522.endif
523
524.if ${MK_LOADER_VERIEXEC} == "no"
525MK_LOADER_VERIEXEC_PASS_MANIFEST := no
526.endif
527
528.if ${MK_CLEAN} == "yes"
529MK_DEPEND_CLEANUP:=	no
530.endif
531
532#
533# MK_* options whose default value depends on another option.
534#
535.for vv in \
536    KERBEROS_SUPPORT/KERBEROS \
537    MAN_UTILS/MAN
538.if defined(WITH_${vv:H})
539MK_${vv:H}:=	yes
540.elif defined(WITHOUT_${vv:H})
541MK_${vv:H}:=	no
542.else
543MK_${vv:H}:=	${MK_${vv:T}}
544.endif
545.endfor
546
547.endif #  !target(__<src.opts.mk>__)
548