xref: /freebsd/share/mk/src.opts.mk (revision 38d120bc13ac1de5b739b67b87016b9122149374)
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    AT \
52    ATM \
53    AUDIT \
54    AUTHPF \
55    BINUTILS \
56    BINUTILS_BOOTSTRAP \
57    BLUETOOTH \
58    BOOT \
59    BSD_CPIO \
60    BSNMP \
61    BZIP2 \
62    CALENDAR \
63    CAPSICUM \
64    CASPER \
65    CDDL \
66    CPP \
67    CROSS_COMPILER \
68    CRYPT \
69    CTM \
70    CUSE \
71    CXX \
72    DICT \
73    DMAGENT \
74    DYNAMICROOT \
75    ED_CRYPTO \
76    EXAMPLES \
77    FDT \
78    FLOPPY \
79    FMTREE \
80    FORTH \
81    FP_LIBC \
82    FREEBSD_UPDATE \
83    GAMES \
84    GCOV \
85    GDB \
86    GNU \
87    GNU_GREP_COMPAT \
88    GPIB \
89    GPIO \
90    GPL_DTC \
91    GROFF \
92    HTML \
93    HYPERV \
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    ELFTOOLCHAIN_TOOLS \
164    FMAKE \
165    HESIOD \
166    LLDB \
167    NAND \
168    OFED \
169    OPENLDAP \
170    OPENSSH_NONE_CIPHER \
171    SHARED_TOOLCHAIN \
172    SORT_THREADS \
173    SVN
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 ${__TT} == "arm" && ${__T:Marm*eb*} == ""
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" || (${__TT} == "arm" && ${__T:Marm*eb*} == "") || \
206    ${__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.include <bsd.mkopt.mk>
216
217#
218# MK_* options that default to "yes" if the compiler is a C++11 compiler.
219#
220.include <bsd.compiler.mk>
221.for var in \
222    LIBCPLUSPLUS
223.if !defined(MK_${var})
224.if ${COMPILER_FEATURES:Mc++11}
225.if defined(WITHOUT_${var})
226MK_${var}:=	no
227.else
228MK_${var}:=	yes
229.endif
230.else
231.if defined(WITH_${var})
232MK_${var}:=	yes
233.else
234MK_${var}:=	no
235.endif
236.endif
237.endif
238.endfor
239
240#
241# Force some options off if their dependencies are off.
242# Order is somewhat important.
243#
244.if ${MK_LIBPTHREAD} == "no"
245MK_LIBTHR:=	no
246.endif
247
248.if ${MK_LDNS} == "no"
249MK_LDNS_UTILS:=	no
250MK_UNBOUND:= no
251.endif
252
253.if ${MK_SOURCELESS} == "no"
254MK_SOURCELESS_HOST:=	no
255MK_SOURCELESS_UCODE:= no
256.endif
257
258.if ${MK_CDDL} == "no"
259MK_ZFS:=	no
260MK_CTF:=	no
261.endif
262
263.if ${MK_CRYPT} == "no"
264MK_OPENSSL:=	no
265MK_OPENSSH:=	no
266MK_KERBEROS:=	no
267.endif
268
269.if ${MK_CXX} == "no"
270MK_CLANG:=	no
271MK_GROFF:=	no
272MK_GNUCXX:=	no
273.endif
274
275.if ${MK_MAIL} == "no"
276MK_MAILWRAPPER:= no
277MK_SENDMAIL:=	no
278MK_DMAGENT:=	no
279.endif
280
281.if ${MK_NETGRAPH} == "no"
282MK_ATM:=	no
283MK_BLUETOOTH:=	no
284.endif
285
286.if ${MK_OPENSSL} == "no"
287MK_OPENSSH:=	no
288MK_KERBEROS:=	no
289.endif
290
291.if ${MK_PF} == "no"
292MK_AUTHPF:=	no
293.endif
294
295.if ${MK_TEXTPROC} == "no"
296MK_GROFF:=	no
297.endif
298
299.if ${MK_CROSS_COMPILER} == "no"
300MK_BINUTILS_BOOTSTRAP:= no
301MK_CLANG_BOOTSTRAP:= no
302MK_GCC_BOOTSTRAP:= no
303.endif
304
305.if ${MK_TOOLCHAIN} == "no"
306MK_BINUTILS:=	no
307MK_CLANG:=	no
308MK_GCC:=	no
309MK_GDB:=	no
310MK_INCLUDES:=	no
311.endif
312
313.if ${MK_CLANG} == "no"
314MK_CLANG_EXTRAS:= no
315MK_CLANG_FULL:= no
316.endif
317
318#
319# Set defaults for the MK_*_SUPPORT variables.
320#
321
322#
323# MK_*_SUPPORT options which default to "yes" unless their corresponding
324# MK_* variable is set to "no".
325#
326.for var in \
327    BZIP2 \
328    GNU \
329    INET \
330    INET6 \
331    KERBEROS \
332    KVM \
333    NETGRAPH \
334    PAM \
335    TESTS \
336    WIRELESS
337.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
338MK_${var}_SUPPORT:= no
339.else
340MK_${var}_SUPPORT:= yes
341.endif
342.endfor
343
344#
345# MK_* options whose default value depends on another option.
346#
347.for vv in \
348    GSSAPI/KERBEROS \
349    MAN_UTILS/MAN
350.if defined(WITH_${vv:H})
351MK_${vv:H}:=	yes
352.elif defined(WITHOUT_${vv:H})
353MK_${vv:H}:=	no
354.else
355MK_${vv:H}:=	${MK_${vv:T}}
356.endif
357.endfor
358
359.if !${COMPILER_FEATURES:Mc++11}
360MK_LLDB:=	no
361.endif
362
363# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
364# while in theory we could build it with that, we don't want to do
365# that since it creates too much confusion for too little gain.
366.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
367MK_GNUCXX:=no
368MK_GCC:=no
369.endif
370
371.endif #  !target(__<src.opts.mk>__)
372