xref: /freebsd/share/mk/src.opts.mk (revision 090e9752d7291db0c251a5576892e3bbbaea2479)
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    NLS_CATALOGS \
149    NS_CACHING \
150    NTP \
151    NVME \
152    OFED \
153    OPENSSL \
154    PAM \
155    PF \
156    PKGBOOTSTRAP \
157    PMC \
158    PPP \
159    QUOTAS \
160    RADIUS_SUPPORT \
161    RBOOTD \
162    RESCUE \
163    ROUTED \
164    SENDMAIL \
165    SERVICESDB \
166    SETUID_LOGIN \
167    SHARED_TOOLCHAIN \
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    DETECT_TZ_CHANGES \
199    DISK_IMAGE_TOOLS_BOOTSTRAP \
200    DTRACE_TESTS \
201    EXPERIMENTAL \
202    HESIOD \
203    LOADER_VERBOSE \
204    LOADER_VERIEXEC_PASS_MANIFEST \
205    LLVM_BINUTILS \
206    MALLOC_PRODUCTION \
207    OFED_EXTRA \
208    OPENLDAP \
209    REPRODUCIBLE_BUILD \
210    RPCBIND_WARMSTART_SUPPORT \
211    SORT_THREADS \
212    ZONEINFO_LEAPSECONDS_SUPPORT \
213
214# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
215# RIGHT option is disabled.
216__DEFAULT_DEPENDENT_OPTIONS= \
217	CLANG_FULL/CLANG \
218	LLVM_TARGET_ALL/CLANG \
219	LOADER_VERIEXEC/BEARSSL \
220	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
221	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
222	VERIEXEC/BEARSSL \
223
224# MK_*_SUPPORT options which default to "yes" unless their corresponding
225# MK_* variable is set to "no".
226#
227.for var in \
228    BLACKLIST \
229    BZIP2 \
230    INET \
231    INET6 \
232    KERBEROS \
233    KVM \
234    NETGRAPH \
235    PAM \
236    TESTS \
237    WIRELESS
238__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
239.endfor
240
241#
242# Default behaviour of some options depends on the architecture.  Unfortunately
243# this means that we have to test TARGET_ARCH (the buildworld case) as well
244# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
245# used at all in bsd.*.mk, but we have to make an exception here if we want
246# to allow defaults for some things like clang to vary by target architecture.
247# Additional, per-target behavior should be rarely added only after much
248# gnashing of teeth and grinding of gears.
249#
250.if defined(TARGET_ARCH)
251__T=${TARGET_ARCH}
252.else
253__T=${MACHINE_ARCH}
254.endif
255
256# All supported backends for LLVM_TARGET_XXX
257__LLVM_TARGETS= \
258		aarch64 \
259		arm \
260		powerpc \
261		riscv \
262		x86
263__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/
264.for __llt in ${__LLVM_TARGETS}
265# Default enable the given TARGET's LLVM_TARGET support
266.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
267__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
268# aarch64 needs arm for -m32 support.
269.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
270__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
271# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
272.else
273__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
274.endif
275.endfor
276
277__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
278
279.include <bsd.compiler.mk>
280
281.if ${__T} == "i386" || ${__T} == "amd64"
282__DEFAULT_NO_OPTIONS += FDT
283.else
284__DEFAULT_YES_OPTIONS += FDT
285.endif
286
287.if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
288__DEFAULT_YES_OPTIONS+=LLDB
289.else
290__DEFAULT_NO_OPTIONS+=LLDB
291.endif
292# LIB32 is supported on amd64 and powerpc64
293.if (${__T} == "amd64" || ${__T} == "powerpc64")
294__DEFAULT_YES_OPTIONS+=LIB32
295.else
296BROKEN_OPTIONS+=LIB32
297.endif
298# EFI doesn't exist on powerpc (well, officially)
299.if ${__T:Mpowerpc*}
300BROKEN_OPTIONS+=EFI
301.endif
302# OFW is only for powerpc, exclude others
303.if ${__T:Mpowerpc*} == ""
304BROKEN_OPTIONS+=LOADER_OFW
305.endif
306# KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64
307.if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64"
308BROKEN_OPTIONS+=LOADER_KBOOT
309.endif
310# UBOOT is only for arm, and big-endian powerpc
311.if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
312BROKEN_OPTIONS+=LOADER_UBOOT
313.endif
314# GELI and Lua in loader currently cause boot failures on powerpc.
315# Further debugging is required -- probably they are just broken on big
316# endian systems generically (they jump to null pointers or try to read
317# crazy high addresses, which is typical of endianness problems).
318.if ${__T:Mpowerpc*}
319BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
320.endif
321
322# Kernel TLS is enabled by default on amd64, aarch64 and powerpc64*
323.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != ""
324__DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
325.else
326__DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
327.endif
328
329.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
330    ${__T:Mpowerpc64*} == ""
331BROKEN_OPTIONS+=CXGBETOOL
332BROKEN_OPTIONS+=MLX5TOOL
333.endif
334
335.if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64"
336BROKEN_OPTIONS+=HYPERV
337.endif
338
339# NVME is only aarch64, x86 and powerpc64*
340.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
341    ${__T:Mpowerpc64*} == ""
342BROKEN_OPTIONS+=NVME
343.endif
344
345.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
346    ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != ""
347__DEFAULT_YES_OPTIONS+=OPENMP
348.else
349__DEFAULT_NO_OPTIONS+=OPENMP
350.endif
351
352# Broken on 32-bit arm, kernel module compile errors
353.if ${__T:Marm*} != ""
354BROKEN_OPTIONS+= OFED
355.endif
356
357.if ${__T} == "i386" || ${__T} == "amd64"
358__DEFAULT_YES_OPTIONS+=NETLINK_SUPPORT
359.else
360__DEFAULT_NO_OPTIONS+=NETLINK_SUPPORT
361.endif
362
363# MK_host_egacy is set by local.sys.mk so is valid here
364.if ${MACHINE} == "host" && ${MK_host_egacy} == "yes"
365# we cannot expect tests to work
366BROKEN_OPTIONS+= TESTS
367.endif
368
369.-include <site.src.opts.mk>
370
371.include <bsd.mkopt.mk>
372
373#
374# Force some options off if their dependencies are off.
375# Order is somewhat important.
376#
377.if ${MK_CAPSICUM} == "no"
378MK_CASPER:=	no
379.endif
380
381.if ${MK_SOURCELESS} == "no"
382MK_SOURCELESS_HOST:=	no
383MK_SOURCELESS_UCODE:= no
384.endif
385
386.if ${MK_CDDL} == "no"
387MK_CTF:=	no
388MK_DTRACE:=	no
389MK_LOADER_ZFS:=	no
390MK_ZFS:=	no
391.endif
392
393.if ${MK_CRYPT} == "no"
394MK_OPENSSL:=	no
395MK_OPENSSH:=	no
396MK_KERBEROS:=	no
397MK_KERBEROS_SUPPORT:=	no
398.endif
399
400.if ${MK_DIALOG} == "no"
401MK_BSDINSTALL:=	no
402.endif
403
404.if ${MK_DTRACE} == "no"
405MK_CTF:=	no
406.endif
407
408.if ${MK_MAIL} == "no"
409MK_MAILWRAPPER:= no
410MK_SENDMAIL:=	no
411MK_DMAGENT:=	no
412.endif
413
414.if ${MK_NETGRAPH} == "no"
415MK_BLUETOOTH:=	no
416.endif
417
418.if ${MK_NLS} == "no"
419MK_NLS_CATALOGS:= no
420.endif
421
422.if ${MK_OPENSSL} == "no"
423MK_DMAGENT:=	no
424MK_OPENSSH:=	no
425MK_OPENSSL_KTLS:=	no
426MK_KERBEROS:=	no
427MK_KERBEROS_SUPPORT:=	no
428MK_LDNS:=	no
429MK_PKGBOOTSTRAP:=	no
430MK_LOADER_ZFS:=	no
431MK_ZFS:=	no
432.endif
433
434.if ${MK_LDNS} == "no"
435MK_LDNS_UTILS:=	no
436MK_UNBOUND:= no
437.endif
438
439.if ${MK_PF} == "no"
440MK_AUTHPF:=	no
441.endif
442
443.if ${MK_OFED} == "no"
444MK_OFED_EXTRA:=	no
445.endif
446
447.if ${MK_TESTS} == "no"
448MK_DTRACE_TESTS:= no
449.endif
450
451.if ${MK_TESTS_SUPPORT} == "no"
452MK_GOOGLETEST:=	no
453.endif
454
455.if ${MK_ZONEINFO} == "no"
456MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
457.endif
458
459.if ${MK_CROSS_COMPILER} == "no"
460MK_CLANG_BOOTSTRAP:= no
461MK_ELFTOOLCHAIN_BOOTSTRAP:= no
462MK_LLD_BOOTSTRAP:= no
463.endif
464
465.if ${MK_TOOLCHAIN} == "no"
466MK_CLANG:=	no
467MK_INCLUDES:=	no
468MK_LLD:=	no
469MK_LLDB:=	no
470MK_LLVM_BINUTILS:=	no
471.endif
472
473.if ${MK_CLANG} == "no"
474MK_CLANG_EXTRAS:= no
475MK_CLANG_FORMAT:= no
476MK_CLANG_FULL:= no
477MK_LLVM_COV:= no
478.endif
479
480.if ${MK_ASAN} == "yes"
481# In order to get sensible backtraces from ASAN we have to install
482# llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
483MK_LLVM_BINUTILS:=	yes
484.endif
485
486.if ${MK_LLVM_BINUTILS} == "yes"
487# MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
488# enabled if MK_LLVM_BINUTILS is set.
489MK_LLVM_CXXFILT:=	yes
490.endif
491
492.if ${MK_LOADER_VERIEXEC} == "no"
493MK_LOADER_VERIEXEC_PASS_MANIFEST := no
494.endif
495
496#
497# MK_* options whose default value depends on another option.
498#
499.for vv in \
500    GSSAPI/KERBEROS \
501    MAN_UTILS/MAN
502.if defined(WITH_${vv:H})
503MK_${vv:H}:=	yes
504.elif defined(WITHOUT_${vv:H})
505MK_${vv:H}:=	no
506.else
507MK_${vv:H}:=	${MK_${vv:T}}
508.endif
509.endfor
510
511#
512# Set defaults for the MK_*_SUPPORT variables.
513#
514
515.endif #  !target(__<src.opts.mk>__)
516