bsd.linker.mk (08154765caafe2f13a7087a97170710e7f50bee0) | bsd.linker.mk (19fad65511484261b44a1f73381f71262315610c) |
---|---|
1# $FreeBSD$ 2 3# Setup variables for the linker. 4# 5# LINKER_TYPE is the major type of linker. Currently binutils and lld support 6# automatic detection. 7# 8# LINKER_VERSION is a numeric constant equal to: --- 5 unchanged lines hidden (view full) --- 14# This file may be included multiple times, but only has effect the first time. 15# 16 17.if !target(__<bsd.linker.mk>__) 18__<bsd.linker.mk>__: 19 20.for ld X_ in LD $${_empty_var_} XLD X_ 21.if ${ld} == "LD" || !empty(XLD) | 1# $FreeBSD$ 2 3# Setup variables for the linker. 4# 5# LINKER_TYPE is the major type of linker. Currently binutils and lld support 6# automatic detection. 7# 8# LINKER_VERSION is a numeric constant equal to: --- 5 unchanged lines hidden (view full) --- 14# This file may be included multiple times, but only has effect the first time. 15# 16 17.if !target(__<bsd.linker.mk>__) 18__<bsd.linker.mk>__: 19 20.for ld X_ in LD $${_empty_var_} XLD X_ 21.if ${ld} == "LD" || !empty(XLD) |
22# Try to import LINKER_TYPE and LINKER_VERSION from parent make. 23# The value is only used/exported for the same environment that impacts 24# LD and LINKER_* settings here. 25_exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION 26${X_}_ld_hash= ${${ld}}${MACHINE}${PATH} 27${X_}_ld_hash:= ${${X_}_ld_hash:hash} 28# Only import if none of the vars are set somehow else. 29_can_export= yes 30.for var in ${_exported_vars} 31.if defined(${var}) 32_can_export= no 33.endif 34.endfor 35.if ${_can_export} == yes 36.for var in ${_exported_vars} 37.if defined(${var}.${${X_}_ld_hash}) 38${var}= ${${var}.${${X_}_ld_hash}} 39.endif 40.endfor 41.endif 42 |
|
22.if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) 23 24_ld_version!= ${${ld}} --version 2>/dev/null | head -n 1 || echo none 25.if ${_ld_version} == "none" 26.error Unable to determine linker type from ${ld}=${${ld}} 27.endif 28.if ${_ld_version:[1..2]} == "GNU ld" 29${X_}LINKER_TYPE= binutils --- 5 unchanged lines hidden (view full) --- 35.error Unknown linker from ${ld}=${${ld}}: ${_ld_version} 36.endif 37${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \ 38 awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' 39.undef _ld_version 40.undef _v 41.endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) 42 | 43.if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) 44 45_ld_version!= ${${ld}} --version 2>/dev/null | head -n 1 || echo none 46.if ${_ld_version} == "none" 47.error Unable to determine linker type from ${ld}=${${ld}} 48.endif 49.if ${_ld_version:[1..2]} == "GNU ld" 50${X_}LINKER_TYPE= binutils --- 5 unchanged lines hidden (view full) --- 56.error Unknown linker from ${ld}=${${ld}}: ${_ld_version} 57.endif 58${X_}LINKER_VERSION!= echo "${_v:M[1-9].[0-9]*}" | \ 59 awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' 60.undef _ld_version 61.undef _v 62.endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) 63 |
64# Export the values so sub-makes don't have to look them up again, using the 65# hash key computed above. 66.for var in ${_exported_vars} 67${var}.${${X_}_ld_hash}:= ${${var}} 68.export-env ${var}.${${X_}_ld_hash} 69.undef ${var}.${${X_}_ld_hash} 70.endfor 71 |
|
43.endif # ${ld} == "LD" || !empty(XLD) 44.endfor # .for ld in LD XLD 45 46 47.endif # !target(__<bsd.linker.mk>__) | 72.endif # ${ld} == "LD" || !empty(XLD) 73.endfor # .for ld in LD XLD 74 75 76.endif # !target(__<bsd.linker.mk>__) |