]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/src.opts.mk
unbound: Vendor import 1.16.2
[FreeBSD/FreeBSD.git] / share / mk / src.opts.mk
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     ATM \
63     AUDIT \
64     AUTHPF \
65     AUTOFS \
66     BHYVE \
67     BLACKLIST \
68     BLUETOOTH \
69     BOOT \
70     BOOTPARAMD \
71     BOOTPD \
72     BSD_CPIO \
73     BSDINSTALL \
74     BSNMP \
75     BZIP2 \
76     CALENDAR \
77     CAPSICUM \
78     CAROOT \
79     CASPER \
80     CCD \
81     CDDL \
82     CLANG \
83     CLANG_BOOTSTRAP \
84     CLANG_IS_CC \
85     CLEAN \
86     CPP \
87     CROSS_COMPILER \
88     CRYPT \
89     CUSE \
90     CXX \
91     CXGBETOOL \
92     DIALOG \
93     DICT \
94     DMAGENT \
95     DTRACE \
96     DYNAMICROOT \
97     EE \
98     EFI \
99     ELFTOOLCHAIN_BOOTSTRAP \
100     EXAMPLES \
101     FDT \
102     FILE \
103     FINGER \
104     FLOPPY \
105     FORTH \
106     FP_LIBC \
107     FREEBSD_UPDATE \
108     FTP \
109     GAMES \
110     GH_BC \
111     GNU_DIFF \
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     LLD \
131     LLD_BOOTSTRAP \
132     LLD_IS_LD \
133     LLVM_ASSERTIONS \
134     LLVM_COV \
135     LLVM_CXXFILT \
136     LOADER_GELI \
137     LOADER_KBOOT \
138     LOADER_LUA \
139     LOADER_OFW \
140     LOADER_UBOOT \
141     LOCALES \
142     LOCATE \
143     LPR \
144     LS_COLORS \
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     SYSCONS \
179     SYSTEM_COMPILER \
180     SYSTEM_LINKER \
181     TALK \
182     TCP_WRAPPERS \
183     TCSH \
184     TELNET \
185     TEXTPROC \
186     TFTP \
187     UNBOUND \
188     USB \
189     UTMPX \
190     VI \
191     VT \
192     WIRELESS \
193     WPA_SUPPLICANT_EAPOL \
194     ZFS \
195     LOADER_ZFS \
196     ZONEINFO
197
198 __DEFAULT_NO_OPTIONS = \
199     BEARSSL \
200     BHYVE_SNAPSHOT \
201     CLANG_EXTRAS \
202     CLANG_FORMAT \
203     DETECT_TZ_CHANGES \
204     DTRACE_TESTS \
205     EXPERIMENTAL \
206     HESIOD \
207     LOADER_FIREWIRE \
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 # LEFT/RIGHT. Left options which default to "yes" unless their corresponding
220 # RIGHT option is disabled.
221 __DEFAULT_DEPENDENT_OPTIONS= \
222         CLANG_FULL/CLANG \
223         LLVM_TARGET_ALL/CLANG \
224         LOADER_VERIEXEC/BEARSSL \
225         LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \
226         LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \
227         VERIEXEC/BEARSSL \
228
229 # MK_*_SUPPORT options which default to "yes" unless their corresponding
230 # MK_* variable is set to "no".
231 #
232 .for var in \
233     BLACKLIST \
234     BZIP2 \
235     INET \
236     INET6 \
237     KERBEROS \
238     KVM \
239     NETGRAPH \
240     PAM \
241     TESTS \
242     WIRELESS
243 __DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var}
244 .endfor
245
246 #
247 # Default behaviour of some options depends on the architecture.  Unfortunately
248 # this means that we have to test TARGET_ARCH (the buildworld case) as well
249 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
250 # used at all in bsd.*.mk, but we have to make an exception here if we want
251 # to allow defaults for some things like clang to vary by target architecture.
252 # Additional, per-target behavior should be rarely added only after much
253 # gnashing of teeth and grinding of gears.
254 #
255 .if defined(TARGET_ARCH)
256 __T=${TARGET_ARCH}
257 .else
258 __T=${MACHINE_ARCH}
259 .endif
260
261 # All supported backends for LLVM_TARGET_XXX
262 __LLVM_TARGETS= \
263                 aarch64 \
264                 arm \
265                 powerpc \
266                 riscv \
267                 x86
268 __LLVM_TARGET_FILT=     C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/:C/mips.*/mips/
269 .for __llt in ${__LLVM_TARGETS}
270 # Default enable the given TARGET's LLVM_TARGET support
271 .if ${__T:${__LLVM_TARGET_FILT}} == ${__llt}
272 __DEFAULT_YES_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}
273 # aarch64 needs arm for -m32 support.
274 .elif ${__T} == "aarch64" && ${__llt:Marm*} != ""
275 __DEFAULT_DEPENDENT_OPTIONS+=   LLVM_TARGET_ARM/LLVM_TARGET_AARCH64
276 # Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL.
277 .else
278 __DEFAULT_DEPENDENT_OPTIONS+=   LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL
279 .endif
280 .endfor
281
282 __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS
283
284 .include <bsd.compiler.mk>
285
286 .if ${__T:Marm*} == "" && ${__T:Mriscv64*} == ""
287 __DEFAULT_YES_OPTIONS+=LLDB
288 .else
289 __DEFAULT_NO_OPTIONS+=LLDB
290 .endif
291 # LIB32 is supported on amd64 and powerpc64
292 .if (${__T} == "amd64" || ${__T} == "powerpc64")
293 __DEFAULT_YES_OPTIONS+=LIB32
294 .else
295 BROKEN_OPTIONS+=LIB32
296 .endif
297 # EFI doesn't exist on powerpc (well, officially)
298 .if ${__T:Mpowerpc*}
299 BROKEN_OPTIONS+=EFI
300 .endif
301 # OFW is only for powerpc, exclude others
302 .if ${__T:Mpowerpc*} == ""
303 BROKEN_OPTIONS+=LOADER_OFW
304 .endif
305 # KBOOT is only for powerpc64 (powerpc64le broken) and kinda for amd64
306 .if ${__T} != "powerpc64" && ${__T} != "amd64"
307 BROKEN_OPTIONS+=LOADER_KBOOT
308 .endif
309 # UBOOT is only for arm, and big-endian powerpc
310 .if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le"
311 BROKEN_OPTIONS+=LOADER_UBOOT
312 .endif
313 # GELI and Lua in loader currently cause boot failures on powerpc.
314 # Further debugging is required -- probably they are just broken on big
315 # endian systems generically (they jump to null pointers or try to read
316 # crazy high addresses, which is typical of endianness problems).
317 .if ${__T:Mpowerpc*}
318 BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA
319 .endif
320
321 # Kernel TLS is enabled by default on amd64 and aarch64
322 .if ${__T} == "aarch64" || ${__T} == "amd64"
323 __DEFAULT_YES_OPTIONS+=OPENSSL_KTLS
324 .else
325 __DEFAULT_NO_OPTIONS+=OPENSSL_KTLS
326 .endif
327
328 .if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
329     ${__T:Mpowerpc64*} == ""
330 BROKEN_OPTIONS+=CXGBETOOL
331 BROKEN_OPTIONS+=MLX5TOOL
332 .endif
333
334 # HyperV is currently x86-only
335 .if ${__T} != "amd64" && ${__T} != "i386"
336 BROKEN_OPTIONS+=HYPERV
337 .endif
338
339 # NVME is only aarch64, x86 and powerpc64*
340 .if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \
341     ${__T:Mpowerpc64*} == ""
342 BROKEN_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 .include <bsd.mkopt.mk>
353
354 #
355 # Force some options off if their dependencies are off.
356 # Order is somewhat important.
357 #
358 .if ${MK_CAPSICUM} == "no"
359 MK_CASPER:=     no
360 .endif
361
362 .if ${MK_SOURCELESS} == "no"
363 MK_SOURCELESS_HOST:=    no
364 MK_SOURCELESS_UCODE:= no
365 .endif
366
367 .if ${MK_CDDL} == "no"
368 MK_CTF:=        no
369 MK_DTRACE:=     no
370 MK_LOADER_ZFS:= no
371 MK_ZFS:=        no
372 .endif
373
374 .if ${MK_CRYPT} == "no"
375 MK_OPENSSL:=    no
376 MK_OPENSSH:=    no
377 MK_KERBEROS:=   no
378 MK_KERBEROS_SUPPORT:=   no
379 .endif
380
381 .if ${MK_CXX} == "no"
382 MK_CLANG:=      no
383 MK_GOOGLETEST:= no
384 MK_OFED:=       no
385 MK_OPENMP:=     no
386 MK_PMC:=        no
387 MK_TESTS:=      no
388 .endif
389
390 .if ${MK_DIALOG} == "no"
391 MK_BSDINSTALL:= no
392 .endif
393
394 .if ${MK_DTRACE} == "no"
395 MK_CTF:=        no
396 .endif
397
398 .if ${MK_MAIL} == "no"
399 MK_MAILWRAPPER:= no
400 MK_SENDMAIL:=   no
401 MK_DMAGENT:=    no
402 .endif
403
404 .if ${MK_NETGRAPH} == "no"
405 MK_ATM:=        no
406 MK_BLUETOOTH:=  no
407 .endif
408
409 .if ${MK_NLS} == "no"
410 MK_NLS_CATALOGS:= no
411 .endif
412
413 .if ${MK_OPENSSL} == "no"
414 MK_DMAGENT:=    no
415 MK_OPENSSH:=    no
416 MK_OPENSSL_KTLS:=       no
417 MK_KERBEROS:=   no
418 MK_KERBEROS_SUPPORT:=   no
419 MK_LDNS:=       no
420 MK_PKGBOOTSTRAP:=       no
421 MK_ZFS:=        no
422 .endif
423
424 .if ${MK_LDNS} == "no"
425 MK_LDNS_UTILS:= no
426 MK_UNBOUND:= no
427 .endif
428
429 .if ${MK_PF} == "no"
430 MK_AUTHPF:=     no
431 .endif
432
433 .if ${MK_OFED} == "no"
434 MK_OFED_EXTRA:= no
435 .endif
436
437 .if ${MK_TESTS} == "no"
438 MK_DTRACE_TESTS:= no
439 .endif
440
441 .if ${MK_TESTS_SUPPORT} == "no"
442 MK_GOOGLETEST:= no
443 .endif
444
445 .if ${MK_ZONEINFO} == "no"
446 MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
447 .endif
448
449 .if ${MK_CROSS_COMPILER} == "no"
450 MK_CLANG_BOOTSTRAP:= no
451 MK_ELFTOOLCHAIN_BOOTSTRAP:= no
452 MK_LLD_BOOTSTRAP:= no
453 .endif
454
455 .if ${MK_TOOLCHAIN} == "no"
456 MK_CLANG:=      no
457 MK_INCLUDES:=   no
458 MK_LLD:=        no
459 MK_LLDB:=       no
460 MK_LLVM_BINUTILS:=      no
461 .endif
462
463 .if ${MK_CLANG} == "no"
464 MK_CLANG_EXTRAS:= no
465 MK_CLANG_FORMAT:= no
466 MK_CLANG_FULL:= no
467 MK_LLVM_COV:= no
468 .endif
469
470 .if ${MK_ASAN} == "yes"
471 # In order to get sensible backtraces from ASAN we have to install
472 # llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version.
473 MK_LLVM_BINUTILS:=      yes
474 .endif
475
476 .if ${MK_LLVM_BINUTILS} == "yes"
477 # MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be
478 # enabled if MK_LLVM_BINUTILS is set.
479 MK_LLVM_CXXFILT:=       yes
480 .endif
481
482 .if ${MK_LOADER_VERIEXEC} == "no"
483 MK_LOADER_VERIEXEC_PASS_MANIFEST := no
484 .endif
485
486 #
487 # MK_* options whose default value depends on another option.
488 #
489 .for vv in \
490     GSSAPI/KERBEROS \
491     MAN_UTILS/MAN
492 .if defined(WITH_${vv:H})
493 MK_${vv:H}:=    yes
494 .elif defined(WITHOUT_${vv:H})
495 MK_${vv:H}:=    no
496 .else
497 MK_${vv:H}:=    ${MK_${vv:T}}
498 .endif
499 .endfor
500
501 #
502 # Set defaults for the MK_*_SUPPORT variables.
503 #
504
505 .endif #  !target(__<src.opts.mk>__)