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