mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: barebox@lists.infradead.org
Cc: Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 3/5] kbuild: rename barebox-pbl-common to BAREBOX_PBL_OBJS
Date: Tue, 10 Mar 2020 20:28:14 +0900	[thread overview]
Message-ID: <20200310112816.7415-3-masahiroy@kernel.org> (raw)
In-Reply-To: <20200310112816.7415-1-masahiroy@kernel.org>

'export barebox-pbl-common' does not work reliably because hyphens
are disallowed in shell variables.

This caused a problem in Linux in the past. See Linux commit 2bfbe7881ee0
("kbuild: Do not use hyphen in exported variable name").

The same problem occurs when you build barebox with O= and the directory
path to the source tree contains a shell special character like '~'.

The maintainer of GNU Make stated that there is no consistent way to
export variables that do not meet the shell's naming criteria.
(https://savannah.gnu.org/bugs/?55719)

Consequently, you cannot use hyphens in exported variables.

Rename barebox-pbl-common to BAREBOX_PBL_OBJS.

I named it after KBUILD_VMLINUX_OBJS in the Linux top Makefile.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 Makefile               | 5 ++---
 arch/mips/pbl/Makefile | 2 +-
 images/Makefile        | 4 ++--
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index e9e412af0815..20fa85ed8be4 100644
--- a/Makefile
+++ b/Makefile
@@ -584,8 +584,7 @@ export DEFAULT_COMPRESSION_SUFFIX
 # System.map is generated to document addresses of all kernel symbols
 
 barebox-common := $(common-y)
-barebox-pbl-common := $(pbl-common-y)
-export barebox-pbl-common
+export BAREBOX_PBL_OBJS := $(pbl-common-y)
 barebox-all    := $(barebox-common)
 barebox-lds    := $(lds-y)
 
@@ -777,7 +776,7 @@ barebox.srec: barebox
 
 # The actual objects are generated when descending,
 # make sure no implicit rule kicks in
-$(sort $(barebox-common) ) $(barebox-lds) $(barebox-pbl-common): $(barebox-dirs) ;
+$(sort $(barebox-common) ) $(barebox-lds) $(BAREBOX_PBL_OBJS): $(barebox-dirs) ;
 
 # Handle descending into subdirectories listed in $(barebox-dirs)
 # Preset locale variables to speed up the build process. Limit locale
diff --git a/arch/mips/pbl/Makefile b/arch/mips/pbl/Makefile
index 44ce3d1c922e..8f9e9fe5931c 100644
--- a/arch/mips/pbl/Makefile
+++ b/arch/mips/pbl/Makefile
@@ -25,7 +25,7 @@ $(obj)/zbarebox.S: $(obj)/zbarebox FORCE
 PBL_CPPFLAGS		+= -fdata-sections -ffunction-sections
 LDFLAGS_zbarebox	:= -Map $(obj)/zbarebox.map
 LDFLAGS_zbarebox	+= -static --gc-sections
-zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o)
+zbarebox-common := $(BAREBOX_PBL_OBJS) $(obj)/$(piggy_o)
 zbarebox-lds := $(obj)/zbarebox.lds
 
 quiet_cmd_zbarebox__ ?= LD      $@
diff --git a/images/Makefile b/images/Makefile
index 650baf170f1b..fe29c75e27b1 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -57,12 +57,12 @@ quiet_cmd_elf__ ?= LD      $@
       cmd_elf__ ?= $(LD) $(LDFLAGS_pbl) --gc-sections		\
 		-e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@		\
 		-T $(pbl-lds)						\
-		--start-group $(barebox-pbl-common) $(obj)/piggy.o	\
+		--start-group $(BAREBOX_PBL_OBJS) $(obj)/piggy.o	\
 		$(obj)/sha_sum.o --end-group
 
 PBL_CPPFLAGS	+= -fdata-sections -ffunction-sections
 
-$(obj)/%.pbl: $(pbl-lds) $(barebox-pbl-common) $(obj)/piggy.o $(obj)/sha_sum.o FORCE
+$(obj)/%.pbl: $(pbl-lds) $(BAREBOX_PBL_OBJS) $(obj)/piggy.o $(obj)/sha_sum.o FORCE
 	$(call if_changed,elf__,$(*F))
 
 $(obj)/%.pblb: $(obj)/%.pbl FORCE
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-03-10 11:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10 11:28 [PATCH 1/5] kbuild: remove unused barebox-head Masahiro Yamada
2020-03-10 11:28 ` [PATCH 2/5] kbuild: remove dead code for modpost Masahiro Yamada
2020-03-10 11:28 ` Masahiro Yamada [this message]
2020-03-10 11:28 ` [PATCH 4/5] kbuild: rename barebox-{common, lds} to BAREBOX_{OBJS, LDS} Masahiro Yamada
2020-03-10 11:28 ` [PATCH 5/5] kbuild: replace barebox-all with BAREBOX_OBJS Masahiro Yamada
2020-03-11 15:11 ` [PATCH 1/5] kbuild: remove unused barebox-head Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200310112816.7415-3-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox