xref: /freebsd/share/mk/bsd.opts.mk (revision 8e1e989c77d4e35ddc5ca3c143553f973c4a1764)
16a542ebeSWarner Losh#
2e0281204SWarner Losh# Option file for bmake builds. These options are available to all users of
3e0281204SWarner Losh# bmake (including the source tree userland and kernel builds). They generally
4e0281204SWarner Losh# control how binaries are made, shared vs dynamic, etc and some general options
5e0281204SWarner Losh# relevant for all build environments.
66a542ebeSWarner Losh#
76a542ebeSWarner Losh# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
86a542ebeSWarner Losh# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
9f117e4e1SEnji Cooper# with (usually) sensible defaults.
106a542ebeSWarner Losh#
116a542ebeSWarner Losh# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
126a542ebeSWarner Losh# are applicable for that Makefile (typically there are none, but sometimes there
136a542ebeSWarner Losh# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
146a542ebeSWarner Losh# to omit from that make.
156a542ebeSWarner Losh#
161fc86460SWarner Losh# Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
176a542ebeSWarner Losh# variable.
186a542ebeSWarner Losh#
196a542ebeSWarner Losh# Makefiles may also assume that this file is included by bsd.own.mk should it
206a542ebeSWarner Losh# need variables defined there prior to the end of the Makefile where
216a542ebeSWarner Losh# bsd.{subdir,lib.bin}.mk is traditionally included.
226a542ebeSWarner Losh#
236a542ebeSWarner Losh# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
246a542ebeSWarner Losh# should be added. Old instances should be removed since they were just to
256a542ebeSWarner Losh# bridge the gap between FreeBSD 4 and FreeBSD 5.
266a542ebeSWarner Losh#
276a542ebeSWarner Losh# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
286a542ebeSWarner Losh# exception is made for _WITHOUT_SRCONF which turns off this mechanism
296a542ebeSWarner Losh# completely).
306a542ebeSWarner Losh#
316a542ebeSWarner Losh
326a542ebeSWarner Losh.if !target(__<bsd.opts.mk>__)
33cf5f0744SSimon J. Gerraty__<bsd.opts.mk>__:	.NOTMAIN
346a542ebeSWarner Losh
356a542ebeSWarner Losh.if !defined(_WITHOUT_SRCCONF)
366a542ebeSWarner Losh#
376a542ebeSWarner Losh# Define MK_* variables (which are either "yes" or "no") for users
386a542ebeSWarner Losh# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
396a542ebeSWarner Losh# make(1) environment.
406a542ebeSWarner Losh# These should be tested with `== "no"' or `!= "no"' in makefiles.
416a542ebeSWarner Losh# The NO_* variables should only be set by makefiles for variables
426a542ebeSWarner Losh# that haven't been converted over.
436a542ebeSWarner Losh#
446a542ebeSWarner Losh
45e23dd3b2SWarner Losh# Only these options are used by bsd.*.mk. KERBEROS and OPENSSH are
46f117e4e1SEnji Cooper# unfortunately needed to support statically linking the entire
47e23dd3b2SWarner Losh# tree. su(1) wouldn't link since it depends on PAM which depends on
48e23dd3b2SWarner Losh# ssh libraries when building with OPENSSH, and likewise for KERBEROS.
49e23dd3b2SWarner Losh
50e23dd3b2SWarner Losh# All other variables used to build /usr/src live in src.opts.mk
51e23dd3b2SWarner Losh# and variables from both files are documented in src.conf(5).
527061d085SWarner Losh
537061d085SWarner Losh__DEFAULT_YES_OPTIONS = \
547061d085SWarner Losh    ASSERT_DEBUG \
55015dfda6SEd Maste    DEBUG_FILES \
567ecf742eSWarner Losh    DOCCOMPRESS \
57590461a4SWarner Losh    INCLUDES \
587061d085SWarner Losh    INSTALLLIB \
597061d085SWarner Losh    KERBEROS \
6038f8fddfSEnji Cooper    MAKE_CHECK_USE_SANDBOX \
617061d085SWarner Losh    MAN \
627061d085SWarner Losh    MANCOMPRESS \
6374da9c39SDoug Rabson    MANSPLITPKG \
647061d085SWarner Losh    NIS \
656f9f01a2SWarner Losh    NLS \
667061d085SWarner Losh    OPENSSH \
672f3a9614SEd Maste    RELRO \
687061d085SWarner Losh    SSP \
6938f8fddfSEnji Cooper    TESTS \
70ab72ce6bSWarner Losh    TOOLCHAIN \
717fa2f2a6SAlex Richardson    WARNS \
727fa2f2a6SAlex Richardson    WERROR
737061d085SWarner Losh
747061d085SWarner Losh__DEFAULT_NO_OPTIONS = \
757bc797e3SAlex Richardson    ASAN \
76bf81eb3cSEd Maste    BIND_NOW \
7782854693SAndrew Turner    BRANCH_PROTECTION \
789160419cSBryan Drewery    CCACHE_BUILD \
797061d085SWarner Losh    CTF \
80ccfb9654SSimon J. Gerraty    INSTALL_AS_USER \
81fc191b11SEd Maste    RETPOLINE \
82*8e1e989cSSimon J. Gerraty    RUN_TESTS \
837bc797e3SAlex Richardson    STALE_STAGED \
846edb14c0SBrooks Davis    UBSAN \
852a44cccdSAlexander Leidinger    UNDEFINED_VERSION \
862a44cccdSAlexander Leidinger    ZEROREGS
877061d085SWarner Losh
88b17ff922SSimon J. Gerraty__DEFAULT_DEPENDENT_OPTIONS = \
8938f8fddfSEnji Cooper    MAKE_CHECK_USE_SANDBOX/TESTS \
901e344376SSimon J. Gerraty    STAGING_MAN/STAGING \
91ccfb9654SSimon J. Gerraty    STAGING_PROG/STAGING \
925f65e20cSEnji Cooper    STALE_STAGED/STAGING \
937061d085SWarner Losh
949a227a2fSMarcin Wojtas#
959a227a2fSMarcin Wojtas# Default to disabling PIE on 32-bit architectures. The small address space
969a227a2fSMarcin Wojtas# means that ASLR is of limited effectiveness, and it may cause issues with
979a227a2fSMarcin Wojtas# some memory-hungry workloads.
989a227a2fSMarcin Wojtas#
9906999c8aSAndrew Turner.if ${MACHINE_ARCH} == "armv7" \
100d889875bSWarner Losh    || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" \
1019a227a2fSMarcin Wojtas    || ${MACHINE_ARCH} == "powerpcspe"
1029a227a2fSMarcin Wojtas__DEFAULT_NO_OPTIONS+= PIE
1039a227a2fSMarcin Wojtas.else
1049a227a2fSMarcin Wojtas__DEFAULT_YES_OPTIONS+=PIE
1059a227a2fSMarcin Wojtas.endif
10670ca9ec4SBryan Drewery
10782854693SAndrew Turner.if ${MACHINE_CPUARCH} != "aarch64"
10882854693SAndrew TurnerBROKEN_OPTIONS+=	BRANCH_PROTECTION
10982854693SAndrew Turner.endif
11082854693SAndrew Turner
1112befa269SBrooks Davis__SINGLE_OPTIONS = \
1122befa269SBrooks Davis   INIT_ALL
1132befa269SBrooks Davis
1142befa269SBrooks Davis__INIT_ALL_OPTIONS=	none pattern zero
1152befa269SBrooks Davis__INIT_ALL_DEFAULT=	none
1162befa269SBrooks Davis
11748e733eeSSimon J. Gerraty.-include <local.opts.mk>
11848e733eeSSimon J. Gerraty
1197061d085SWarner Losh.include <bsd.mkopt.mk>
1207061d085SWarner Losh
1219ca54343SWarner Losh.include <bsd.cpu.mk>
1229ca54343SWarner Losh
1236a542ebeSWarner Losh.endif # !_WITHOUT_SRCCONF
1246a542ebeSWarner Losh
1256a542ebeSWarner Losh.endif
126