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