xref: /freebsd/share/mk/src.opts.mk (revision 5e3934b15a2741b2de6b217e77dc9d798d740804)
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    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    FP_LIBC \
102    FREEBSD_UPDATE \
103    FTP \
104    GAMES \
105    GH_BC \
106    GNU_DIFF \
107    GOOGLETEST \
108    GPIO \
109    HAST \
110    HTML \
111    HYPERV \
112    ICONV \
113    INET \
114    INET6 \
115    INETD \
116    IPFILTER \
117    IPFW \
118    ISCSI \
119    JAIL \
120    KDUMP \
121    KVM \
122    LDNS \
123    LDNS_UTILS \
124    LEGACY_CONSOLE \
125    LLD \
126    LLD_BOOTSTRAP \
127    LLVM_ASSERTIONS \
128    LLVM_COV \
129    LLVM_CXXFILT \
130    LOADER_GELI \
131    LOADER_KBOOT \
132    LOADER_LUA \
133    LOADER_OFW \
134    LOADER_UBOOT \
135    LOCALES \
136    LOCATE \
137    LPR \
138    LS_COLORS \
139    MACHDEP_OPTIMIZATIONS \
140    MAIL \
141    MAILWRAPPER \
142    MAKE \
143    MLX5TOOL \
144    NETCAT \
145    NETGRAPH \
146    NETLINK \
147    NETLINK_SUPPORT \
148    NLS_CATALOGS \
149    NS_CACHING \
150    NTP \
151    NVME \
152    OFED \
153    OPENSSL \
154    PAM \
155    PF \
156    PKGBOOTSTRAP \
157    PMC \
158    PPP \
159    PTHREADS_ASSERTIONS \
160    QUOTAS \
161    RADIUS_SUPPORT \
162    RBOOTD \
163    RESCUE \
164    ROUTED \
165    SENDMAIL \
166    SERVICESDB \
167    SETUID_LOGIN \
168    SHAREDOCS \
169    SOURCELESS \
170    SOURCELESS_HOST \
171    SOURCELESS_UCODE \
172    STATS \
173    SYSCONS \
174    SYSTEM_COMPILER \
175    SYSTEM_LINKER \
176    TALK \
177    TCP_WRAPPERS \
178    TCSH \
179    TELNET \
180    TEXTPROC \
181    TFTP \
182    UNBOUND \
183    USB \
184    UTMPX \
185    VI \
186    VT \
187    WIRELESS \
188    WPA_SUPPLICANT_EAPOL \
189    ZFS \
190    LOADER_ZFS \
191    ZONEINFO
192
193__DEFAULT_NO_OPTIONS = \
194    BEARSSL \
195    BHYVE_SNAPSHOT \
196    CLANG_EXTRAS \
197    CLANG_FORMAT \
198    DIALOG \
199    DETECT_TZ_CHANGES \
200    DISK_IMAGE_TOOLS_BOOTSTRAP \
201    DTRACE_ASAN \
202    DTRACE_TESTS \
203    EXPERIMENTAL \
204    HESIOD \
205    LOADER_VERBOSE \
206    LOADER_VERIEXEC_PASS_MANIFEST \
207    LLVM_BINUTILS \
208    MALLOC_PRODUCTION \
209    OFED_EXTRA \
210    OPENLDAP \
211    REPRODUCIBLE_BUILD \
212    RPCBIND_WARMSTART_SUPPORT \
213    SORT_THREADS \
214    ZONEINFO_LEAPSECONDS_SUPPORT \
215
216__REQUIRED_OPTIONS = \
217    CAPSICUM \
218    CASPER
219
220# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
221# RIGHT option is disabled.
222__DEFAULT_DEPENDENT_OPTIONS= \
223	CLANG_FULL/CLANG \
224	LLVM_TARGET_ALL/CLANG \
225	LOADER_VERIEXEC/BEARSSL \
226	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
227	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
228	VERIEXEC/BEARSSL \
229
230__SINGLE_OPTIONS = \
231	LIBC_MALLOC
232
233__LIBC_MALLOC_OPTIONS=	jemalloc
234__LIBC_MALLOC_DEFAULT=	jemalloc
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# NVME is only aarch64, x86 and powerpc64*
352.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
353    ${__T:Mpowerpc64*} == ""
354BROKEN_OPTIONS+=NVME
355.endif
356
357.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
358    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
359__DEFAULT_YES_OPTIONS+=OPENMP
360.else
361__DEFAULT_NO_OPTIONS+=OPENMP
362.endif
363
364# Broken on 32-bit arm, kernel module compile errors
365.if ${__T:Marm*} != ""
366BROKEN_OPTIONS+= OFED
367.endif
368
369# MK_host_egacy is set by local.sys.mk so is valid here
370.if ${MACHINE:Nhost*} == "" && ${MK_host_egacy} == "yes"
371# we cannot expect tests to work
372BROKEN_OPTIONS+= TESTS
373.endif
374
375.-include <site.src.opts.mk>
376
377.include <bsd.mkopt.mk>
378
379#
380# Force some options off if their dependencies are off.
381# Order is somewhat important.
382#
383.if ${MK_CAPSICUM} == "no"
384MK_CASPER:=	no
385.endif
386
387.if ${MK_SOURCELESS} == "no"
388MK_SOURCELESS_HOST:=	no
389MK_SOURCELESS_UCODE:= no
390.endif
391
392.if ${MK_CDDL} == "no"
393MK_CTF:=	no
394MK_DTRACE:=	no
395MK_LOADER_ZFS:=	no
396MK_ZFS:=	no
397.endif
398
399.if ${MK_CRYPT} == "no"
400MK_OPENSSL:=	no
401MK_OPENSSH:=	no
402MK_KERBEROS:=	no
403MK_KERBEROS_SUPPORT:=	no
404.endif
405
406.if ${MK_DTRACE} == "no"
407MK_CTF:=	no
408.endif
409
410.if ${MK_MAIL} == "no"
411MK_MAILWRAPPER:= no
412MK_SENDMAIL:=	no
413MK_DMAGENT:=	no
414.endif
415
416.if ${MK_NETGRAPH} == "no"
417MK_BLUETOOTH:=	no
418.endif
419
420.if ${MK_NLS} == "no"
421MK_NLS_CATALOGS:= no
422.endif
423
424.if ${MK_OPENSSL} == "no"
425MK_DMAGENT:=	no
426MK_OPENSSH:=	no
427MK_OPENSSL_KTLS:=	no
428MK_KERBEROS:=	no
429MK_KERBEROS_SUPPORT:=	no
430MK_LDNS:=	no
431MK_PKGBOOTSTRAP:=	no
432MK_LOADER_ZFS:=	no
433MK_ZFS:=	no
434.endif
435
436.if ${MK_LDNS} == "no"
437MK_LDNS_UTILS:=	no
438MK_UNBOUND:= no
439.endif
440
441.if ${MK_PF} == "no"
442MK_AUTHPF:=	no
443.endif
444
445.if ${MK_OFED} == "no"
446MK_OFED_EXTRA:=	no
447.endif
448
449.if ${MK_TESTS} == "no"
450MK_DTRACE_TESTS:= no
451.endif
452
453.if ${MK_TESTS_SUPPORT} == "no"
454MK_GOOGLETEST:=	no
455.endif
456
457.if ${MK_ZONEINFO} == "no"
458MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
459.endif
460
461.if ${MK_CROSS_COMPILER} == "no"
462MK_CLANG_BOOTSTRAP:= no
463MK_ELFTOOLCHAIN_BOOTSTRAP:= no
464MK_LLD_BOOTSTRAP:= no
465.endif
466
467.if ${MK_TOOLCHAIN} == "no"
468MK_CLANG:=	no
469MK_LLD:=	no
470MK_LLDB:=	no
471MK_LLVM_BINUTILS:=	no
472.endif
473
474.if ${MK_CLANG} == "no"
475MK_CLANG_EXTRAS:= no
476MK_CLANG_FORMAT:= no
477MK_CLANG_FULL:= no
478MK_LLVM_COV:= no
479.endif
480
481.if ${MK_ASAN} == "yes"
482# In order to get sensible backtraces from ASAN we have to install
483# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
484MK_LLVM_BINUTILS:=	yes
485.endif
486
487.if ${MK_LLVM_BINUTILS} == "yes"
488# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
489# enabled if MK_LLVM_BINUTILS is set.
490MK_LLVM_CXXFILT:=	yes
491.endif
492
493.if ${MK_LOADER_VERIEXEC} == "no"
494MK_LOADER_VERIEXEC_PASS_MANIFEST := no
495.endif
496
497#
498# MK_* options whose default value depends on another option.
499#
500.for vv in \
501    GSSAPI/KERBEROS \
502    MAN_UTILS/MAN
503.if defined(WITH_${vv:H})
504MK_${vv:H}:=	yes
505.elif defined(WITHOUT_${vv:H})
506MK_${vv:H}:=	no
507.else
508MK_${vv:H}:=	${MK_${vv:T}}
509.endif
510.endfor
511
512#
513# Set defaults for the MK_*_SUPPORT variables.
514#
515
516.endif #  !target(__<src.opts.mk>__)
517