aboutsummaryrefslogtreecommitdiff
path: root/share/mk/bsd.linker.mk
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2017-06-22 21:03:24 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2017-06-22 21:03:24 +0000
commit08154765caafe2f13a7087a97170710e7f50bee0 (patch)
tree198efda7901942c8b9312d05af7e85eac5efede6 /share/mk/bsd.linker.mk
parent125902b6af2f80381f628c8610785f5d1bb05bd6 (diff)
downloadsrc-08154765caafe2f13a7087a97170710e7f50bee0.tar.gz
src-08154765caafe2f13a7087a97170710e7f50bee0.zip
Notes
Diffstat (limited to 'share/mk/bsd.linker.mk')
-rw-r--r--share/mk/bsd.linker.mk26
1 files changed, 20 insertions, 6 deletions
diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk
index da34f0d70fa4..db554ef3e40d 100644
--- a/share/mk/bsd.linker.mk
+++ b/share/mk/bsd.linker.mk
@@ -9,25 +9,39 @@
# major * 10000 + minor * 100 + tiny
# It too can be overridden on the command line.
#
+# These variables with an X_ prefix will also be provided if XLD is set.
+#
# This file may be included multiple times, but only has effect the first time.
#
.if !target(__<bsd.linker.mk>__)
__<bsd.linker.mk>__:
-_ld_version!= ${LD} --version 2>/dev/null | head -n 1 || echo none
+.for ld X_ in LD $${_empty_var_} XLD X_
+.if ${ld} == "LD" || !empty(XLD)
+.if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD})
+
+_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}
+.error Unable to determine linker type from ${ld}=${${ld}}
.endif
.if ${_ld_version:[1..2]} == "GNU ld"
-LINKER_TYPE= binutils
+${X_}LINKER_TYPE= binutils
_v= ${_ld_version:[3]}
.elif ${_ld_version:[1]} == "LLD"
-LINKER_TYPE= lld
+${X_}LINKER_TYPE= lld
_v= ${_ld_version:[2]}
.else
-.error Unknown linker from LD=${LD}: ${_ld_version}
+.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;}'
+${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \
+ awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}'
+.undef _ld_version
+.undef _v
+.endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD})
+
+.endif # ${ld} == "LD" || !empty(XLD)
+.endfor # .for ld in LD XLD
+
.endif # !target(__<bsd.linker.mk>__)