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