xref: /freebsd/share/mk/src.opts.mk (revision 64884e0d4ce7ed57c970e1b34f93e3754c656900)
1# $FreeBSD$
2#
3# Option file for FreeBSD /usr/src builds, at least the userland and boot loader
4# portions of the tree. These options generally chose what parts of the tree to
5# include or omit and are FreeBSD source tree specific.
6#
7# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
8# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
9# with sensible (usually) defaults.
10#
11# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
12# are applicable for that Makefile (typically there are none, but sometimes there
13# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
14# to omit from that make.
15#
16# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
17# variable.
18#
19# Makefiles may also assume that this file is included by src.opts.mk should it
20# need variables defined there prior to the end of the Makefile where
21# bsd.{subdir,lib.bin}.mk is traditionally included.
22#
23# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
24# should be added. Old instances should be removed since they were just to
25# bridge the gap between FreeBSD 4 and FreeBSD 5.
26#
27# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
28# exception is made for _WITHOUT_SRCONF which turns off this mechanism
29# completely inside bsd.*.mk files).
30#
31
32.if !target(__<src.opts.mk>__)
33__<src.opts.mk>__:
34
35.include <bsd.own.mk>
36
37#
38# Define MK_* variables (which are either "yes" or "no") for users
39# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
40# make(1) environment.
41# These should be tested with `== "no"' or `!= "no"' in makefiles.
42# The NO_* variables should only be set by makefiles for variables
43# that haven't been converted over.
44#
45
46# These options are used by the src builds. Those listed in
47# __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned
48# off.  __DEFAULT_NO_OPTIONS will default to 'no' and won't build
49# unless turned on. Any options listed in 'BROKEN_OPTIONS' will be
50# hard-wired to 'no'.  "Broken" here means not working or
51# not-appropriate and/or not supported. It doesn't imply something is
52# wrong with the code. There's not a single good word for this, so
53# BROKEN was selected as the least imperfect one considered at the
54# time. Options are added to BROKEN_OPTIONS list on a per-arch basis.
55# At this time, there's no provision for mutually incompatible options.
56# Options listed in 'REQUIRED_OPTIONS' will be hard-wired to 'yes'; this
57# is intended as a transitional measure while options are in the process
58# of being removed.
59
60__DEFAULT_YES_OPTIONS = \
61    ACCT \
62    ACPI \
63    APM \
64    AT \
65    AUDIT \
66    AUTHPF \
67    AUTOFS \
68    BHYVE \
69    BLACKLIST \
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    CLEAN \
85    CPP \
86    CROSS_COMPILER \
87    CRYPT \
88    CUSE \
89    CXGBETOOL \
90    DIALOG \
91    DICT \
92    DMAGENT \
93    DTRACE \
94    DYNAMICROOT \
95    EE \
96    EFI \
97    ELFTOOLCHAIN_BOOTSTRAP \
98    EXAMPLES \
99    FILE \
100    FINGER \
101    FLOPPY \
102    FORTH \
103    FP_LIBC \
104    FREEBSD_UPDATE \
105    FTP \
106    GAMES \
107    GH_BC \
108    GNU_DIFF \
109    GOOGLETEST \
110    GPIO \
111    HAST \
112    HTML \
113    HYPERV \
114    ICONV \
115    INET \
116    INET6 \
117    INETD \
118    IPFILTER \
119    IPFW \
120    ISCSI \
121    JAIL \
122    KDUMP \
123    KVM \
124    LDNS \
125    LDNS_UTILS \
126    LEGACY_CONSOLE \
127    LLD \
128    LLD_BOOTSTRAP \
129    LLD_IS_LD \
130    LLVM_ASSERTIONS \
131    LLVM_COV \
132    LLVM_CXXFILT \
133    LOADER_GELI \
134    LOADER_KBOOT \
135    LOADER_LUA \
136    LOADER_OFW \
137    LOADER_UBOOT \
138    LOCALES \
139    LOCATE \
140    LPR \
141    LS_COLORS \
142    MACHDEP_OPTIMIZATIONS \
143    MAIL \
144    MAILWRAPPER \
145    MAKE \
146    MLX5TOOL \
147    NETCAT \
148    NETGRAPH \
149    NETLINK \
150    NETLINK_SUPPORT \
151    NLS_CATALOGS \
152    NS_CACHING \
153    NTP \
154    NVME \
155    OFED \
156    OPENSSL \
157    PAM \
158    PF \
159    PKGBOOTSTRAP \
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    SHARED_TOOLCHAIN \
172    SHAREDOCS \
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    LOADER_ZFS \
195    ZONEINFO
196
197__DEFAULT_NO_OPTIONS = \
198    BEARSSL \
199    BHYVE_SNAPSHOT \
200    CLANG_EXTRAS \
201    CLANG_FORMAT \
202    DETECT_TZ_CHANGES \
203    DISK_IMAGE_TOOLS_BOOTSTRAP \
204    DTRACE_ASAN \
205    DTRACE_TESTS \
206    EXPERIMENTAL \
207    HESIOD \
208    LOADER_VERBOSE \
209    LOADER_VERIEXEC_PASS_MANIFEST \
210    LLVM_BINUTILS \
211    MALLOC_PRODUCTION \
212    OFED_EXTRA \
213    OPENLDAP \
214    REPRODUCIBLE_BUILD \
215    RPCBIND_WARMSTART_SUPPORT \
216    SORT_THREADS \
217    ZONEINFO_LEAPSECONDS_SUPPORT \
218
219__REQUIRED_OPTIONS = \
220    CAPSICUM \
221    CASPER
222
223# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
224# RIGHT option is disabled.
225__DEFAULT_DEPENDENT_OPTIONS= \
226	CLANG_FULL/CLANG \
227	LLVM_TARGET_ALL/CLANG \
228	LOADER_VERIEXEC/BEARSSL \
229	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
230	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
231	VERIEXEC/BEARSSL \
232
233# MK_*_SUPPORT options which default to "yes" unless their corresponding
234# MK_* variable is set to "no".
235#
236.for var in \
237    BLACKLIST \
238    BZIP2 \
239    INET \
240    INET6 \
241    KERBEROS \
242    KVM \
243    NETGRAPH \
244    PAM \
245    TESTS \
246    WIRELESS
247__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
248.endfor
249
250#
251# Default behaviour of some options depends on the architecture.  Unfortunately
252# this means that we have to test TARGET_ARCH (the buildworld case) as well
253# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
254# used at all in bsd.*.mk, but we have to make an exception here if we want
255# to allow defaults for some things like clang to vary by target architecture.
256# Additional, per-target behavior should be rarely added only after much
257# gnashing of teeth and grinding of gears.
258#
259.if defined(TARGET_ARCH)
260__T=${TARGET_ARCH}
261.else
262__T=${MACHINE_ARCH}
263.endif
264
265# All supported backends for LLVM_TARGET_XXX
266__LLVM_TARGETS= \
267		aarch64 \
268		arm \
269		powerpc \
270		riscv \
271		x86
272__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
273.for __llt in ${__LLVM_TARGETS}
274# Default enable the given TARGET's LLVM_TARGET support
275.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
276__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
277# aarch64 needs arm for -m32 support.
278.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
279__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
280# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
281.else
282__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
283.endif
284.endfor
285
286__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
287
288.include <bsd.compiler.mk>
289
290.if ${__T} == "i386" || ${__T} == "amd64"
291__DEFAULT_NO_OPTIONS += FDT
292.else
293__DEFAULT_YES_OPTIONS += FDT
294.endif
295
296.if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
297__DEFAULT_YES_OPTIONS+=LLDB
298.else
299__DEFAULT_NO_OPTIONS+=LLDB
300.endif
301# LIB32 is not supported on all 64-bit architectures.
302.if (${__T} == "amd64" || ${__T:Maarch64*} != "" || ${__T} == "powerpc64")
303__DEFAULT_YES_OPTIONS+=LIB32
304.else
305BROKEN_OPTIONS+=LIB32
306.endif
307# EFI doesn't exist on powerpc (well, officially) and doesn't work on i386
308.if ${__T:Mpowerpc*} || ${__T} == "i386"
309BROKEN_OPTIONS+=EFI
310.endif
311# OFW is only for powerpc, exclude others
312.if ${__T:Mpowerpc*} == ""
313BROKEN_OPTIONS+=LOADER_OFW
314.endif
315# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
316.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
317BROKEN_OPTIONS+=LOADER_KBOOT
318.endif
319# UBOOT is only for arm, and big-endian powerpc
320.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
321BROKEN_OPTIONS+=LOADER_UBOOT
322.endif
323# GELI and Lua in loader currently cause boot failures on powerpc.
324# Further debugging is required -- probably they are just broken on big
325# endian systems generically (they jump to null pointers or try to read
326# crazy high addresses, which is typical of endianness problems).
327.if ${__T:Mpowerpc*}
328BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
329.endif
330
331# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
332.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
333__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
334.else
335__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
336.endif
337
338.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
339    ${__T:Mpowerpc64*} == ""
340BROKEN_OPTIONS+=CXGBETOOL
341BROKEN_OPTIONS+=MLX5TOOL
342.endif
343
344.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
345BROKEN_OPTIONS+=HYPERV
346.endif
347
348# NVME is only aarch64, x86 and powerpc64*
349.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
350    ${__T:Mpowerpc64*} == ""
351BROKEN_OPTIONS+=NVME
352.endif
353
354.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
355    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
356__DEFAULT_YES_OPTIONS+=OPENMP
357.else
358__DEFAULT_NO_OPTIONS+=OPENMP
359.endif
360
361# Broken on 32-bit arm, kernel module compile errors
362.if ${__T:Marm*} != ""
363BROKEN_OPTIONS+= OFED
364.endif
365
366# MK_host_egacy is set by local.sys.mk so is valid here
367.if ${MACHINE} == "host" && ${MK_host_egacy} == "yes"
368# we cannot expect tests to work
369BROKEN_OPTIONS+= TESTS
370.endif
371
372.-include <site.src.opts.mk>
373
374.include <bsd.mkopt.mk>
375
376#
377# Force some options off if their dependencies are off.
378# Order is somewhat important.
379#
380.if ${MK_CAPSICUM} == "no"
381MK_CASPER:=	no
382.endif
383
384.if ${MK_SOURCELESS} == "no"
385MK_SOURCELESS_HOST:=	no
386MK_SOURCELESS_UCODE:= no
387.endif
388
389.if ${MK_CDDL} == "no"
390MK_CTF:=	no
391MK_DTRACE:=	no
392MK_LOADER_ZFS:=	no
393MK_ZFS:=	no
394.endif
395
396.if ${MK_CRYPT} == "no"
397MK_OPENSSL:=	no
398MK_OPENSSH:=	no
399MK_KERBEROS:=	no
400MK_KERBEROS_SUPPORT:=	no
401.endif
402
403.if ${MK_DIALOG} == "no"
404MK_BSDINSTALL:=	no
405.endif
406
407.if ${MK_DTRACE} == "no"
408MK_CTF:=	no
409.endif
410
411.if ${MK_MAIL} == "no"
412MK_MAILWRAPPER:= no
413MK_SENDMAIL:=	no
414MK_DMAGENT:=	no
415.endif
416
417.if ${MK_NETGRAPH} == "no"
418MK_BLUETOOTH:=	no
419.endif
420
421.if ${MK_NLS} == "no"
422MK_NLS_CATALOGS:= no
423.endif
424
425.if ${MK_OPENSSL} == "no"
426MK_DMAGENT:=	no
427MK_OPENSSH:=	no
428MK_OPENSSL_KTLS:=	no
429MK_KERBEROS:=	no
430MK_KERBEROS_SUPPORT:=	no
431MK_LDNS:=	no
432MK_PKGBOOTSTRAP:=	no
433MK_LOADER_ZFS:=	no
434MK_ZFS:=	no
435.endif
436
437.if ${MK_LDNS} == "no"
438MK_LDNS_UTILS:=	no
439MK_UNBOUND:= no
440.endif
441
442.if ${MK_PF} == "no"
443MK_AUTHPF:=	no
444.endif
445
446.if ${MK_OFED} == "no"
447MK_OFED_EXTRA:=	no
448.endif
449
450.if ${MK_TESTS} == "no"
451MK_DTRACE_TESTS:= no
452.endif
453
454.if ${MK_TESTS_SUPPORT} == "no"
455MK_GOOGLETEST:=	no
456.endif
457
458.if ${MK_ZONEINFO} == "no"
459MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
460.endif
461
462.if ${MK_CROSS_COMPILER} == "no"
463MK_CLANG_BOOTSTRAP:= no
464MK_ELFTOOLCHAIN_BOOTSTRAP:= no
465MK_LLD_BOOTSTRAP:= no
466.endif
467
468.if ${MK_TOOLCHAIN} == "no"
469MK_CLANG:=	no
470MK_LLD:=	no
471MK_LLDB:=	no
472MK_LLVM_BINUTILS:=	no
473.endif
474
475.if ${MK_CLANG} == "no"
476MK_CLANG_EXTRAS:= no
477MK_CLANG_FORMAT:= no
478MK_CLANG_FULL:= no
479MK_LLVM_COV:= no
480.endif
481
482.if ${MK_ASAN} == "yes"
483# In order to get sensible backtraces from ASAN we have to install
484# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
485MK_LLVM_BINUTILS:=	yes
486.endif
487
488.if ${MK_LLVM_BINUTILS} == "yes"
489# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
490# enabled if MK_LLVM_BINUTILS is set.
491MK_LLVM_CXXFILT:=	yes
492.endif
493
494.if ${MK_LOADER_VERIEXEC} == "no"
495MK_LOADER_VERIEXEC_PASS_MANIFEST := no
496.endif
497
498#
499# MK_* options whose default value depends on another option.
500#
501.for vv in \
502    GSSAPI/KERBEROS \
503    MAN_UTILS/MAN
504.if defined(WITH_${vv:H})
505MK_${vv:H}:=	yes
506.elif defined(WITHOUT_${vv:H})
507MK_${vv:H}:=	no
508.else
509MK_${vv:H}:=	${MK_${vv:T}}
510.endif
511.endfor
512
513#
514# Set defaults for the MK_*_SUPPORT variables.
515#
516
517.endif #  !target(__<src.opts.mk>__)
518