freebsd-dev/sys/conf
Bryan Drewery cf1eeb33be 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 Populate new KERN_OPTS from all the opt_*.h files in 2015-02-18 15:25:19 +00:00
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 amd64: set the correct LMA values 2015-06-26 07:12:17 +00:00
ldscript.arm
ldscript.arm64 Bring in the start of the arm64 kernel. 2015-04-13 14:43:10 +00:00
ldscript.i386
ldscript.mips
ldscript.mips.cfe
ldscript.mips.mips64
ldscript.mips.octeon1
ldscript.powerpc Refactor PowerPC (especially AIM) init sequence to be less baroque. 2015-01-18 18:32:43 +00:00
ldscript.powerpc64 Refactor PowerPC (especially AIM) init sequence to be less baroque. 2015-01-18 18:32:43 +00:00
ldscript.sparc64
Makefile.amd64 Clang's 3.5 integrated assembler now handles these files correctly (it 2015-01-05 12:28:22 +00:00
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 Clang's 3.5 integrated assembler now handles these files correctly (it 2015-01-05 12:28:22 +00:00
Makefile.mips Bump the version of config to the latest (3 year old, so upgrade 2014-02-04 18:24:25 +00:00
Makefile.pc98 Fix kernel build ${MACHINE} path 2015-04-16 22:34:10 +00:00
Makefile.powerpc Make 32-bit PowerPC kernels, like 64-bit PowerPC kernels, position-independent 2015-03-07 20:14:46 +00:00
Makefile.sparc64 Bump the version of config to the latest (3 year old, so upgrade 2014-02-04 18:24:25 +00:00
makeLINT.mk
makeLINT.sed
newvers.sh newvers.sh: remove 'X' hack from shell script 2015-04-08 04:01:02 +00:00
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 Microsoft vmbus, storage and other related driver enhancements for HyperV. 2015-04-29 10:12:34 +00:00
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 Remove support for Xen PV domU kernels. Support for HVM domU kernels 2015-04-30 15:48:48 +00:00
options.mips Introduce opt_netfpga.h and allow setting NF10BMAC_64BIT from mips kernel 2014-06-26 17:20:45 +00:00
options.pc98 Reduce diffs against i386. 2014-10-04 05:03:39 +00:00
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 Retire the nve(4) driver; nfe(4) has been the default driver for NVIDIA 2014-02-16 12:22:43 +00:00
WITHOUT_SOURCELESS_UCODE Add nodevice iwmfw to WITHOUT_SOURCELESS_UCODE. 2015-08-08 20:45:47 +00:00