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