From owner-svn-src-all@freebsd.org Thu Jun 22 21:03:22 2017 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 4E991D94640; Thu, 22 Jun 2017 21:03:22 +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 1E86D653B3; Thu, 22 Jun 2017 21:03:22 +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 v5ML3LDG026511; Thu, 22 Jun 2017 21:03:21 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5ML3KDs026508; Thu, 22 Jun 2017 21:03:20 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201706222103.v5ML3KDs026508@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:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r320244 - 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.23 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: Thu, 22 Jun 2017 21:03:22 -0000 Author: bdrewery Date: Thu Jun 22 21:03:20 2017 New Revision: 320244 URL: https://svnweb.freebsd.org/changeset/base/320244 Log: Add basic bsd.linker.mk auto included from bsd.compiler.mk. This will provide LINKER_TYPE and LINKER_VERSION. MFC after: 2 weeks Reviewed by: emaste Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D11308 Added: head/share/mk/bsd.linker.mk (contents, props changed) Modified: head/share/mk/Makefile head/share/mk/bsd.compiler.mk Modified: head/share/mk/Makefile ============================================================================== --- head/share/mk/Makefile Thu Jun 22 20:32:23 2017 (r320243) +++ head/share/mk/Makefile Thu Jun 22 21:03:20 2017 (r320244) @@ -33,6 +33,7 @@ FILES= \ bsd.kmod.mk \ bsd.lib.mk \ bsd.libnames.mk \ + bsd.linker.mk \ bsd.links.mk \ bsd.man.mk \ bsd.mkopt.mk \ Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Thu Jun 22 20:32:23 2017 (r320243) +++ head/share/mk/bsd.compiler.mk Thu Jun 22 21:03:20 2017 (r320244) @@ -194,4 +194,5 @@ ${var}.${${X_}_cc_hash}:= ${${var}} .endif # ${cc} == "CC" || !empty(XCC) .endfor # .for cc in CC XCC +.include .endif # !target(____) Added: head/share/mk/bsd.linker.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/mk/bsd.linker.mk Thu Jun 22 21:03:20 2017 (r320244) @@ -0,0 +1,33 @@ +# $FreeBSD$ + +# Setup variables for the linker. +# +# LINKER_TYPE is the major type of linker. Currently binutils and lld support +# automatic detection. +# +# LINKER_VERSION is a numeric constant equal to: +# major * 10000 + minor * 100 + tiny +# It too can be overridden on the command line. +# +# This file may be included multiple times, but only has effect the first time. +# + +.if !target(____) +____: + +_ld_version!= ${LD} --version 2>/dev/null | head -n 1 || echo none +.if ${_ld_version} == "none" +.error Unable to determine linker type from LD=${LD} +.endif +.if ${_ld_version:[1..2]} == "GNU ld" +LINKER_TYPE= binutils +_v= ${_ld_version:[3]} +.elif ${_ld_version:[1]} == "LLD" +LINKER_TYPE= lld +_v= ${_ld_version:[2]} +.else +.error Unknown linker from LD=${LD}: ${_ld_version} +.endif +LINKER_VERSION!=echo "${_v:M[1-9].[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' + +.endif # !target(____)