xref: /freebsd/share/mk/src.opts.mk (revision 40a8ac8f62b535d30349faf28cf47106b7041b83)
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.srcpot.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    ARM_EABI \
52    AT \
53    ATM \
54    AUDIT \
55    AUTHPF \
56    BINUTILS \
57    BINUTILS_BOOTSTRAP \
58    BLUETOOTH \
59    BOOT \
60    BSD_CPIO \
61    BSNMP \
62    BZIP2 \
63    CALENDAR \
64    CAPSICUM \
65    CASPER \
66    CDDL \
67    CPP \
68    CROSS_COMPILER \
69    CRYPT \
70    CTM \
71    CUSE \
72    CXX \
73    DICT \
74    DMAGENT \
75    DYNAMICROOT \
76    ED_CRYPTO \
77    EXAMPLES \
78    FDT \
79    FLOPPY \
80    FMTREE \
81    FORTH \
82    FP_LIBC \
83    FREEBSD_UPDATE \
84    GAMES \
85    GCOV \
86    GDB \
87    GNU \
88    GNU_GREP_COMPAT \
89    GPIB \
90    GPIO \
91    GPL_DTC \
92    GROFF \
93    HTML \
94    ICONV \
95    INET \
96    INET6 \
97    IPFILTER \
98    IPFW \
99    JAIL \
100    KDUMP \
101    KVM \
102    LDNS \
103    LDNS_UTILS \
104    LEGACY_CONSOLE \
105    LIB32 \
106    LIBPTHREAD \
107    LIBTHR \
108    LOCALES \
109    LOCATE \
110    LPR \
111    LS_COLORS \
112    LZMA_SUPPORT \
113    MAIL \
114    MAILWRAPPER \
115    MAKE \
116    NDIS \
117    NETCAT \
118    NETGRAPH \
119    NLS_CATALOGS \
120    NS_CACHING \
121    NTP \
122    OPENSSL \
123    PAM \
124    PC_SYSINSTALL \
125    PF \
126    PKGBOOTSTRAP \
127    PMC \
128    PORTSNAP \
129    PPP \
130    QUOTAS \
131    RCMDS \
132    RCS \
133    RESCUE \
134    ROUTED \
135    SENDMAIL \
136    SETUID_LOGIN \
137    SHAREDOCS \
138    SOURCELESS \
139    SOURCELESS_HOST \
140    SOURCELESS_UCODE \
141    SVNLITE \
142    SYSCALL_COMPAT \
143    SYSCONS \
144    SYSINSTALL \
145    TCSH \
146    TELNET \
147    TESTS \
148    TEXTPROC \
149    UNBOUND \
150    USB \
151    UTMPX \
152    VI \
153    VT \
154    WIRELESS \
155    WPA_SUPPLICANT_EAPOL \
156    ZFS \
157    ZONEINFO
158
159__DEFAULT_NO_OPTIONS = \
160    BSD_GREP \
161    CLANG_EXTRAS \
162    EISA \
163    FMAKE \
164    HESIOD \
165    LLDB \
166    NAND \
167    OFED \
168    OPENLDAP \
169    OPENSSH_NONE_CIPHER \
170    SHARED_TOOLCHAIN \
171    SORT_THREADS \
172    SVN \
173    USB_GADGET_EXAMPLES
174
175#
176# Default behaviour of some options depends on the architecture.  Unfortunately
177# this means that we have to test TARGET_ARCH (the buildworld case) as well
178# as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
179# used at all in bsd.*.mk, but we have to make an exception here if we want
180# to allow defaults for some things like clang to vary by target architecture.
181# Additional, per-target behavior should be rarely added only after much
182# gnashing of teeth and grinding of gears.
183#
184.if defined(TARGET_ARCH)
185__T=${TARGET_ARCH}
186.else
187__T=${MACHINE_ARCH}
188.endif
189.if defined(TARGET)
190__TT=${TARGET}
191.else
192__TT=${MACHINE}
193.endif
194# Clang is only for x86, powerpc and little-endian arm right now, by default.
195.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
196__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
197.elif ${__T} == "arm" || ${__T} == "armv6" || ${__T} == "armv6hf"
198__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP
199# GCC is unable to build the full clang on arm, disable it by default.
200__DEFAULT_NO_OPTIONS+=CLANG_FULL
201.else
202__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
203.endif
204# Clang the default system compiler only on little-endian arm and x86.
205.if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
206    ${__T} == "armv6hf" || ${__T} == "i386"
207__DEFAULT_YES_OPTIONS+=CLANG_IS_CC
208__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
209.else
210# If clang is not cc, then build gcc by default
211__DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP
212__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
213.endif
214
215# HyperV is only available for x86 and amd64.
216.if ${__T} == "amd64" || ${__T} == "i386"
217__DEFAULT_YES_OPTIONS+=HYPERV
218.else
219__DEFAULT_NO_OPTIONS+=HYPERV
220.endif
221
222.include <bsd.mkopt.mk>
223
224#
225# MK_* options that default to "yes" if the compiler is a C++11 compiler.
226#
227.include <bsd.compiler.mk>
228.for var in \
229    LIBCPLUSPLUS
230.if !defined(MK_${var})
231.if ${COMPILER_FEATURES:Mc++11}
232.if defined(WITHOUT_${var})
233MK_${var}:=	no
234.else
235MK_${var}:=	yes
236.endif
237.else
238.if defined(WITH_${var})
239MK_${var}:=	yes
240.else
241MK_${var}:=	no
242.endif
243.endif
244.endif
245.endfor
246
247#
248# Force some options off if their dependencies are off.
249# Order is somewhat important.
250#
251.if ${MK_LIBPTHREAD} == "no"
252MK_LIBTHR:=	no
253.endif
254
255.if ${MK_LDNS} == "no"
256MK_LDNS_UTILS:=	no
257MK_UNBOUND:= no
258.endif
259
260.if ${MK_SOURCELESS} == "no"
261MK_SOURCELESS_HOST:=	no
262MK_SOURCELESS_UCODE:= no
263.endif
264
265.if ${MK_CDDL} == "no"
266MK_ZFS:=	no
267MK_CTF:=	no
268.endif
269
270.if ${MK_CRYPT} == "no"
271MK_OPENSSL:=	no
272MK_OPENSSH:=	no
273MK_KERBEROS:=	no
274.endif
275
276.if ${MK_CXX} == "no"
277MK_CLANG:=	no
278MK_GROFF:=	no
279MK_GNUCXX:=	no
280.endif
281
282.if ${MK_MAIL} == "no"
283MK_MAILWRAPPER:= no
284MK_SENDMAIL:=	no
285MK_DMAGENT:=	no
286.endif
287
288.if ${MK_NETGRAPH} == "no"
289MK_ATM:=	no
290MK_BLUETOOTH:=	no
291.endif
292
293.if ${MK_OPENSSL} == "no"
294MK_OPENSSH:=	no
295MK_KERBEROS:=	no
296.endif
297
298.if ${MK_PF} == "no"
299MK_AUTHPF:=	no
300.endif
301
302.if ${MK_TEXTPROC} == "no"
303MK_GROFF:=	no
304.endif
305
306.if ${MK_CROSS_COMPILER} == "no"
307MK_BINUTILS_BOOTSTRAP:= no
308MK_CLANG_BOOTSTRAP:= no
309MK_GCC_BOOTSTRAP:= no
310.endif
311
312.if ${MK_TOOLCHAIN} == "no"
313MK_BINUTILS:=	no
314MK_CLANG:=	no
315MK_GCC:=	no
316MK_GDB:=	no
317.endif
318
319.if ${MK_CLANG} == "no"
320MK_CLANG_EXTRAS:= no
321MK_CLANG_FULL:= no
322.endif
323
324#
325# Set defaults for the MK_*_SUPPORT variables.
326#
327
328#
329# MK_*_SUPPORT options which default to "yes" unless their corresponding
330# MK_* variable is set to "no".
331#
332.for var in \
333    BZIP2 \
334    GNU \
335    INET \
336    INET6 \
337    KERBEROS \
338    KVM \
339    NETGRAPH \
340    PAM \
341    WIRELESS
342.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
343MK_${var}_SUPPORT:= no
344.else
345MK_${var}_SUPPORT:= yes
346.endif
347.endfor
348
349#
350# MK_* options whose default value depends on another option.
351#
352.for vv in \
353    GSSAPI/KERBEROS \
354    MAN_UTILS/MAN
355.if defined(WITH_${vv:H})
356MK_${vv:H}:=	yes
357.elif defined(WITHOUT_${vv:H})
358MK_${vv:H}:=	no
359.else
360MK_${vv:H}:=	${MK_${vv:T}}
361.endif
362.endfor
363
364.if !${COMPILER_FEATURES:Mc++11}
365MK_LLDB:=	no
366.endif
367
368.endif
369