1999-08-28 00:22:10 +00:00
|
|
|
# $FreeBSD$
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# The include file <bsd.dep.mk> handles Makefile dependencies.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# +++ variables +++
|
|
|
|
#
|
2016-02-16 19:11:17 +00:00
|
|
|
# CLEANDEPENDDIRS Additional directories to remove for the cleandepend
|
|
|
|
# target.
|
|
|
|
#
|
|
|
|
# CLEANDEPENDFILES Additional files to remove for the cleandepend target.
|
|
|
|
#
|
2002-10-17 13:48:13 +00:00
|
|
|
# CTAGS A tags file generation program [gtags]
|
|
|
|
#
|
|
|
|
# CTAGSFLAGS Options for ctags(1) [not set]
|
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# DEPENDFILE dependencies file [.depend]
|
|
|
|
#
|
2002-10-17 13:48:13 +00:00
|
|
|
# GTAGSFLAGS Options for gtags(1) [-o]
|
|
|
|
#
|
|
|
|
# HTAGSFLAGS Options for htags(1) [not set]
|
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# MKDEP Options for ${MKDEPCMD} [not set]
|
|
|
|
#
|
|
|
|
# MKDEPCMD Makefile dependency list program [mkdep]
|
2005-01-06 11:12:43 +00:00
|
|
|
#
|
1996-05-25 23:09:49 +00:00
|
|
|
# SRCS List of source files (c, c++, assembler)
|
|
|
|
#
|
2004-01-13 17:37:45 +00:00
|
|
|
# DPSRCS List of source files which are needed for generating
|
|
|
|
# dependencies, ${SRCS} are always part of it.
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# +++ targets +++
|
|
|
|
#
|
|
|
|
# cleandepend:
|
2016-02-16 19:11:17 +00:00
|
|
|
# remove ${CLEANDEPENDFILES}; remove ${CLEANDEPENDDIRS} and all
|
|
|
|
# contents.
|
1996-05-25 23:09:49 +00:00
|
|
|
#
|
|
|
|
# depend:
|
|
|
|
# Make the dependencies for the source files, and store
|
|
|
|
# them in the file ${DEPENDFILE}.
|
|
|
|
#
|
|
|
|
# tags:
|
2002-10-17 13:48:13 +00:00
|
|
|
# In "ctags" mode, create a tags file for the source files.
|
|
|
|
# In "gtags" mode, create a (GLOBAL) gtags file for the
|
|
|
|
# source files. If HTML is defined, htags(1) is also run
|
|
|
|
# after gtags(1).
|
1996-05-25 23:09:49 +00:00
|
|
|
|
2002-04-22 10:04:41 +00:00
|
|
|
.if !target(__<bsd.init.mk>__)
|
|
|
|
.error bsd.dep.mk cannot be included directly.
|
|
|
|
.endif
|
1996-04-01 18:58:28 +00:00
|
|
|
|
2002-10-17 13:48:13 +00:00
|
|
|
CTAGS?= gtags
|
|
|
|
CTAGSFLAGS?=
|
|
|
|
GTAGSFLAGS?= -o
|
|
|
|
HTAGSFLAGS?=
|
|
|
|
|
Add built-in ccache build support via WITH_CCACHE_BUILD option.
ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.
This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.
The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.
Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.
CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.
The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.
Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.
distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.
The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).
Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
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
The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.
buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 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-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 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)
[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30
PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes
2015-11-08 00:50:18 +00:00
|
|
|
_MKDEPCC:= ${CC:N${CCACHE_BIN}}
|
|
|
|
# XXX: DEPFLAGS can come out once Makefile.inc1 properly passes down
|
|
|
|
# CXXFLAGS.
|
|
|
|
.if !empty(DEPFLAGS)
|
|
|
|
_MKDEPCC+= ${DEPFLAGS}
|
2002-04-15 15:23:45 +00:00
|
|
|
.endif
|
Add built-in ccache build support via WITH_CCACHE_BUILD option.
ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.
This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.
The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.
Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.
CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.
The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.
Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.
distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.
The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).
Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.
The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
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
The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.
buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 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-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 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)
[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30
PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes
2015-11-08 00:50:18 +00:00
|
|
|
MKDEPCMD?= CC='${_MKDEPCC}' mkdep
|
1996-04-01 18:58:28 +00:00
|
|
|
DEPENDFILE?= .depend
|
2016-01-27 01:24:05 +00:00
|
|
|
.if ${MK_DIRDEPS_BUILD} == "no"
|
2016-01-25 22:29:44 +00:00
|
|
|
.MAKE.DEPENDFILE= ${DEPENDFILE}
|
2016-01-27 01:24:05 +00:00
|
|
|
.endif
|
2016-02-16 19:11:17 +00:00
|
|
|
CLEANDEPENDFILES= ${DEPENDFILE} ${DEPENDFILE}.*
|
1994-08-04 21:10:08 +00:00
|
|
|
|
2002-10-17 13:48:13 +00:00
|
|
|
# Keep `tags' here, before SRCS are mangled below for `depend'.
|
2004-12-21 09:43:25 +00:00
|
|
|
.if !target(tags) && defined(SRCS) && !defined(NO_TAGS)
|
2002-10-17 13:48:13 +00:00
|
|
|
tags: ${SRCS}
|
2010-01-18 15:58:02 +00:00
|
|
|
.if ${CTAGS:T} == "gtags"
|
2002-10-17 13:48:13 +00:00
|
|
|
@cd ${.CURDIR} && ${CTAGS} ${GTAGSFLAGS} ${.OBJDIR}
|
|
|
|
.if defined(HTML)
|
|
|
|
@cd ${.CURDIR} && htags ${HTAGSFLAGS} -d ${.OBJDIR} ${.OBJDIR}
|
|
|
|
.endif
|
2010-01-18 15:58:02 +00:00
|
|
|
.else
|
|
|
|
@${CTAGS} ${CTAGSFLAGS} -f /dev/stdout \
|
|
|
|
${.ALLSRC:N*.h} | sed "s;${.CURDIR}/;;" > ${.TARGET}
|
2002-10-17 13:48:13 +00:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2016-02-19 00:41:24 +00:00
|
|
|
# Skip reading .depend when not needed to speed up tree-walks
|
|
|
|
# and simple lookups.
|
|
|
|
.if !empty(.MAKEFLAGS:M-V${_V_READ_DEPEND}) || make(obj) || make(clean*) || \
|
|
|
|
make(install*)
|
|
|
|
_SKIP_READ_DEPEND= 1
|
|
|
|
.if ${MK_DIRDEPS_BUILD} == "no"
|
|
|
|
.MAKE.DEPENDFILE= /dev/null
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
1998-05-11 15:37:13 +00:00
|
|
|
.if defined(SRCS)
|
|
|
|
CLEANFILES?=
|
|
|
|
|
2014-08-11 21:42:06 +00:00
|
|
|
.for _S in ${SRCS:N*.[dhly]}
|
2016-02-24 17:19:05 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_S:R}.o= ${_S}
|
|
|
|
.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE})
|
|
|
|
${_S:R}.o: ${OBJS_DEPEND_GUESS.${_S:R}.o}
|
2004-01-17 18:51:55 +00:00
|
|
|
.endif
|
2016-02-24 17:19:05 +00:00
|
|
|
.endfor
|
2004-01-17 18:51:55 +00:00
|
|
|
|
2014-07-05 20:08:35 +00:00
|
|
|
# Lexical analyzers
|
1998-05-11 15:37:13 +00:00
|
|
|
.for _LSRC in ${SRCS:M*.l:N*/*}
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _LC in ${_LSRC:R}.c
|
1998-05-11 15:37:13 +00:00
|
|
|
${_LC}: ${_LSRC}
|
2014-07-20 14:49:24 +00:00
|
|
|
${LEX} ${LFLAGS} -o${.TARGET} ${.ALLSRC}
|
2016-02-24 17:19:05 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_LC:R}.o= ${_LC}
|
|
|
|
.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE})
|
|
|
|
${_LC:R}.o: ${OBJS_DEPEND_GUESS.${_LC:R}.o}
|
2004-01-17 18:51:55 +00:00
|
|
|
.endif
|
1998-05-11 15:37:13 +00:00
|
|
|
SRCS:= ${SRCS:S/${_LSRC}/${_LC}/}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= ${_LC}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
|
|
|
|
2014-07-05 20:08:35 +00:00
|
|
|
# Yacc grammars
|
1998-05-11 15:37:13 +00:00
|
|
|
.for _YSRC in ${SRCS:M*.y:N*/*}
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _YC in ${_YSRC:R}.c
|
1998-05-11 15:37:13 +00:00
|
|
|
SRCS:= ${SRCS:S/${_YSRC}/${_YC}/}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= ${_YC}
|
2004-01-27 23:22:15 +00:00
|
|
|
.if !empty(YFLAGS:M-d) && !empty(SRCS:My.tab.h)
|
1998-05-11 15:37:13 +00:00
|
|
|
.ORDER: ${_YC} y.tab.h
|
|
|
|
${_YC} y.tab.h: ${_YSRC}
|
|
|
|
${YACC} ${YFLAGS} ${.ALLSRC}
|
|
|
|
cp y.tab.c ${_YC}
|
2004-01-12 15:29:47 +00:00
|
|
|
CLEANFILES+= y.tab.c y.tab.h
|
2004-01-27 23:22:15 +00:00
|
|
|
.elif !empty(YFLAGS:M-d)
|
2004-01-12 15:29:47 +00:00
|
|
|
.for _YH in ${_YC:R}.h
|
2016-01-27 01:33:26 +00:00
|
|
|
.ORDER: ${_YC} ${_YH}
|
|
|
|
${_YC} ${_YH}: ${_YSRC}
|
1998-05-11 15:37:13 +00:00
|
|
|
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
|
2004-01-12 15:29:47 +00:00
|
|
|
SRCS+= ${_YH}
|
|
|
|
CLEANFILES+= ${_YH}
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.else
|
|
|
|
${_YC}: ${_YSRC}
|
|
|
|
${YACC} ${YFLAGS} -o ${_YC} ${.ALLSRC}
|
|
|
|
.endif
|
2016-02-24 17:19:05 +00:00
|
|
|
OBJS_DEPEND_GUESS.${_YC:R}.o= ${_YC}
|
|
|
|
.if ${MK_FAST_DEPEND} == "no" && !exists(${.OBJDIR}/${DEPENDFILE})
|
|
|
|
${_YC:R}.o: ${OBJS_DEPEND_GUESS.${_YC:R}.o}
|
2004-01-17 18:51:55 +00:00
|
|
|
.endif
|
1998-05-11 15:37:13 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2014-07-05 20:08:35 +00:00
|
|
|
|
|
|
|
# DTrace probe definitions
|
2014-07-12 00:54:34 +00:00
|
|
|
.if ${SRCS:M*.d}
|
2014-09-02 23:43:06 +00:00
|
|
|
CFLAGS+= -I${.OBJDIR}
|
2014-07-12 00:54:34 +00:00
|
|
|
.endif
|
2014-07-05 20:08:35 +00:00
|
|
|
.for _DSRC in ${SRCS:M*.d:N*/*}
|
2014-07-12 00:54:34 +00:00
|
|
|
.for _D in ${_DSRC:R}
|
2016-01-25 22:29:41 +00:00
|
|
|
SRCS+= ${_D}.h
|
2014-07-12 00:54:34 +00:00
|
|
|
${_D}.h: ${_DSRC}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -h -s ${.ALLSRC}
|
2014-10-21 04:30:00 +00:00
|
|
|
SRCS:= ${SRCS:S/^${_DSRC}$//}
|
2014-07-12 01:06:29 +00:00
|
|
|
OBJS+= ${_D}.o
|
2014-08-10 06:43:40 +00:00
|
|
|
CLEANFILES+= ${_D}.h ${_D}.o
|
2014-10-21 04:30:00 +00:00
|
|
|
${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//}
|
2016-01-25 22:29:32 +00:00
|
|
|
@rm -f ${.TARGET}
|
2016-01-25 22:29:41 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
|
2014-08-10 06:43:40 +00:00
|
|
|
.if defined(LIB)
|
|
|
|
CLEANFILES+= ${_D}.So ${_D}.po
|
2014-10-21 04:30:00 +00:00
|
|
|
${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//}
|
2016-01-25 22:29:32 +00:00
|
|
|
@rm -f ${.TARGET}
|
2016-01-25 22:29:41 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
|
2014-10-21 04:30:00 +00:00
|
|
|
${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
|
2016-01-25 22:29:32 +00:00
|
|
|
@rm -f ${.TARGET}
|
2016-01-25 22:29:41 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC:N*.h}
|
2014-07-12 00:54:34 +00:00
|
|
|
.endif
|
2014-07-05 20:08:35 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2015-12-07 16:08:19 +00:00
|
|
|
|
|
|
|
|
2016-02-24 17:19:13 +00:00
|
|
|
.if !empty(.MAKE.MODE:Mmeta) && empty(.MAKE.MODE:Mnofilemon)
|
|
|
|
_meta_filemon= 1
|
|
|
|
.endif
|
|
|
|
.if ${MK_FAST_DEPEND} == "yes"
|
2015-12-07 16:08:19 +00:00
|
|
|
DEPEND_MP?= -MP
|
|
|
|
# Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to
|
|
|
|
# avoid collisions.
|
|
|
|
DEPEND_FILTER= C,/,_,g
|
2016-02-24 17:19:13 +00:00
|
|
|
DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
|
|
|
|
.if !empty(DEPENDSRCS)
|
|
|
|
DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,}
|
|
|
|
.endif
|
|
|
|
DEPENDFILES_OBJS= ${DEPENDOBJS:O:u:${DEPEND_FILTER}:C/^/${DEPENDFILE}./}
|
2015-12-07 16:08:19 +00:00
|
|
|
DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
|
|
|
|
DEPEND_CFLAGS+= -MT${.TARGET}
|
2016-02-24 17:19:13 +00:00
|
|
|
# Skip generating or including .depend.* files if in meta+filemon mode since
|
|
|
|
# it will track dependencies itself. OBJS_DEPEND_GUESS is still used though.
|
|
|
|
.if !defined(_meta_filemon)
|
2015-12-07 16:08:22 +00:00
|
|
|
.if defined(.PARSEDIR)
|
|
|
|
# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
|
|
|
|
# as those are the only ones we will include.
|
|
|
|
DEPEND_CFLAGS_CONDITION= !empty(DEPENDOBJS:M${.TARGET:${DEPEND_FILTER}})
|
|
|
|
CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
|
|
|
|
.else
|
2015-12-07 16:08:19 +00:00
|
|
|
CFLAGS+= ${DEPEND_CFLAGS}
|
2015-12-07 16:08:22 +00:00
|
|
|
.endif
|
2016-02-19 00:41:24 +00:00
|
|
|
.if !defined(_SKIP_READ_DEPEND)
|
2016-01-15 22:08:51 +00:00
|
|
|
.for __depend_obj in ${DEPENDFILES_OBJS}
|
|
|
|
.sinclude "${__depend_obj}"
|
2015-12-07 16:08:19 +00:00
|
|
|
.endfor
|
2016-02-24 17:19:05 +00:00
|
|
|
.endif # !defined(_SKIP_READ_DEPEND)
|
2016-02-24 17:19:13 +00:00
|
|
|
.endif # !defined(_meta_filemon)
|
2015-12-07 16:08:19 +00:00
|
|
|
.endif # ${MK_FAST_DEPEND} == "yes"
|
|
|
|
.endif # defined(SRCS)
|
1998-05-11 15:37:13 +00:00
|
|
|
|
2015-11-14 03:24:48 +00:00
|
|
|
.if ${MK_DIRDEPS_BUILD} == "yes"
|
2016-02-24 17:19:18 +00:00
|
|
|
# Prevent meta.autodep.mk from tracking "local dependencies".
|
|
|
|
.depend:
|
2012-08-22 19:25:57 +00:00
|
|
|
.include <meta.autodep.mk>
|
2016-02-24 17:19:13 +00:00
|
|
|
# If using filemon then _EXTRADEPEND is skipped since it is not needed.
|
|
|
|
.if empty(.MAKE.MODE:Mnofilemon)
|
2012-08-22 19:25:57 +00:00
|
|
|
# this depend: bypasses that below
|
|
|
|
# the dependency helps when bootstrapping
|
|
|
|
depend: beforedepend ${DPSRCS} ${SRCS} afterdepend
|
|
|
|
beforedepend:
|
|
|
|
afterdepend: beforedepend
|
|
|
|
.endif
|
2016-02-24 17:19:13 +00:00
|
|
|
.endif
|
2012-08-22 19:25:57 +00:00
|
|
|
|
2016-02-24 17:19:05 +00:00
|
|
|
# Guess some dependencies for when no ${DEPENDFILE}.OBJ is generated yet.
|
2016-02-24 17:19:13 +00:00
|
|
|
# For meta+filemon the .meta file is checked for since it is the dependency
|
|
|
|
# file used.
|
2016-02-24 17:19:05 +00:00
|
|
|
.if ${MK_FAST_DEPEND} == "yes"
|
|
|
|
.for __obj in ${DEPENDOBJS:O:u}
|
2016-02-24 17:19:13 +00:00
|
|
|
.if (defined(_meta_filemon) && !exists(${.OBJDIR}/${__obj}.meta)) || \
|
|
|
|
(!defined(_meta_filemon) && !exists(${.OBJDIR}/${DEPENDFILE}.${__obj}))
|
2016-02-24 17:19:05 +00:00
|
|
|
${__obj}: ${OBJS_DEPEND_GUESS}
|
|
|
|
${__obj}: ${OBJS_DEPEND_GUESS.${__obj}}
|
|
|
|
.endif
|
|
|
|
.endfor
|
2016-02-24 17:19:18 +00:00
|
|
|
|
|
|
|
# Always run 'make depend' to generate dependencies early and to avoid the
|
|
|
|
# need for manually running it. The dirdeps build should only do this in
|
|
|
|
# sub-makes though since MAKELEVEL0 is for dirdeps calculations.
|
|
|
|
.if ${MK_DIRDEPS_BUILD} == "no" || ${.MAKE.LEVEL} > 0
|
|
|
|
beforebuild: depend
|
2016-02-24 17:19:05 +00:00
|
|
|
.endif
|
2016-02-24 17:19:18 +00:00
|
|
|
.endif # ${MK_FAST_DEPEND} == "yes"
|
2016-02-24 17:19:05 +00:00
|
|
|
|
1994-08-04 21:10:08 +00:00
|
|
|
.if !target(depend)
|
|
|
|
.if defined(SRCS)
|
2002-04-23 09:03:56 +00:00
|
|
|
depend: beforedepend ${DEPENDFILE} afterdepend
|
1996-04-01 18:58:28 +00:00
|
|
|
|
2012-08-22 19:25:57 +00:00
|
|
|
# Tell bmake not to look for generated files via .PATH
|
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
|
|
|
.NOPATH: ${DEPENDFILE} ${DEPENDFILES_OBJS}
|
2012-08-22 19:25:57 +00:00
|
|
|
|
2016-01-20 01:40:18 +00:00
|
|
|
.if ${MK_FAST_DEPEND} == "no"
|
|
|
|
# Capture -include from CFLAGS.
|
|
|
|
# This could be simpler with bmake :tW but needs to support fmake for MFC.
|
|
|
|
_CFLAGS_INCLUDES= ${CFLAGS:Q:S/\\ /,/g:C/-include,/-include%/g:C/,/ /g:M-include*:C/%/ /g}
|
|
|
|
_CXXFLAGS_INCLUDES= ${CXXFLAGS:Q:S/\\ /,/g:C/-include,/-include%/g:C/,/ /g:M-include*:C/%/ /g}
|
|
|
|
|
1998-03-07 13:57:37 +00:00
|
|
|
# Different types of sources are compiled with slightly different flags.
|
|
|
|
# Split up the sources, and filter out headers and non-applicable flags.
|
2012-08-23 17:03:33 +00:00
|
|
|
MKDEP_CFLAGS= ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BIDU]*} ${CFLAGS:M-std=*} \
|
2016-01-20 01:40:18 +00:00
|
|
|
${CFLAGS:M-ansi} ${_CFLAGS_INCLUDES}
|
2012-08-23 17:03:33 +00:00
|
|
|
MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} \
|
2016-01-20 01:40:18 +00:00
|
|
|
${CXXFLAGS:M-std=*} ${CXXFLAGS:M-ansi} ${CXXFLAGS:M-stdlib=*} \
|
|
|
|
${_CXXFLAGS_INCLUDES}
|
|
|
|
.endif # ${MK_FAST_DEPEND} == "no"
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
|
2004-01-13 17:37:45 +00:00
|
|
|
DPSRCS+= ${SRCS}
|
2016-02-24 17:19:09 +00:00
|
|
|
# FAST_DEPEND will only generate a .depend if _EXTRADEPEND is used but
|
|
|
|
# the target is created to allow 'make depend' to generate files.
|
2004-01-13 17:37:45 +00:00
|
|
|
${DEPENDFILE}: ${DPSRCS}
|
2016-02-24 20:28:45 +00:00
|
|
|
.if exists(${.OBJDIR}/${DEPENDFILE})
|
1996-04-01 18:58:28 +00:00
|
|
|
rm -f ${DEPENDFILE}
|
2016-02-24 20:28:45 +00:00
|
|
|
.endif
|
|
|
|
.if ${MK_FAST_DEPEND} == "no"
|
2004-01-27 23:22:15 +00:00
|
|
|
.if !empty(DPSRCS:M*.[cS])
|
1998-03-07 13:57:37 +00:00
|
|
|
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
${MKDEP_CFLAGS} ${.ALLSRC:M*.[cS]}
|
1996-04-01 18:58:28 +00:00
|
|
|
.endif
|
2004-01-27 23:22:15 +00:00
|
|
|
.if !empty(DPSRCS:M*.cc) || !empty(DPSRCS:M*.C) || !empty(DPSRCS:M*.cpp) || \
|
|
|
|
!empty(DPSRCS:M*.cxx)
|
1996-04-01 18:58:28 +00:00
|
|
|
${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \
|
This are the build infrastructure changes to allow to use the
Intel C/C++ compiler (lang/icc) to build the kernel.
The icc CPUTYPE CFLAGS use icc v7 syntax, icc v8 moans about them, but
doesn't abort. They also produce CPU specific code (new instructions
of the CPU, not only CPU specific scheduling), so if you get coredumps
with signal 4 (SIGILL, illegal instruction) you've used the wrong
CPUTYPE.
Incarnations of this patch survive gcc compiles and my make universe.
I use it on my desktop.
To use it update share/mk, add
/usr/local/intel/compiler70/ia32/bin (icc v7, works)
or
/usr/local/intel_cc_80/bin (icc v8, doesn't work)
to your PATH, make sure you have a new kernel compile directory
(e.g. MYKERNEL_icc) and run
CFLAGS="-O2 -ip" CC=icc make depend
CFLAGS="-O2 -ip" CC=icc make
in it.
Don't compile with -ipo, the build infrastructure uses ld directly to
link the kernel and the modules, but -ipo needs the link step to be
performed with Intel's linker.
Problems with icc v8:
- panic: npx0 cannot be emulated on an SMP system
- UP: first start of /bin/sh results in a FP exception
Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.
Reviewed by: silence on -arch
Submitted by: netchild
2004-03-12 21:36:12 +00:00
|
|
|
${MKDEP_CXXFLAGS} \
|
1998-06-05 18:38:55 +00:00
|
|
|
${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx}
|
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
|
|
|
.else
|
1996-04-01 18:58:28 +00:00
|
|
|
.endif
|
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
|
|
|
.endif # ${MK_FAST_DEPEND} == "no"
|
1997-04-09 16:10:27 +00:00
|
|
|
.if target(_EXTRADEPEND)
|
2002-04-17 05:42:18 +00:00
|
|
|
_EXTRADEPEND: .USE
|
2002-04-16 12:27:07 +00:00
|
|
|
${DEPENDFILE}: _EXTRADEPEND
|
1997-04-09 16:10:27 +00:00
|
|
|
.endif
|
1996-04-01 18:58:28 +00:00
|
|
|
|
1997-10-05 09:40:24 +00:00
|
|
|
.ORDER: ${DEPENDFILE} afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.else
|
2002-04-23 09:03:56 +00:00
|
|
|
depend: beforedepend afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.if !target(beforedepend)
|
|
|
|
beforedepend:
|
1997-10-05 09:40:24 +00:00
|
|
|
.else
|
|
|
|
.ORDER: beforedepend ${DEPENDFILE}
|
|
|
|
.ORDER: beforedepend afterdepend
|
1994-08-04 21:10:08 +00:00
|
|
|
.endif
|
|
|
|
.if !target(afterdepend)
|
|
|
|
afterdepend:
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2016-02-24 17:18:55 +00:00
|
|
|
.if defined(SRCS)
|
2010-01-18 15:58:02 +00:00
|
|
|
.if ${CTAGS:T} == "gtags"
|
2016-02-16 19:11:17 +00:00
|
|
|
CLEANDEPENDFILES+= GPATH GRTAGS GSYMS GTAGS
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(HTML)
|
2016-02-16 19:11:17 +00:00
|
|
|
CLEANDEPENDDIRS+= HTML
|
2002-10-17 13:48:13 +00:00
|
|
|
.endif
|
2010-01-18 15:41:55 +00:00
|
|
|
.else
|
2016-02-16 19:11:17 +00:00
|
|
|
CLEANDEPENDFILES+= tags
|
|
|
|
.endif
|
2016-02-24 17:18:55 +00:00
|
|
|
.endif
|
2016-02-16 19:11:17 +00:00
|
|
|
.if !target(cleandepend)
|
|
|
|
cleandepend:
|
2016-02-24 17:18:55 +00:00
|
|
|
.if !empty(CLEANDEPENDFILES)
|
2016-02-16 19:11:17 +00:00
|
|
|
rm -f ${CLEANDEPENDFILES}
|
2016-02-24 17:18:55 +00:00
|
|
|
.endif
|
2016-02-16 19:11:17 +00:00
|
|
|
.if !empty(CLEANDEPENDDIRS)
|
|
|
|
rm -rf ${CLEANDEPENDDIRS}
|
1997-04-13 06:44:25 +00:00
|
|
|
.endif
|
1996-06-24 04:26:21 +00:00
|
|
|
.endif
|
2002-07-03 12:44:06 +00:00
|
|
|
|
|
|
|
.if !target(checkdpadd) && (defined(DPADD) || defined(LDADD))
|
2014-09-10 07:55:51 +00:00
|
|
|
_LDADD_FROM_DPADD= ${DPADD:R:T:C;^lib(.*)$;-l\1;g}
|
|
|
|
# Ignore -Wl,--start-group/-Wl,--end-group as it might be required in the
|
|
|
|
# LDADD list due to unresolved symbols
|
|
|
|
_LDADD_CANONICALIZED= ${LDADD:N:R:T:C;^lib(.*)$;-l\1;g:N-Wl,--[es]*-group}
|
2002-07-03 12:44:06 +00:00
|
|
|
checkdpadd:
|
2003-07-03 11:43:57 +00:00
|
|
|
.if ${_LDADD_FROM_DPADD} != ${_LDADD_CANONICALIZED}
|
|
|
|
@echo ${.CURDIR}
|
|
|
|
@echo "DPADD -> ${_LDADD_FROM_DPADD}"
|
|
|
|
@echo "LDADD -> ${_LDADD_CANONICALIZED}"
|
|
|
|
.endif
|
2002-07-03 12:44:06 +00:00
|
|
|
.endif
|