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