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