freebsd-skq/sys/conf
bdrewery a175970362 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
..
config.mk
dtb.mk Do as r289391 did for share/mk and make installing to a non-existent directory 2015-10-17 05:49:07 +00:00
files Finish process of moving the LinuxKPI module into the default kernel build. 2015-10-29 08:28:39 +00:00
files.amd64 Move kbd.c to main sys/conf/files list 2015-09-21 17:31:11 +00:00
files.arm Add libkern ffsll() for parity with flsll() 2015-10-22 20:28:37 +00:00
files.arm64 Fix the open solaris atomic functions on arm64. Without this we may use the 2015-11-05 16:55:27 +00:00
files.i386 Add libkern ffsll() for parity with flsll() 2015-10-22 20:28:37 +00:00
files.mips Add libkern ffsll() for parity with flsll() 2015-10-22 20:28:37 +00:00
files.pc98 Add libkern ffsll() for parity with flsll() 2015-10-22 20:28:37 +00:00
files.powerpc Add libkern ffsll() for parity with flsll() 2015-10-22 20:28:37 +00:00
files.sparc64 Add libkern ffsll() for parity with flsll() 2015-10-22 20:28:37 +00:00
kern.mk Build changes that allow the modules on arm64. 2015-10-08 17:42:08 +00:00
kern.opts.mk Add a FAST_DEPEND option, off by default, which speeds up the build significantly. 2015-11-06 04:45:29 +00:00
kern.post.mk Add a FAST_DEPEND option, off by default, which speeds up the build significantly. 2015-11-06 04:45:29 +00:00
kern.pre.mk Finish process of moving the LinuxKPI module into the default kernel build. 2015-10-29 08:28:39 +00:00
kmod_syms.awk
kmod.mk Do as r289391 did for share/mk and make installing to a non-existent directory 2015-10-17 05:49:07 +00:00
ldscript.amd64
ldscript.arm
ldscript.arm64
ldscript.i386
ldscript.mips
ldscript.mips.cfe
ldscript.mips.mips64
ldscript.mips.octeon1
ldscript.powerpc
ldscript.powerpc64
ldscript.sparc64
Makefile.amd64
Makefile.arm Change md(4) to use weak symbols as start, end and size for the embedded 2015-08-13 15:16:34 +00:00
Makefile.arm64 Build changes that allow the modules on arm64. 2015-10-08 17:42:08 +00:00
Makefile.i386
Makefile.mips
Makefile.pc98
Makefile.powerpc
Makefile.sparc64
makeLINT.mk
makeLINT.sed
newvers.sh
NOTES Finish process of moving the LinuxKPI module into the default kernel build. 2015-10-29 08:28:39 +00:00
options Rename linuxapi[.ko] into linuxkpi[.ko], to reflect that it is a 2015-10-22 09:50:45 +00:00
options.amd64
options.arm Import ARM_INTRNG, the "next generation" interrupt architecture for arm 2015-10-18 18:26:19 +00:00
options.arm64 Add the SOC_HISI_HI6220 option. This will be used to enable drivers for 2015-08-26 18:09:17 +00:00
options.i386
options.mips
options.pc98
options.powerpc Create a RouterBoard platform and use it to create a flash map 2015-08-22 05:50:18 +00:00
options.sparc64
systags.sh
WITHOUT_SOURCELESS
WITHOUT_SOURCELESS_HOST
WITHOUT_SOURCELESS_UCODE Add nodevice iwmfw to WITHOUT_SOURCELESS_UCODE. 2015-08-08 20:45:47 +00:00