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 +++
|
|
|
|
#
|
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:
|
|
|
|
# Remove depend and tags file
|
|
|
|
#
|
|
|
|
# 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
|
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
|
|
|
DEPENDFILES= ${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
|
|
|
|
|
1998-05-11 15:37:13 +00:00
|
|
|
.if defined(SRCS)
|
|
|
|
CLEANFILES?=
|
|
|
|
|
FAST_DEPEND: Fix building of wrong source files in some cases.
Similar to the original reason for these dependency hints to be added,
in r124637, the missing-dependency file case can lead to building of the
wrong source.
A clear example of this is in gnu/lib/libstdc++ where the .PATH contains
both contrib/gcc and contrib/libstdc++/src.
contrib/gcc has a debug.c.
contrib/libstdc++/src has a debug.cc.
When building for the objects of debug.o, debug.So, and debug.po, it is
ambiguous for which src file to use due to the suffix transformation
rules, even though the proper one is listed first in .PATH.
This was normally avoided due to these dependency hints for the initial
build, and then mkdep would add an explicit 'debug.o: debug.cc'
dependency into the .depend file. WITH_FAST_DEPEND does not generate
the .depend file with these, but puts them into .depend.debug.o instead.
Rather than extending the exists() check to each object's .depend.*
file, just enable the hint when when using WITH_FAST_DEPEND. It fixes
the problem and seems to be safe enough to use since it is mapping SRCS
back to OBJS, rather than letting make make assumptions from OBJS to
SRCS.
A similar check mapping objects to headers is present in some mk files
but was not extended here for FAST_DEPEND since it has not yet been
found to be a problem.
X-MFC-With: r290433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
2015-11-09 23:37:04 +00:00
|
|
|
.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE})
|
2014-08-11 21:42:06 +00:00
|
|
|
.for _S in ${SRCS:N*.[dhly]}
|
2004-01-17 18:51:55 +00:00
|
|
|
${_S:R}.o: ${_S}
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
|
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}
|
FAST_DEPEND: Fix building of wrong source files in some cases.
Similar to the original reason for these dependency hints to be added,
in r124637, the missing-dependency file case can lead to building of the
wrong source.
A clear example of this is in gnu/lib/libstdc++ where the .PATH contains
both contrib/gcc and contrib/libstdc++/src.
contrib/gcc has a debug.c.
contrib/libstdc++/src has a debug.cc.
When building for the objects of debug.o, debug.So, and debug.po, it is
ambiguous for which src file to use due to the suffix transformation
rules, even though the proper one is listed first in .PATH.
This was normally avoided due to these dependency hints for the initial
build, and then mkdep would add an explicit 'debug.o: debug.cc'
dependency into the .depend file. WITH_FAST_DEPEND does not generate
the .depend file with these, but puts them into .depend.debug.o instead.
Rather than extending the exists() check to each object's .depend.*
file, just enable the hint when when using WITH_FAST_DEPEND. It fixes
the problem and seems to be safe enough to use since it is mapping SRCS
back to OBJS, rather than letting make make assumptions from OBJS to
SRCS.
A similar check mapping objects to headers is present in some mk files
but was not extended here for FAST_DEPEND since it has not yet been
found to be a problem.
X-MFC-With: r290433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
2015-11-09 23:37:04 +00:00
|
|
|
.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE})
|
2004-01-17 18:51:55 +00:00
|
|
|
${_LC:R}.o: ${_LC}
|
|
|
|
.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
|
2012-08-22 19:25:57 +00:00
|
|
|
${_YH}: ${_YC}
|
|
|
|
${_YC}: ${_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
|
FAST_DEPEND: Fix building of wrong source files in some cases.
Similar to the original reason for these dependency hints to be added,
in r124637, the missing-dependency file case can lead to building of the
wrong source.
A clear example of this is in gnu/lib/libstdc++ where the .PATH contains
both contrib/gcc and contrib/libstdc++/src.
contrib/gcc has a debug.c.
contrib/libstdc++/src has a debug.cc.
When building for the objects of debug.o, debug.So, and debug.po, it is
ambiguous for which src file to use due to the suffix transformation
rules, even though the proper one is listed first in .PATH.
This was normally avoided due to these dependency hints for the initial
build, and then mkdep would add an explicit 'debug.o: debug.cc'
dependency into the .depend file. WITH_FAST_DEPEND does not generate
the .depend file with these, but puts them into .depend.debug.o instead.
Rather than extending the exists() check to each object's .depend.*
file, just enable the hint when when using WITH_FAST_DEPEND. It fixes
the problem and seems to be safe enough to use since it is mapping SRCS
back to OBJS, rather than letting make make assumptions from OBJS to
SRCS.
A similar check mapping objects to headers is present in some mk files
but was not extended here for FAST_DEPEND since it has not yet been
found to be a problem.
X-MFC-With: r290433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
2015-11-09 23:37:04 +00:00
|
|
|
.if ${MK_FAST_DEPEND} == "yes" || !exists(${.OBJDIR}/${DEPENDFILE})
|
2004-01-17 18:51:55 +00:00
|
|
|
${_YC:R}.o: ${_YC}
|
|
|
|
.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}
|
2014-08-13 01:27:51 +00:00
|
|
|
DHDRS+= ${_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$//}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
|
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$//}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
|
2014-10-21 04:30:00 +00:00
|
|
|
${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
|
2015-04-08 02:43:05 +00:00
|
|
|
${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
|
2014-07-12 00:54:34 +00:00
|
|
|
.endif
|
2014-07-05 20:08:35 +00:00
|
|
|
.endfor
|
|
|
|
.endfor
|
2014-08-13 01:27:51 +00:00
|
|
|
beforedepend: ${DHDRS}
|
|
|
|
beforebuild: ${DHDRS}
|
2015-12-07 16:08:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
.if ${MK_FAST_DEPEND} == "yes" && ${.MAKE.MODE:Unormal:Mmeta*} == ""
|
|
|
|
DEPENDFILES+= ${DEPENDFILE}.*
|
|
|
|
DEPEND_MP?= -MP
|
|
|
|
# Handle OBJS=../somefile.o hacks. Just replace '/' rather than use :T to
|
|
|
|
# avoid collisions.
|
|
|
|
DEPEND_FILTER= C,/,_,g
|
|
|
|
DEPEND_CFLAGS+= -MD ${DEPEND_MP} -MF${DEPENDFILE}.${.TARGET:${DEPEND_FILTER}}
|
|
|
|
DEPEND_CFLAGS+= -MT${.TARGET}
|
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
|
2015-12-07 16:08:19 +00:00
|
|
|
DEPENDSRCS= ${SRCS:M*.[cSC]} ${SRCS:M*.cxx} ${SRCS:M*.cpp} ${SRCS:M*.cc}
|
|
|
|
.if !empty(DEPENDSRCS)
|
|
|
|
DEPENDOBJS+= ${DEPENDSRCS:R:S,$,.o,}
|
|
|
|
.endif
|
|
|
|
.for __obj in ${DEPENDOBJS:O:u}
|
|
|
|
.if ${.MAKEFLAGS:M-V} == ""
|
|
|
|
.sinclude "${DEPENDFILE}.${__obj:${DEPEND_FILTER}}"
|
1998-05-11 15:37:13 +00:00
|
|
|
.endif
|
2015-12-07 16:08:19 +00:00
|
|
|
DEPENDFILES_OBJS+= ${DEPENDFILE}.${__obj:${DEPEND_FILTER}}
|
|
|
|
.endfor
|
|
|
|
.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"
|
2012-08-22 19:25:57 +00:00
|
|
|
.include <meta.autodep.mk>
|
|
|
|
# this depend: bypasses that below
|
|
|
|
# the dependency helps when bootstrapping
|
|
|
|
depend: beforedepend ${DPSRCS} ${SRCS} afterdepend
|
|
|
|
beforedepend:
|
|
|
|
afterdepend: beforedepend
|
|
|
|
.endif
|
|
|
|
|
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
|
|
|
|
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=*} \
|
|
|
|
${CFLAGS:M-ansi}
|
|
|
|
MKDEP_CXXFLAGS= ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BIDU]*} \
|
|
|
|
${CXXFLAGS:M-std=*} ${CXXFLAGS:M-ansi} ${CXXFLAGS:M-stdlib=*}
|
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}
|
|
|
|
${DEPENDFILE}: ${DPSRCS}
|
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
|
|
|
.if ${MK_FAST_DEPEND} == "no"
|
1996-04-01 18:58:28 +00:00
|
|
|
rm -f ${DEPENDFILE}
|
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
|
|
|
.else
|
|
|
|
: > ${.TARGET}
|
|
|
|
.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
|
|
|
|
|
1996-06-24 04:26:21 +00:00
|
|
|
.if !target(cleandepend)
|
2002-04-23 09:03:56 +00:00
|
|
|
cleandepend:
|
1997-08-26 16:54:33 +00:00
|
|
|
.if defined(SRCS)
|
2010-01-18 15:58:02 +00:00
|
|
|
.if ${CTAGS:T} == "gtags"
|
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
|
|
|
rm -f ${DEPENDFILES} GPATH GRTAGS GSYMS GTAGS
|
1997-04-13 06:44:25 +00:00
|
|
|
.if defined(HTML)
|
2002-10-17 13:48:13 +00:00
|
|
|
rm -rf HTML
|
|
|
|
.endif
|
2010-01-18 15:41:55 +00:00
|
|
|
.else
|
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
|
|
|
rm -f ${DEPENDFILES} tags
|
1997-04-13 06:44:25 +00:00
|
|
|
.endif
|
1996-06-24 04:26:21 +00:00
|
|
|
.endif
|
|
|
|
.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
|