]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/mk/src.opts.mk
MFV r331400: 8484 Implement aggregate sum and use for arc counters
[FreeBSD/FreeBSD.git] / share / mk / src.opts.mk
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     AMD \
59     APM \
60     AT \
61     ATM \
62     AUDIT \
63     AUTHPF \
64     AUTOFS \
65     BHYVE \
66     BINUTILS \
67     BINUTILS_BOOTSTRAP \
68     BLACKLIST \
69     BLUETOOTH \
70     BOOT \
71     BOOTPARAMD \
72     BOOTPD \
73     BSD_CPIO \
74     BSDINSTALL \
75     BSNMP \
76     BZIP2 \
77     CALENDAR \
78     CAPSICUM \
79     CASPER \
80     CCD \
81     CDDL \
82     CPP \
83     CROSS_COMPILER \
84     CRYPT \
85     CTM \
86     CUSE \
87     CXX \
88     DIALOG \
89     DICT \
90     DMAGENT \
91     DYNAMICROOT \
92     ED_CRYPTO \
93     EE \
94     EFI \
95     ELFTOOLCHAIN_BOOTSTRAP \
96     EXAMPLES \
97     FDT \
98     FILE \
99     FINGER \
100     FLOPPY \
101     FMTREE \
102     FORTH \
103     FP_LIBC \
104     FREEBSD_UPDATE \
105     FTP \
106     GAMES \
107     GCOV \
108     GDB \
109     GNU_DIFF \
110     GNU_GREP \
111     GPIO \
112     HAST \
113     HTML \
114     HYPERV \
115     ICONV \
116     INET \
117     INET6 \
118     INETD \
119     IPFILTER \
120     IPFW \
121     ISCSI \
122     JAIL \
123     KDUMP \
124     KVM \
125     LDNS \
126     LDNS_UTILS \
127     LEGACY_CONSOLE \
128     LIB32 \
129     LIBPTHREAD \
130     LIBTHR \
131     LLVM_COV \
132     LOCALES \
133     LOCATE \
134     LPR \
135     LS_COLORS \
136     LZMA_SUPPORT \
137     LOADER_GELI \
138     LOADER_OFW \
139     LOADER_UBOOT \
140     MAIL \
141     MAILWRAPPER \
142     MAKE \
143     NDIS \
144     NETCAT \
145     NETGRAPH \
146     NLS_CATALOGS \
147     NS_CACHING \
148     NTP \
149     OPENSSL \
150     PAM \
151     PC_SYSINSTALL \
152     PF \
153     PKGBOOTSTRAP \
154     PMC \
155     PORTSNAP \
156     PPP \
157     QUOTAS \
158     RADIUS_SUPPORT \
159     RBOOTD \
160     RESCUE \
161     ROUTED \
162     SENDMAIL \
163     SETUID_LOGIN \
164     SHAREDOCS \
165     SOURCELESS \
166     SOURCELESS_HOST \
167     SOURCELESS_UCODE \
168     SVNLITE \
169     SYSCONS \
170     SYSTEM_COMPILER \
171     TALK \
172     TCP_WRAPPERS \
173     TCSH \
174     TELNET \
175     TEXTPROC \
176     TFTP \
177     TIMED \
178     UNBOUND \
179     USB \
180     UTMPX \
181     VI \
182     VT \
183     WIRELESS \
184     WPA_SUPPLICANT_EAPOL \
185     ZFS \
186     ZONEINFO
187
188 __DEFAULT_NO_OPTIONS = \
189     BSD_GREP \
190     BSD_GREP_FASTMATCH \
191     CLANG_EXTRAS \
192     DTRACE_TESTS \
193     GNU_GREP_COMPAT \
194     HESIOD \
195     LIBSOFT \
196     LOADER_FIREWIRE \
197     LOADER_FORCE_LE \
198     LOADER_LUA \
199     NAND \
200     OFED \
201     OPENLDAP \
202     REPRODUCIBLE_BUILD \
203     RPCBIND_WARMSTART_SUPPORT \
204     SHARED_TOOLCHAIN \
205     SORT_THREADS \
206     SVN \
207     ZONEINFO_LEAPSECONDS_SUPPORT \
208     ZONEINFO_OLD_TIMEZONES_SUPPORT \
209
210
211 #
212 # Default behaviour of some options depends on the architecture.  Unfortunately
213 # this means that we have to test TARGET_ARCH (the buildworld case) as well
214 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
215 # used at all in bsd.*.mk, but we have to make an exception here if we want
216 # to allow defaults for some things like clang to vary by target architecture.
217 # Additional, per-target behavior should be rarely added only after much
218 # gnashing of teeth and grinding of gears.
219 #
220 .if defined(TARGET_ARCH)
221 __T=${TARGET_ARCH}
222 .else
223 __T=${MACHINE_ARCH}
224 .endif
225 .if defined(TARGET)
226 __TT=${TARGET}
227 .else
228 __TT=${MACHINE}
229 .endif
230
231 .include <bsd.compiler.mk>
232 # If the compiler is not C++11 capable, disable Clang and use GCC instead.
233 # This means that architectures that have GCC 4.2 as default can not
234 # build Clang without using an external compiler.
235
236 .if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \
237     ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386")
238 # Clang is enabled, and will be installed as the default /usr/bin/cc.
239 __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD
240 __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC
241 .elif ${COMPILER_FEATURES:Mc++11} && ${__T:Mriscv*} == "" && ${__T} != "sparc64"
242 # If an external compiler that supports C++11 is used as ${CC} and Clang
243 # supports the target, then Clang is enabled but GCC is installed as the
244 # default /usr/bin/cc.
245 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX GPL_DTC
246 __DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC LLD
247 .else
248 # Everything else disables Clang, and uses GCC instead.
249 __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC
250 __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC LLD
251 .endif
252 # In-tree binutils/gcc are older versions without modern architecture support.
253 .if ${__T} == "aarch64" || ${__T:Mriscv*} != ""
254 BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
255 .endif
256 .if ${__T:Mriscv*} != ""
257 BROKEN_OPTIONS+=PROFILE # "sorry, unimplemented: profiler support for RISC-V"
258 BROKEN_OPTIONS+=TESTS   # "undefined reference to `_Unwind_Resume'"
259 BROKEN_OPTIONS+=CXX     # "libcxxrt.so: undefined reference to `_Unwind_Resume_or_Rethrow'"
260 .endif
261 .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
262     ${__T:Mriscv*} != "" || ${__TT} == "mips"
263 __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND
264 .else
265 __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND
266 .endif
267 .if ${__T} == "aarch64"
268 __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
269 .elif ${__T} == "amd64"
270 __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP
271 __DEFAULT_NO_OPTIONS+=LLD_IS_LD
272 .else
273 __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
274 .endif
275 .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386"
276 __DEFAULT_YES_OPTIONS+=LLDB
277 .else
278 __DEFAULT_NO_OPTIONS+=LLDB
279 .endif
280 # LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5
281 .if ${__T} == "arm" || ${__T} == "armeb"
282 BROKEN_OPTIONS+=LLDB
283 .endif
284 # GDB in base is generally less functional than GDB in ports.  Ports GDB
285 # does not yet contain kernel support for arm, and sparc64 kernel support
286 # has not been tested.
287 .if ${__T:Marm*} != "" || ${__T} == "sparc64"
288 __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC
289 .else
290 __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC
291 .endif
292 # Only doing soft float API stuff on armv6 and armv7
293 .if ${__T} != "armv6" && ${__T} != "armv7"
294 BROKEN_OPTIONS+=LIBSOFT
295 .endif
296 .if ${__T:Mmips*}
297 BROKEN_OPTIONS+=SSP
298 .endif
299 # EFI doesn't exist on mips, powerpc, sparc or riscv.
300 .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*}
301 BROKEN_OPTIONS+=EFI
302 .endif
303 # GELI isn't supported on !x86
304 .if ${__T} != "i386" && ${__T} != "amd64"
305 BROKEN_OPTIONS+=LOADER_GELI
306 .endif
307 # OFW is only for powerpc and sparc64, exclude others
308 .if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == ""
309 BROKEN_OPTIONS+=LOADER_OFW
310 .endif
311 # UBOOT is only for arm, mips and powerpc, exclude others
312 .if ${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == ""
313 BROKEN_OPTIONS+=LOADER_UBOOT
314 .endif
315
316 .if ${__T:Mmips64*}
317 # profiling won't work on MIPS64 because there is only assembly for o32
318 BROKEN_OPTIONS+=PROFILE
319 .endif
320 .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \
321     ${__T} == "powerpc64" || ${__T} == "sparc64"
322 __DEFAULT_YES_OPTIONS+=CXGBETOOL
323 __DEFAULT_YES_OPTIONS+=MLX5TOOL
324 .else
325 __DEFAULT_NO_OPTIONS+=CXGBETOOL
326 __DEFAULT_NO_OPTIONS+=MLX5TOOL
327 .endif
328
329 .include <bsd.mkopt.mk>
330
331 #
332 # MK_* options that default to "yes" if the compiler is a C++11 compiler.
333 #
334 .for var in \
335     LIBCPLUSPLUS
336 .if !defined(MK_${var})
337 .if ${COMPILER_FEATURES:Mc++11}
338 .if defined(WITHOUT_${var})
339 MK_${var}:=     no
340 .else
341 MK_${var}:=     yes
342 .endif
343 .else
344 .if defined(WITH_${var})
345 MK_${var}:=     yes
346 .else
347 MK_${var}:=     no
348 .endif
349 .endif
350 .endif
351 .endfor
352
353 #
354 # Force some options off if their dependencies are off.
355 # Order is somewhat important.
356 #
357 .if !${COMPILER_FEATURES:Mc++11}
358 MK_LLVM_LIBUNWIND:=     no
359 .endif
360
361 .if ${MK_BINUTILS} == "no"
362 MK_GDB:=        no
363 .endif
364
365 .if ${MK_CAPSICUM} == "no"
366 MK_CASPER:=     no
367 .endif
368
369 .if ${MK_LIBPTHREAD} == "no"
370 MK_LIBTHR:=     no
371 .endif
372
373 .if ${MK_LDNS} == "no"
374 MK_LDNS_UTILS:= no
375 MK_UNBOUND:= no
376 .endif
377
378 .if ${MK_SOURCELESS} == "no"
379 MK_SOURCELESS_HOST:=    no
380 MK_SOURCELESS_UCODE:= no
381 .endif
382
383 .if ${MK_CDDL} == "no"
384 MK_ZFS:=        no
385 MK_CTF:=        no
386 .endif
387
388 .if ${MK_CRYPT} == "no"
389 MK_OPENSSL:=    no
390 MK_OPENSSH:=    no
391 MK_KERBEROS:=   no
392 .endif
393
394 .if ${MK_CXX} == "no"
395 MK_CLANG:=      no
396 MK_GNUCXX:=     no
397 MK_TESTS:=      no
398 .endif
399
400 .if ${MK_DIALOG} == "no"
401 MK_BSDINSTALL:= no
402 .endif
403
404 .if ${MK_MAIL} == "no"
405 MK_MAILWRAPPER:= no
406 MK_SENDMAIL:=   no
407 MK_DMAGENT:=    no
408 .endif
409
410 .if ${MK_NETGRAPH} == "no"
411 MK_ATM:=        no
412 MK_BLUETOOTH:=  no
413 .endif
414
415 .if ${MK_NLS} == "no"
416 MK_NLS_CATALOGS:= no
417 .endif
418
419 .if ${MK_OPENSSL} == "no"
420 MK_OPENSSH:=    no
421 MK_KERBEROS:=   no
422 .endif
423
424 .if ${MK_PF} == "no"
425 MK_AUTHPF:=     no
426 .endif
427
428 .if ${MK_TESTS} == "no"
429 MK_DTRACE_TESTS:= no
430 .endif
431
432 .if ${MK_ZONEINFO} == "no"
433 MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
434 MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no
435 .endif
436
437 .if ${MK_CROSS_COMPILER} == "no"
438 MK_BINUTILS_BOOTSTRAP:= no
439 MK_CLANG_BOOTSTRAP:= no
440 MK_ELFTOOLCHAIN_BOOTSTRAP:= no
441 MK_GCC_BOOTSTRAP:= no
442 MK_LLD_BOOTSTRAP:= no
443 .endif
444
445 .if ${MK_TOOLCHAIN} == "no"
446 MK_BINUTILS:=   no
447 MK_CLANG:=      no
448 MK_GCC:=        no
449 MK_GDB:=        no
450 MK_INCLUDES:=   no
451 MK_LLD:=        no
452 MK_LLDB:=       no
453 .endif
454
455 .if ${MK_CLANG} == "no"
456 MK_CLANG_EXTRAS:= no
457 MK_CLANG_FULL:= no
458 MK_LLVM_COV:= no
459 .endif
460
461 #
462 # MK_* options whose default value depends on another option.
463 #
464 .for vv in \
465     GSSAPI/KERBEROS \
466     MAN_UTILS/MAN
467 .if defined(WITH_${vv:H})
468 MK_${vv:H}:=    yes
469 .elif defined(WITHOUT_${vv:H})
470 MK_${vv:H}:=    no
471 .else
472 MK_${vv:H}:=    ${MK_${vv:T}}
473 .endif
474 .endfor
475
476 #
477 # Set defaults for the MK_*_SUPPORT variables.
478 #
479
480 #
481 # MK_*_SUPPORT options which default to "yes" unless their corresponding
482 # MK_* variable is set to "no".
483 #
484 .for var in \
485     BLACKLIST \
486     BZIP2 \
487     INET \
488     INET6 \
489     KERBEROS \
490     KVM \
491     NETGRAPH \
492     PAM \
493     TESTS \
494     WIRELESS
495 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
496 MK_${var}_SUPPORT:= no
497 .else
498 MK_${var}_SUPPORT:= yes
499 .endif
500 .endfor
501
502 .if !${COMPILER_FEATURES:Mc++11}
503 MK_LLDB:=       no
504 .endif
505
506 # gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
507 # while in theory we could build it with that, we don't want to do
508 # that since it creates too much confusion for too little gain.
509 # XXX: This is incomplete and needs X_COMPILER_TYPE/VERSION checks too
510 #      to prevent Makefile.inc1 from bootstrapping unneeded dependencies
511 #      and to support 'make delete-old' when supplying an external toolchain.
512 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
513 MK_GNUCXX:=no
514 MK_GCC:=no
515 .endif
516
517 .endif #  !target(__<src.opts.mk>__)