xref: /freebsd/share/mk/bsd.opts.mk (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
1# $FreeBSD$
2#
3# Option file for bmake builds. These options are available to all users of
4# bmake (including the source tree userland and kernel builds). They generally
5# control how binaries are made, shared vs dynamic, etc and some general options
6# relevant for all build environments.
7#
8# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
9# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
10# with (usually) sensible defaults.
11#
12# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
13# are applicable for that Makefile (typically there are none, but sometimes there
14# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
15# to omit from that make.
16#
17# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
18# variable.
19#
20# Makefiles may also assume that this file is included by bsd.own.mk should it
21# need variables defined there prior to the end of the Makefile where
22# bsd.{subdir,lib.bin}.mk is traditionally included.
23#
24# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
25# should be added. Old instances should be removed since they were just to
26# bridge the gap between FreeBSD 4 and FreeBSD 5.
27#
28# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
29# exception is made for _WITHOUT_SRCONF which turns off this mechanism
30# completely).
31#
32
33.if !target(__<bsd.opts.mk>__)
34__<bsd.opts.mk>__:
35
36.if !defined(_WITHOUT_SRCCONF)
37#
38# Define MK_* variables (which are either "yes" or "no") for users
39# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
40# make(1) environment.
41# These should be tested with `== "no"' or `!= "no"' in makefiles.
42# The NO_* variables should only be set by makefiles for variables
43# that haven't been converted over.
44#
45
46# Only these options are used by bsd.*.mk. KERBEROS and OPENSSH are
47# unfortunately needed to support statically linking the entire
48# tree. su(1) wouldn't link since it depends on PAM which depends on
49# ssh libraries when building with OPENSSH, and likewise for KERBEROS.
50
51# All other variables used to build /usr/src live in src.opts.mk
52# and variables from both files are documented in src.conf(5).
53
54__DEFAULT_YES_OPTIONS = \
55    ASSERT_DEBUG \
56    DEBUG_FILES \
57    DOCCOMPRESS \
58    INCLUDES \
59    INSTALLLIB \
60    KERBEROS \
61    MAKE_CHECK_USE_SANDBOX \
62    MAN \
63    MANCOMPRESS \
64    NIS \
65    NLS \
66    OPENSSH \
67    RELRO \
68    SSP \
69    TESTS \
70    TOOLCHAIN \
71    WARNS \
72    WERROR
73
74__DEFAULT_NO_OPTIONS = \
75    ASAN \
76    BIND_NOW \
77    CCACHE_BUILD \
78    CTF \
79    INIT_ALL_PATTERN \
80    INIT_ALL_ZERO \
81    INSTALL_AS_USER \
82    MANSPLITPKG \
83    PROFILE \
84    RETPOLINE \
85    STALE_STAGED \
86    UBSAN
87
88__DEFAULT_DEPENDENT_OPTIONS = \
89    MAKE_CHECK_USE_SANDBOX/TESTS \
90    STAGING_MAN/STAGING \
91    STAGING_PROG/STAGING \
92    STALE_STAGED/STAGING \
93
94#
95# Default to disabling PIE on 32-bit architectures. The small address space
96# means that ASLR is of limited effectiveness, and it may cause issues with
97# some memory-hungry workloads.
98#
99.if ${MACHINE_ARCH} == "armv6" || ${MACHINE_ARCH} == "armv7" \
100    || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" \
101    || ${MACHINE_ARCH} == "powerpcspe"
102__DEFAULT_NO_OPTIONS+= PIE
103.else
104__DEFAULT_YES_OPTIONS+=PIE
105.endif
106
107.include <bsd.mkopt.mk>
108
109.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes"
110.warning WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive.
111.endif
112
113#
114# Supported NO_* options (if defined, MK_* will be forced to "no",
115# regardless of user's setting).
116#
117# These are transitional and will disappaer in the FreeBSD 12.
118#
119.for var in \
120    CTF \
121    DEBUG_FILES \
122    INSTALLLIB \
123    MAN \
124    PROFILE \
125    WARNS \
126    WERROR
127.if defined(NO_${var})
128.error NO_${var} is defined, but deprecated. Please use MK_${var}=no instead.
129MK_${var}:=no
130.endif
131.endfor
132
133.include <bsd.cpu.mk>
134
135.endif # !_WITHOUT_SRCCONF
136
137.endif
138