commit e79c58a03f5099692774fc17c2e0450652a0d13c Author: Bryan Drewery Date: Tue Mar 21 17:26:41 2017 -0700 stash compiler metadata cache PR: 212877 diff --git Makefile Makefile index 8b02703bda5d..0f6164b46d0e 100644 --- Makefile +++ Makefile @@ -101,6 +101,12 @@ # For more information, see the build(7) manual page. # +# Suck in compiler metadata from buildworld/toolchain if possible to avoid +# running CC from bsd.compiler.mk. +.if make(installworld) || make(install) +.-include "compiler-metadata.mk" +.endif + # This is included so CC is set to ccache for -V, and COMPILER_TYPE/VERSION # can be cached for sub-makes. .if ${MAKE_VERSION} >= 20140620 && defined(.PARSEDIR) diff --git Makefile.inc1 Makefile.inc1 index 415755d565c3..5257371624c8 100644 --- Makefile.inc1 +++ Makefile.inc1 @@ -160,6 +160,19 @@ CROSSENV+= COMPILER_VERSION=${X_COMPILER_VERSION} \ COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION} .endif .endif +# Store some compiler metadata for use in installworld where we don't +# want to invoke CC at all. +_COMPILER_METADATA_VARS= COMPILER_VERSION \ + COMPILER_TYPE \ + COMPILER_FREEBSD_VERSION +compiler-metadata: .PHONY + @: > ${.TARGET}.mk + @echo ".info Using cached compiler metadata from build on $$(hostname) at $$(date)" \ + > ${.TARGET}.mk +.for v in ${_COMPILER_METADATA_VARS} + @echo "${v}=${${v}}" >> ${.TARGET}.mk +.endfor + @echo ".export ${_COMPILER_METADATA_VARS}" >> ${.TARGET}.mk # Handle external binutils. .if defined(CROSS_TOOLCHAIN_PREFIX) @@ -764,6 +777,12 @@ _cross-tools: @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools +_compiler_metadata: + @echo + @echo "--------------------------------------------------------------" + @echo ">>> stage 3.1: recording compiler metadata for install" + @echo "--------------------------------------------------------------" + ${_+_}cd ${.CURDIR}; ${XMAKE} compiler-metadata _includes: @echo @echo "--------------------------------------------------------------" @@ -797,6 +816,7 @@ WMAKE_TGTS+= _worldtmp _legacy WMAKE_TGTS+= _bootstrap-tools .endif WMAKE_TGTS+= _cleanobj _obj _build-tools _cross-tools +WMAKE_TGTS+= _compiler_metadata WMAKE_TGTS+= _includes _libraries WMAKE_TGTS+= everything .if defined(LIBCOMPAT) && empty(SUBDIR_OVERRIDE)