From owner-svn-src-all@freebsd.org Tue Oct 20 20:15:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CB8ABA0A119; Tue, 20 Oct 2015 20:15:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CD311E93; Tue, 20 Oct 2015 20:15:26 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9KKFP0s056925; Tue, 20 Oct 2015 20:15:25 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9KKFPQI056924; Tue, 20 Oct 2015 20:15:25 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201510202015.t9KKFPQI056924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 20 Oct 2015 20:15:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289659 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2015 20:15:26 -0000 Author: bdrewery Date: Tue Oct 20 20:15:25 2015 New Revision: 289659 URL: https://svnweb.freebsd.org/changeset/base/289659 Log: Pass COMPILER_TYPE and COMPILER_VERSION to sub-makes to avoid redundant lookups. This uses a special variable name based on a hash of ${CC}, ${PATH}, and ${MACHINE} to ensure that a cached value is not used if any of these values changes to use a new compiler. Before this there were 34,620 fork/exec from bsd.compiler.mk during a buildworld. After this there are 608. More improvement is needed to cache a value from the top-level before descending into subdirs in the various build phases. Reviewed by: brooks (earlier version) MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3898 Modified: head/share/mk/bsd.compiler.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Tue Oct 20 20:12:42 2015 (r289658) +++ head/share/mk/bsd.compiler.mk Tue Oct 20 20:15:25 2015 (r289659) @@ -25,6 +25,18 @@ .if !target(____) ____: +# Try to import COMPILER_TYPE and COMPILER_VERSION from parent make. +# The value is only used/exported for the same environment that impacts +# CC and COMPILER_* settings here. +_exported_vars= COMPILER_TYPE COMPILER_VERSION +_cc_hash= ${CC}${MACHINE}${PATH} +_cc_hash:= ${_cc_hash:hash} +.for var in ${_exported_vars} +.if defined(${var}.${_cc_hash}) +${var}= ${${var}.${_cc_hash}} +.endif +.endfor + .if ${MACHINE} == "common" # common is a pseudo machine for architecture independent # generated files - thus there is no compiler. @@ -54,6 +66,14 @@ COMPILER_VERSION!=echo ${_v:M[1-9].[0-9] .undef _v .endif +# Export the values so sub-makes don't have to look them up again, using the +# hash key computed above. +.for var in ${_exported_vars} +${var}.${_cc_hash}:= ${${var}} +.export-env ${var}.${_cc_hash} +.undef ${var}.${_cc_hash} +.endfor + .if ${COMPILER_TYPE} == "clang" || \ (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800) COMPILER_FEATURES= c++11