Makefile: fix custom toolchain building with 4.3+
PATCH 1/1 Makefile: fix custom toolchain building with 4.3+
make 4.3 has backward-incompatibility change which breaks builds that use custom toolchains
--- Makefile | 14 ++++++++++++++ toolchain/helpers.mk | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-)
Makefile +14 -0
@@ -105,6 +105,20 @@ ifneq ($(firstword $(sort $(RUNNING_MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MA $(error You have make '$(RUNNING_MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required) endif +# make 4.3: +# https://lwn.net/Articles/810071/ +# Number signs (#) appearing inside a macro reference or function invocation +# no longer introduce comments and should not be escaped with backslashes: +# thus a call such as: +# foo := $(shell echo '#') +# is legal. Previously the number sign needed to be escaped, for example: +# foo := $(shell echo '\#') +# Now this latter will resolve to "\#". If you want to write makefiles +# portable to both versions, assign the number sign to a variable: +# H := \# +# foo := $(shell echo '$H') +SHARP_SIGN := \# + # absolute path TOPDIR := $(CURDIR) CONFIG_CONFIG_IN = Config.in
toolchain/helpers.mk +4 -4
@@ -119,12 +119,12 @@ copy_toolchain_sysroot = \ done ; \ for link in $$(find $(STAGING_DIR) -type l); do \ target=$$(readlink $${link}) ; \ - if [ "$${target}" == "$${target\#/}" ] ; then \ + if [ "$${target}" == "$${target$(SHARP_SIGN)/}" ] ; then \ continue ; \ fi ; \ - relpath="$(call relpath_prefix,$${target\#/})" ; \ - echo "Fixing symlink $${link} from $${target} to $${relpath}$${target\#/}" ; \ - ln -sf $${relpath}$${target\#/} $${link} ; \ + relpath="$(call relpath_prefix,$${target$(SHARP_SIGN)/})" ; \ + echo "Fixing symlink $${link} from $${target} to $${relpath}$${target$(SHARP_SIGN)/}" ; \ + ln -sf $${relpath}$${target$(SHARP_SIGN)/} $${link} ; \ done ; \ relpath="$(call relpath_prefix,$${ARCH_LIB_DIR})" ; \ if [ "$${relpath}" != "" ]; then \
Signature · 1 line
2.26.0
Yann E. MORIN
AppliedPATCH 1/1 Makefile: fix custom toolchain building with 4.3+
Yaroslav, All,
On 2020-03-30 16:41 +0300, Yaroslav Syrytsia spake thusly:
Quoted 4 lines
make 4.3 has backward-incompatibility change which breaks builds that use custom toolchains
Signed-off-by Yaroslav Syrytsia <[email protected]>
I've moved the definition of SHARP_SIGN to the utility helper .mk file, and expanded the commit log.
Applied to master, thanks!
Regards,
Yann E. MORIN.
Quoted 54 lines
--- Makefile | 14 ++++++++++++++ toolchain/helpers.mk | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-)Makefile +14
-0@@ -105,6 +105,20 @@ ifneq ($(firstword $(sort $(RUNNING_MAKE_VERSION) $(MIN_MAKE_VERSION))),$(MIN_MA $(error You have make '$(RUNNING_MAKE_VERSION)' installed. GNU make >= $(MIN_MAKE_VERSION) is required) endif +# make 4.3: +# https://lwn.net/Articles/810071/ +# Number signs (#) appearing inside a macro reference or function invocation +# no longer introduce comments and should not be escaped with backslashes: +# thus a call such as: +# foo := $(shell echo '#') +# is legal. Previously the number sign needed to be escaped, for example: +# foo := $(shell echo '\#') +# Now this latter will resolve to "\#". If you want to write makefiles +# portable to both versions, assign the number sign to a variable: +# H := \# +# foo := $(shell echo '$H') +SHARP_SIGN := \# + # absolute path TOPDIR := $(CURDIR) CONFIG_CONFIG_IN = Config.intoolchain/helpers.mk +4
-4@@ -119,12 +119,12 @@ copy_toolchain_sysroot = \ done ; \ for link in $$(find $(STAGING_DIR) -type l); do \ target=$$(readlink $${link}) ; \ - if [ "$${target}" == "$${target\#/}" ] ; then \ + if [ "$${target}" == "$${target$(SHARP_SIGN)/}" ] ; then \ continue ; \ fi ; \ - relpath="$(call relpath_prefix,$${target\#/})" ; \ - echo "Fixing symlink $${link} from $${target} to $${relpath}$${target\#/}" ; \ - ln -sf $${relpath}$${target\#/} $${link} ; \ + relpath="$(call relpath_prefix,$${target$(SHARP_SIGN)/})" ; \ + echo "Fixing symlink $${link} from $${target} to $${relpath}$${target$(SHARP_SIGN)/}" ; \ + ln -sf $${relpath}$${target$(SHARP_SIGN)/} $${link} ; \ done ; \ relpath="$(call relpath_prefix,$${ARCH_LIB_DIR})" ; \ if [ "$${relpath}" != "" ]; then \Signature · 1 line
2.26.0
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 Makefile: fix custom toolchain building with 4.3+
In reply to Yaroslav SyrytsiaQuoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yaroslav" == Yaroslav Syrytsia <[email protected]> writes:
make 4.3 has backward-incompatibility change which breaks builds that use custom toolchains
Signed-off-by Yaroslav Syrytsia <[email protected]>
Committed to 2019.02.x, 2019.11.x and 2020.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard