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