summaryrefslogtreecommitdiff
path: root/Makefile.inc1
diff options
context:
space:
mode:
authorAlex Richardson <arichardson@FreeBSD.org>2018-10-23 06:31:25 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2018-10-23 06:31:25 +0000
commit74f6548619cdef063d5beebe52c1aafc67df2cd0 (patch)
treee4e5105367532cb214e891fcaf0b79e6ffd7c228 /Makefile.inc1
parentc5c5072bb0d088216ac3f8602929274a543e1057 (diff)
downloadsrc-test2-74f6548619cdef063d5beebe52c1aafc67df2cd0.tar.gz
src-test2-74f6548619cdef063d5beebe52c1aafc67df2cd0.zip
Only compute the X_COMPILER_*/X_LINKER_* variables when needed
When building CheriBSD we have to set XLD/XCC/XCFLAGS on the command line. This triggers the $XCC != $CC case in bsd.compiler.mk (and the same for LD in bsd.linker.mk) which causes it to call ${XCC} --version and ${XLD} --version (plus various awk+sed+echo calls) in every subdirectory. For incremental builds and stages that only walk the source tree this is often the majority of the time spent in that directory. By only computing the value of the X_COMPILER_*/X_LINKER_* variables if _WANT_TOOLCHAIN_CROSS_VARS is set we can reduce the number of cc/ld calls to once per build stage instead of once per recursive make. With this change (and no changes to the sources) the `make includes` stage now takes 28 seconds at -j1 instead of 86 seconds. Approved By: brooks (mentor) Differential Revision: https://reviews.freebsd.org/D17046
Notes
Notes: svn path=/head/; revision=339636
Diffstat (limited to 'Makefile.inc1')
-rw-r--r--Makefile.inc16
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 6f21ef9f634c..3ab706661035 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -103,8 +103,11 @@ MK_GCC_BOOTSTRAP= no
# here since we will always have the right make, unlike in src/Makefile
# Don't include bsd.linker.mk yet until XBINUTILS is handled (after src.opts.mk)
_NO_INCLUDE_LINKERMK= t
+# We also want the X_COMPILER* variables if we are using an external toolchain.
+_WANT_TOOLCHAIN_CROSS_VARS= t
.include "share/mk/bsd.compiler.mk"
.undef _NO_INCLUDE_LINKERMK
+.undef _WANT_TOOLCHAIN_CROSS_VARS
# src.opts.mk depends on COMPILER_FEATURES
.include "share/mk/src.opts.mk"
@@ -205,7 +208,10 @@ X${BINUTIL}?= ${${BINUTIL}}
MK_LLD_BOOTSTRAP= no
.endif
+# We also want the X_LINKER* variables if we are using an external toolchain.
+_WANT_TOOLCHAIN_CROSS_VARS= t
.include "share/mk/bsd.linker.mk"
+.undef _WANT_TOOLCHAIN_CROSS_VARS
# Begin WITH_SYSTEM_COMPILER / WITH_SYSTEM_LD