2014-05-09 21:11:27 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
# Options set in the build system that affect the kernel somehow.
|
|
|
|
|
|
|
|
#
|
|
|
|
# Define MK_* variables (which are either "yes" or "no") for users
|
|
|
|
# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
|
|
|
|
# make(1) environment.
|
|
|
|
# These should be tested with `== "no"' or `!= "no"' in makefiles.
|
|
|
|
# The NO_* variables should only be set by makefiles for variables
|
|
|
|
# that haven't been converted over.
|
|
|
|
#
|
|
|
|
|
2014-08-11 14:50:49 +00:00
|
|
|
# Note: bsd.own.mk must be included before the rest of kern.opts.mk to make
|
|
|
|
# building on 10.x and earlier work. This should be removed when that's no
|
|
|
|
# longer supported since it confounds the defaults (since it uses the host's
|
|
|
|
# notion of defaults rather than what's default in current when building
|
|
|
|
# within sys/modules).
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
|
2014-05-09 21:11:27 +00:00
|
|
|
# These options are used by the kernel build process (kern.mk and kmod.mk)
|
|
|
|
# They have to be listed here so we can build modules outside of the
|
|
|
|
# src tree.
|
|
|
|
|
|
|
|
__DEFAULT_YES_OPTIONS = \
|
2015-01-26 07:15:49 +00:00
|
|
|
AUTOFS \
|
2015-01-26 06:44:48 +00:00
|
|
|
BHYVE \
|
2014-08-11 14:50:49 +00:00
|
|
|
BLUETOOTH \
|
2015-01-25 04:52:48 +00:00
|
|
|
CCD \
|
2014-08-11 14:50:49 +00:00
|
|
|
CDDL \
|
|
|
|
CRYPT \
|
2015-01-25 05:13:15 +00:00
|
|
|
CUSE \
|
2014-05-10 00:42:43 +00:00
|
|
|
FORMAT_EXTENSIONS \
|
2014-08-04 22:37:02 +00:00
|
|
|
INET \
|
|
|
|
INET6 \
|
2014-08-11 14:50:49 +00:00
|
|
|
IPFILTER \
|
2015-01-25 04:20:11 +00:00
|
|
|
ISCSI \
|
2014-08-11 14:50:49 +00:00
|
|
|
KERNEL_SYMBOLS \
|
|
|
|
NETGRAPH \
|
|
|
|
PF \
|
|
|
|
SOURCELESS_HOST \
|
|
|
|
SOURCELESS_UCODE \
|
|
|
|
USB_GADGET_EXAMPLES \
|
|
|
|
ZFS
|
|
|
|
|
|
|
|
__DEFAULT_NO_OPTIONS = \
|
|
|
|
EISA \
|
Add a FAST_DEPEND option, off by default, which speeds up the build significantly.
This speeds up buildworld by 16% on my system and buildkernel by 35%.
Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation. This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang. (It appears that ICC also supports this but I
do not have access to test it). This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'. This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.
For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected. In time this may change but for now
I've been conservative. The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant. For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.
A .depend file is still generated with the various rules that apply to
the final target, or custom rules. Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o. These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.
Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.
The -M flags are removed from CFLAGS when linking since they have no effect.
Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16
buildworld:
x buildworld-before
+ buildworld-fastdep
+-------------------------------------------------------------------------------+
|+ |
|+ |
|+ xx x|
| |_MA___||
|A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)
buildkernel:
x buildkernel-before
+ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|+ x |
|++ xx|
| A||
|A| |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)
Sponsored by: EMC / Isilon Storage Division
MFC after: 3 weeks
Relnotes: yes
2015-11-06 04:45:29 +00:00
|
|
|
FAST_DEPEND \
|
2014-08-11 14:50:49 +00:00
|
|
|
NAND \
|
|
|
|
OFED
|
2014-05-09 21:11:27 +00:00
|
|
|
|
2015-03-12 03:57:19 +00:00
|
|
|
# Some options are totally broken on some architectures. We disable
|
|
|
|
# them. If you need to enable them on an experimental basis, you
|
|
|
|
# must change this code.
|
2015-03-27 17:36:22 +00:00
|
|
|
# Note: These only apply to the list of modules we build by default
|
|
|
|
# and sometimes what is in the opt_*.h files by default.
|
|
|
|
# Kernel config files are unaffected, though some targets can be
|
|
|
|
# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
|
2015-03-12 03:57:19 +00:00
|
|
|
|
|
|
|
# Things that don't work based on the CPU
|
|
|
|
.if ${MACHINE_CPUARCH} == "arm"
|
2015-11-20 16:18:27 +00:00
|
|
|
BROKEN_OPTIONS+= ZFS
|
|
|
|
. if ${MACHINE_ARCH:Marmv6*} == ""
|
|
|
|
BROKEN_OPTIONS+= CDDL
|
|
|
|
. endif
|
2015-03-12 03:57:19 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${MACHINE_CPUARCH} == "mips"
|
|
|
|
BROKEN_OPTIONS+= CDDL ZFS
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} == "powerpc"
|
|
|
|
BROKEN_OPTIONS+= ZFS
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Things that don't work because the kernel doesn't have the support
|
|
|
|
# for them.
|
|
|
|
.if ${MACHINE} != "i386"
|
|
|
|
BROKEN_OPTIONS+= EISA
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${MACHINE} != "i386" && ${MACHINE} != "amd64"
|
|
|
|
BROKEN_OPTIONS+= OFED
|
|
|
|
.endif
|
|
|
|
|
2014-08-11 14:50:49 +00:00
|
|
|
# expanded inline from bsd.mkopt.mk to avoid share/mk dependency
|
2014-05-09 21:11:27 +00:00
|
|
|
|
2014-08-11 14:50:49 +00:00
|
|
|
# Those that default to yes
|
2014-05-17 20:31:34 +00:00
|
|
|
.for var in ${__DEFAULT_YES_OPTIONS}
|
|
|
|
.if !defined(MK_${var})
|
|
|
|
.if defined(WITHOUT_${var}) # WITHOUT always wins
|
|
|
|
MK_${var}:= no
|
2014-05-11 23:22:32 +00:00
|
|
|
.else
|
2014-05-17 20:31:34 +00:00
|
|
|
MK_${var}:= yes
|
2014-05-11 23:22:32 +00:00
|
|
|
.endif
|
2015-02-09 16:03:55 +00:00
|
|
|
.else
|
|
|
|
.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
|
|
|
|
.error "Illegal value for MK_${var}: ${MK_${var}}"
|
2014-05-17 20:31:34 +00:00
|
|
|
.endif
|
2015-02-09 16:03:55 +00:00
|
|
|
.endif # !defined(MK_${var})
|
2014-05-17 20:31:34 +00:00
|
|
|
.endfor
|
|
|
|
.undef __DEFAULT_YES_OPTIONS
|
2014-08-04 22:37:02 +00:00
|
|
|
|
2014-08-11 14:50:49 +00:00
|
|
|
# Those that default to no
|
|
|
|
.for var in ${__DEFAULT_NO_OPTIONS}
|
|
|
|
.if !defined(MK_${var})
|
|
|
|
.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
|
|
|
|
MK_${var}:= yes
|
|
|
|
.else
|
|
|
|
MK_${var}:= no
|
|
|
|
.endif
|
2015-02-09 16:03:55 +00:00
|
|
|
.else
|
|
|
|
.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
|
|
|
|
.error "Illegal value for MK_${var}: ${MK_${var}}"
|
2014-08-11 14:50:49 +00:00
|
|
|
.endif
|
2015-02-09 16:03:55 +00:00
|
|
|
.endif # !defined(MK_${var})
|
2014-08-11 14:50:49 +00:00
|
|
|
.endfor
|
|
|
|
.undef __DEFAULT_NO_OPTIONS
|
|
|
|
|
2015-03-12 03:57:00 +00:00
|
|
|
#
|
|
|
|
# MK_* options which are always no, usually because they are
|
|
|
|
# unsupported/badly broken on this architecture.
|
|
|
|
#
|
|
|
|
.for var in ${BROKEN_OPTIONS}
|
|
|
|
MK_${var}:= no
|
|
|
|
.endfor
|
|
|
|
.undef BROKEN_OPTIONS
|
|
|
|
#end of bsd.mkopt.mk expanded inline.
|
|
|
|
|
2014-08-04 22:37:02 +00:00
|
|
|
#
|
|
|
|
# MK_*_SUPPORT options which default to "yes" unless their corresponding
|
|
|
|
# MK_* variable is set to "no".
|
|
|
|
#
|
|
|
|
.for var in \
|
|
|
|
INET \
|
|
|
|
INET6
|
|
|
|
.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
|
|
|
|
MK_${var}_SUPPORT:= no
|
|
|
|
.else
|
2014-11-14 21:10:45 +00:00
|
|
|
.if defined(KERNBUILDDIR) # See if there's an opt_foo.h
|
|
|
|
OPT_${var}!= cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
|
|
|
|
.if ${OPT_${var}} == "" # nothing -> no
|
|
|
|
MK_${var}_SUPPORT:= no
|
|
|
|
.else
|
|
|
|
MK_${var}_SUPPORT:= yes
|
|
|
|
.endif
|
|
|
|
.else # otherwise, yes
|
2014-08-04 22:37:02 +00:00
|
|
|
MK_${var}_SUPPORT:= yes
|
|
|
|
.endif
|
2014-11-14 21:10:45 +00:00
|
|
|
.endif
|
2014-08-04 22:37:02 +00:00
|
|
|
.endfor
|