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