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