xref: /freebsd/share/mk/src.opts.mk (revision c697fb7f7cc9bedc5beee44d35b771c4e87b335a)
1# $FreeBSD$
2#
3# Option file for FreeBSD /usr/src builds.
4#
5# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
6# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
7# with sensible (usually) defaults.
8#
9# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
10# are applicable for that Makefile (typically there are none, but sometimes there
11# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
12# to omit from that make.
13#
14# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
15# variable.
16#
17# Makefiles may also assume that this file is included by src.opts.mk should it
18# need variables defined there prior to the end of the Makefile where
19# bsd.{subdir,lib.bin}.mk is traditionally included.
20#
21# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
22# should be added. Old instances should be removed since they were just to
23# bridge the gap between FreeBSD 4 and FreeBSD 5.
24#
25# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
26# exception is made for _WITHOUT_SRCONF which turns off this mechanism
27# completely inside bsd.*.mk files).
28#
29
30.if !target(__<src.opts.mk>__)
31__<src.opts.mk>__:
32
33.include <bsd.own.mk>
34
35#
36# Define MK_* variables (which are either "yes" or "no") for users
37# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
38# make(1) environment.
39# These should be tested with `== "no"' or `!= "no"' in makefiles.
40# The NO_* variables should only be set by makefiles for variables
41# that haven't been converted over.
42#
43
44# These options are used by the src builds. Those listed in
45# __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned
46# off.  __DEFAULT_NO_OPTIONS will default to 'no' and won't build
47# unless turned on. Any options listed in 'BROKEN_OPTIONS' will be
48# hard-wired to 'no'.  "Broken" here means not working or
49# not-appropriate and/or not supported. It doesn't imply something is
50# wrong with the code. There's not a single good word for this, so
51# BROKEN was selected as the least imperfect one considered at the
52# time. Options are added to BROKEN_OPTIONS list on a per-arch basis.
53# At this time, there's no provision for mutually incompatible options.
54
55__DEFAULT_YES_OPTIONS = \
56    ACCT \
57    ACPI \
58    APM \
59    AT \
60    ATM \
61    AUDIT \
62    AUTHPF \
63    AUTOFS \
64    BHYVE \
65    BINUTILS \
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    CLANG_IS_CC \
84    CPP \
85    CROSS_COMPILER \
86    CRYPT \
87    CUSE \
88    CXX \
89    CXGBETOOL \
90    DIALOG \
91    DICT \
92    DMAGENT \
93    DYNAMICROOT \
94    EE \
95    EFI \
96    ELFTOOLCHAIN_BOOTSTRAP \
97    EXAMPLES \
98    FDT \
99    FILE \
100    FINGER \
101    FLOPPY \
102    FMTREE \
103    FORTH \
104    FP_LIBC \
105    FREEBSD_UPDATE \
106    FTP \
107    GAMES \
108    GDB \
109    GDB_LIBEXEC \
110    GNU_DIFF \
111    GNU_GREP \
112    GOOGLETEST \
113    GPIO \
114    HAST \
115    HTML \
116    HYPERV \
117    ICONV \
118    INET \
119    INET6 \
120    INETD \
121    IPFILTER \
122    IPFW \
123    ISCSI \
124    JAIL \
125    KDUMP \
126    KVM \
127    LDNS \
128    LDNS_UTILS \
129    LEGACY_CONSOLE \
130    LIBCPLUSPLUS \
131    LIBPTHREAD \
132    LIBTHR \
133    LLD \
134    LLVM_COV \
135    LLVM_TARGET_ALL \
136    LOADER_GELI \
137    LOADER_LUA \
138    LOADER_OFW \
139    LOADER_UBOOT \
140    LOCALES \
141    LOCATE \
142    LPR \
143    LS_COLORS \
144    LZMA_SUPPORT \
145    MAIL \
146    MAILWRAPPER \
147    MAKE \
148    MLX5TOOL \
149    NDIS \
150    NETCAT \
151    NETGRAPH \
152    NLS_CATALOGS \
153    NS_CACHING \
154    NTP \
155    NVME \
156    OFED \
157    OPENSSL \
158    PAM \
159    PF \
160    PKGBOOTSTRAP \
161    PMC \
162    PORTSNAP \
163    PPP \
164    QUOTAS \
165    RADIUS_SUPPORT \
166    RBOOTD \
167    RESCUE \
168    ROUTED \
169    SENDMAIL \
170    SERVICESDB \
171    SETUID_LOGIN \
172    SHARED_TOOLCHAIN \
173    SHAREDOCS \
174    SOURCELESS \
175    SOURCELESS_HOST \
176    SOURCELESS_UCODE \
177    STATS \
178    SVNLITE \
179    SYSCONS \
180    SYSTEM_COMPILER \
181    SYSTEM_LINKER \
182    TALK \
183    TCP_WRAPPERS \
184    TCSH \
185    TELNET \
186    TEXTPROC \
187    TFTP \
188    UNBOUND \
189    USB \
190    UTMPX \
191    VI \
192    VT \
193    WIRELESS \
194    WPA_SUPPLICANT_EAPOL \
195    ZFS \
196    LOADER_ZFS \
197    ZONEINFO
198
199__DEFAULT_NO_OPTIONS = \
200    BEARSSL \
201    BSD_GREP \
202    CLANG_EXTRAS \
203    DTRACE_TESTS \
204    EXPERIMENTAL \
205    GNU_GREP_COMPAT \
206    HESIOD \
207    LIBSOFT \
208    LOADER_FIREWIRE \
209    LOADER_FORCE_LE \
210    LOADER_VERBOSE \
211    LOADER_VERIEXEC_PASS_MANIFEST \
212    OFED_EXTRA \
213    OPENLDAP \
214    REPRODUCIBLE_BUILD \
215    RPCBIND_WARMSTART_SUPPORT \
216    SORT_THREADS \
217    SVN \
218    ZONEINFO_LEAPSECONDS_SUPPORT \
219    ZONEINFO_OLD_TIMEZONES_SUPPORT \
220
221# LEFT/RIGHT. Left options which default to "yes" unless their corresponding
222# RIGHT option is disabled.
223__DEFAULT_DEPENDENT_OPTIONS= \
224	CLANG_FULL/CLANG \
225	LOADER_VERIEXEC/BEARSSL \
226	LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
227	LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
228	VERIEXEC/BEARSSL \
229
230# MK_*_SUPPORT options which default to "yes" unless their corresponding
231# MK_* variable is set to "no".
232#
233.for var in \
234    BLACKLIST \
235    BZIP2 \
236    INET \
237    INET6 \
238    KERBEROS \
239    KVM \
240    NETGRAPH \
241    PAM \
242    TESTS \
243    WIRELESS
244__DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
245.endfor
246
247#
248# Default behaviour of some options depends on the architecture.  Unfortunately
249# this means that we have to test TARGET_ARCH (the buildworld case) as well
250# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
251# used at all in bsd.*.mk, but we have to make an exception here if we want
252# to allow defaults for some things like clang to vary by target architecture.
253# Additional, per-target behavior should be rarely added only after much
254# gnashing of teeth and grinding of gears.
255#
256.if defined(TARGET_ARCH)
257__T=${TARGET_ARCH}
258.else
259__T=${MACHINE_ARCH}
260.endif
261
262# All supported backends for LLVM_TARGET_XXX
263__LLVM_TARGETS= \
264		aarch64 \
265		arm \
266		mips \
267		powerpc \
268		riscv \
269		x86
270__LLVM_TARGET_FILT=	C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/:C/mips.*/mips/
271.for __llt in ${__LLVM_TARGETS}
272# Default enable the given TARGET's LLVM_TARGET support
273.if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
274__DEFAULT_YES_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
275# aarch64 needs arm for -m32 support.
276.elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
277__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
278# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
279.else
280__DEFAULT_DEPENDENT_OPTIONS+=	LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
281.endif
282.endfor
283
284__DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF
285
286.include <bsd.compiler.mk>
287
288# In-tree binutils/gcc are older versions without modern architecture support.
289.if ${__T} == "aarch64" || ${__T:Mriscv*} != ""
290BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB
291.endif
292.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
293__DEFAULT_YES_OPTIONS+=BINUTILS_BOOTSTRAP
294.else
295__DEFAULT_NO_OPTIONS+=BINUTILS_BOOTSTRAP
296.endif
297.if ${__T:Mriscv*} != ""
298BROKEN_OPTIONS+=OFED
299.endif
300.if ${__T} != "powerpc" && ${__T} != "powerpcspe"
301__DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
302.else
303__DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
304.endif
305.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386"
306__DEFAULT_YES_OPTIONS+=LLDB
307.else
308__DEFAULT_NO_OPTIONS+=LLDB
309.endif
310# LIB32 is supported on amd64, mips64, and powerpc64
311.if (${__T} == "amd64" || ${__T:Mmips64*} || ${__T} == "powerpc64")
312__DEFAULT_YES_OPTIONS+=LIB32
313.else
314BROKEN_OPTIONS+=LIB32
315.endif
316# Only doing soft float API stuff on armv6 and armv7
317.if ${__T} != "armv6" && ${__T} != "armv7"
318BROKEN_OPTIONS+=LIBSOFT
319.endif
320.if ${__T:Mmips*}
321# GOOGLETEST cannot currently be compiled on mips due to external circumstances.
322# Notably, the freebsd-gcc port isn't linking in libgcc so we end up trying ot
323# link to a hidden symbol. LLVM would successfully link this in, but some of
324# the mips variants are broken under LLVM until LLVM 10. GOOGLETEST should be
325# marked no longer broken with the switch to LLVM.
326BROKEN_OPTIONS+=GOOGLETEST SSP
327.endif
328# EFI doesn't exist on mips, powerpc, or riscv.
329.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Mriscv*}
330BROKEN_OPTIONS+=EFI
331.endif
332# OFW is only for powerpc, exclude others
333.if ${__T:Mpowerpc*} == ""
334BROKEN_OPTIONS+=LOADER_OFW
335.endif
336# UBOOT is only for arm, mips and powerpc, exclude others
337.if ${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == ""
338BROKEN_OPTIONS+=LOADER_UBOOT
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.if ${__T:Mmips64*}
349# profiling won't work on MIPS64 because there is only assembly for o32
350BROKEN_OPTIONS+=PROFILE
351.endif
352.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
353    ${__T} != "powerpc64"
354BROKEN_OPTIONS+=CXGBETOOL
355BROKEN_OPTIONS+=MLX5TOOL
356.endif
357
358# HyperV is currently x86-only
359.if ${__T} != "amd64" && ${__T} != "i386"
360BROKEN_OPTIONS+=HYPERV
361.endif
362
363# NVME is only aarch64, x86 and powerpc64
364.if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
365    ${__T} != "powerpc64"
366BROKEN_OPTIONS+=NVME
367.endif
368
369.if ${__T} == "amd64" || ${__T} == "i386" || ${__T} == "powerpc64"
370__DEFAULT_YES_OPTIONS+=OPENMP
371.else
372__DEFAULT_NO_OPTIONS+=OPENMP
373.endif
374
375.include <bsd.mkopt.mk>
376
377#
378# Force some options off if their dependencies are off.
379# Order is somewhat important.
380#
381.if ${MK_CAPSICUM} == "no"
382MK_CASPER:=	no
383.endif
384
385.if ${MK_LIBPTHREAD} == "no"
386MK_LIBTHR:=	no
387.endif
388
389.if ${MK_SOURCELESS} == "no"
390MK_SOURCELESS_HOST:=	no
391MK_SOURCELESS_UCODE:= no
392.endif
393
394.if ${MK_CDDL} == "no"
395MK_ZFS:=	no
396MK_LOADER_ZFS:=	no
397MK_CTF:=	no
398.endif
399
400.if ${MK_CRYPT} == "no"
401MK_OPENSSL:=	no
402MK_OPENSSH:=	no
403MK_KERBEROS:=	no
404MK_KERBEROS_SUPPORT:=	no
405.endif
406
407.if ${MK_CXX} == "no"
408MK_CLANG:=	no
409MK_GOOGLETEST:=	no
410MK_TESTS:=	no
411.endif
412
413.if ${MK_DIALOG} == "no"
414MK_BSDINSTALL:=	no
415.endif
416
417.if ${MK_FILE} == "no"
418MK_SVNLITE:=	no
419.endif
420
421.if ${MK_MAIL} == "no"
422MK_MAILWRAPPER:= no
423MK_SENDMAIL:=	no
424MK_DMAGENT:=	no
425.endif
426
427.if ${MK_NETGRAPH} == "no"
428MK_ATM:=	no
429MK_BLUETOOTH:=	no
430.endif
431
432.if ${MK_NLS} == "no"
433MK_NLS_CATALOGS:= no
434.endif
435
436.if ${MK_OPENSSL} == "no"
437MK_DMAGENT:=	no
438MK_OPENSSH:=	no
439MK_KERBEROS:=	no
440MK_KERBEROS_SUPPORT:=	no
441MK_LDNS:=	no
442.endif
443
444.if ${MK_LDNS} == "no"
445MK_LDNS_UTILS:=	no
446MK_UNBOUND:= no
447.endif
448
449.if ${MK_PF} == "no"
450MK_AUTHPF:=	no
451.endif
452
453.if ${MK_OFED} == "no"
454MK_OFED_EXTRA:=	no
455.endif
456
457.if ${MK_PORTSNAP} == "no"
458# freebsd-update depends on phttpget from portsnap
459MK_FREEBSD_UPDATE:=	no
460.endif
461
462.if ${MK_TESTS} == "no"
463MK_DTRACE_TESTS:= no
464.endif
465
466.if ${MK_TESTS_SUPPORT} == "no"
467MK_GOOGLETEST:=	no
468.endif
469
470.if ${MK_ZONEINFO} == "no"
471MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
472MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no
473.endif
474
475.if ${MK_CROSS_COMPILER} == "no"
476MK_BINUTILS_BOOTSTRAP:= no
477MK_CLANG_BOOTSTRAP:= no
478MK_ELFTOOLCHAIN_BOOTSTRAP:= no
479MK_LLD_BOOTSTRAP:= no
480.endif
481
482.if ${MK_TOOLCHAIN} == "no"
483MK_BINUTILS:=	no
484MK_CLANG:=	no
485MK_GDB:=	no
486MK_INCLUDES:=	no
487MK_LLD:=	no
488MK_LLDB:=	no
489.endif
490
491.if ${MK_CLANG} == "no"
492MK_CLANG_EXTRAS:= no
493MK_CLANG_FULL:= no
494MK_LLVM_COV:= no
495.endif
496
497.if ${MK_LOADER_VERIEXEC} == "no"
498MK_LOADER_VERIEXEC_PASS_MANIFEST := no
499.endif
500
501#
502# MK_* options whose default value depends on another option.
503#
504.for vv in \
505    GSSAPI/KERBEROS \
506    MAN_UTILS/MAN
507.if defined(WITH_${vv:H})
508MK_${vv:H}:=	yes
509.elif defined(WITHOUT_${vv:H})
510MK_${vv:H}:=	no
511.else
512MK_${vv:H}:=	${MK_${vv:T}}
513.endif
514.endfor
515
516#
517# Set defaults for the MK_*_SUPPORT variables.
518#
519
520.endif #  !target(__<src.opts.mk>__)
521