From owner-svn-src-head@freebsd.org Thu Jun 22 21:03:28 2017 Return-Path: Delivered-To: svn-src-head@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 D541AD94677; Thu, 22 Jun 2017 21:03:28 +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 A42B3653E9; Thu, 22 Jun 2017 21:03:28 +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 v5ML3R8e026603; Thu, 22 Jun 2017 21:03:27 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5ML3Rd1026602; Thu, 22 Jun 2017 21:03:27 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201706222103.v5ML3Rd1026602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 22 Jun 2017 21:03:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320246 - 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-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jun 2017 21:03:29 -0000 Author: bdrewery Date: Thu Jun 22 21:03:27 2017 New Revision: 320246 URL: https://svnweb.freebsd.org/changeset/base/320246 Log: Support cached linker values in environment. This is similar to r289659 for bsd.compiler.mk. MFC after: 2 weeks Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11310 Modified: head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Thu Jun 22 21:03:24 2017 (r320245) +++ head/share/mk/bsd.linker.mk Thu Jun 22 21:03:27 2017 (r320246) @@ -19,6 +19,27 @@ ____: .for ld X_ in LD $${_empty_var_} XLD X_ .if ${ld} == "LD" || !empty(XLD) +# Try to import LINKER_TYPE and LINKER_VERSION from parent make. +# The value is only used/exported for the same environment that impacts +# LD and LINKER_* settings here. +_exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION +${X_}_ld_hash= ${${ld}}${MACHINE}${PATH} +${X_}_ld_hash:= ${${X_}_ld_hash:hash} +# Only import if none of the vars are set somehow else. +_can_export= yes +.for var in ${_exported_vars} +.if defined(${var}) +_can_export= no +.endif +.endfor +.if ${_can_export} == yes +.for var in ${_exported_vars} +.if defined(${var}.${${X_}_ld_hash}) +${var}= ${${var}.${${X_}_ld_hash}} +.endif +.endfor +.endif + .if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) _ld_version!= ${${ld}} --version 2>/dev/null | head -n 1 || echo none @@ -39,6 +60,14 @@ ${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \ .undef _ld_version .undef _v .endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) + +# 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}.${${X_}_ld_hash}:= ${${var}} +.export-env ${var}.${${X_}_ld_hash} +.undef ${var}.${${X_}_ld_hash} +.endfor .endif # ${ld} == "LD" || !empty(XLD) .endfor # .for ld in LD XLD