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