xref: /freebsd/share/mk/bsd.opts.mk (revision 6a3095aa6d0350dda89bac66d26f22a01e2257c4)
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 (usually) sensible 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.mkopt.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)
34#
35# Define MK_* variables (which are either "yes" or "no") for users
36# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
37# make(1) environment.
38# These should be tested with `== "no"' or `!= "no"' in makefiles.
39# The NO_* variables should only be set by makefiles for variables
40# that haven't been converted over.
41#
42
43# Only these options are used by bsd.*.mk. KERBEROS and OPENSSH are
44# unfortunately needed to support statically linking the entire
45# tree. su(1) wouldn't link since it depends on PAM which depends on
46# ssh libraries when building with OPENSSH, and likewise for KERBEROS.
47
48# All other variables used to build /usr/src live in src.opts.mk
49# and variables from both files are documented in src.conf(5).
50
51__DEFAULT_YES_OPTIONS = \
52    ASSERT_DEBUG \
53    DEBUG_FILES \
54    DOCCOMPRESS \
55    INCLUDES \
56    INSTALLLIB \
57    KERBEROS \
58    MAKE_CHECK_USE_SANDBOX \
59    MAN \
60    MANCOMPRESS \
61    NIS \
62    NLS \
63    OPENSSH \
64    PROFILE \
65    SSP \
66    TESTS \
67    TOOLCHAIN \
68    WARNS \
69    WERROR
70
71__DEFAULT_NO_OPTIONS = \
72    BIND_NOW \
73    CCACHE_BUILD \
74    CTF \
75    INIT_ALL_PATTERN \
76    INIT_ALL_ZERO \
77    INSTALL_AS_USER \
78    RETPOLINE \
79    STALE_STAGED
80
81__DEFAULT_DEPENDENT_OPTIONS = \
82    MAKE_CHECK_USE_SANDBOX/TESTS \
83    STAGING_MAN/STAGING \
84    STAGING_PROG/STAGING \
85    STALE_STAGED/STAGING \
86
87#
88# Default to disabling PIE on 32-bit architectures. The small address space
89# means that ASLR is of limited effectiveness, and it may cause issues with
90# some memory-hungry workloads.
91#
92.if ${MACHINE_ARCH} == "armv6" || ${MACHINE_ARCH} == "armv7" \
93    || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "mips" \
94    || ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipselhf" \
95    || ${MACHINE_ARCH} == "mipshf" || ${MACHINE_ARCH} == "mipsn32" \
96    || ${MACHINE_ARCH} == "mipsn32el" || ${MACHINE_ARCH} == "powerpc" \
97    || ${MACHINE_ARCH} == "powerpcspe"
98__DEFAULT_NO_OPTIONS+= PIE
99.else
100__DEFAULT_YES_OPTIONS+=PIE
101.endif
102
103.include <bsd.mkopt.mk>
104
105.if ${MK_INIT_ALL_PATTERN} == "yes" && ${MK_INIT_ALL_ZERO} == "yes"
106.warning WITH_INIT_ALL_PATTERN and WITH_INIT_ALL_ZERO are mutually exclusive.
107.endif
108
109#
110# Supported NO_* options (if defined, MK_* will be forced to "no",
111# regardless of user's setting).
112#
113# These are transitional and will disappaer in the FreeBSD 12.
114#
115.for var in \
116    CTF \
117    DEBUG_FILES \
118    INSTALLLIB \
119    MAN \
120    PROFILE \
121    WARNS \
122    WERROR
123.if defined(NO_${var})
124.error "NO_${var} is defined, but deprecated. Please use MK_${var}=no instead."
125MK_${var}:=no
126.endif
127.endfor
128
129.include <bsd.cpu.mk>
130
131.endif # !_WITHOUT_SRCCONF
132
133.endif
134