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