Skip to contentSkip to conversation

version_autogenerated.h: use printf rather than echo -n

PATCH New Mike Frysinger 2 participants 4 messages May 3, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 version_autogenerated.h: use printf rather than echo -n

Some systems are dumb and do not implement the -n flag to echo (like OS X). Convert the Makefile to use printf as this should work everywhere.

---
 Makefile |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
Makefile +3 -5
index ac0a17f..45d43aa 100644
@@ -352,11 +352,9 @@ $(U_BOOT_ONENAND):	$(ONENAND_IPL) $(obj)u-boot.bin $(obj)include/autoconf.mk
 		cat $(obj)onenand_ipl/onenand-ipl-4k.bin $(obj)u-boot.bin > $(obj)u-boot-flexonenand.bin
 
 $(VERSION_FILE):
-		@( echo -n "#define U_BOOT_VERSION \"U-Boot " ; \
-		echo -n "$(U_BOOT_VERSION)" ; \
-		echo -n $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion \
-			 $(TOPDIR)) ; \
-		echo "\"" ) > [email protected]
+		@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
+		 $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion $(TOPDIR)) \
+		 ) > [email protected]
 		@cmp -s $@ [email protected] && rm -f [email protected] || mv -f [email protected] $@
 
 gdbtools:
Signature · 1 line
1.5.5.1
#1 lore raw

PATCH 1/1 version_autogenerated.h: use printf rather than echo -n

Makefile $(U_BOOT_ONENAND): $(ONENAND_IPL) $(obj)u-boot.bin $(obj)include/autoconf.mk · line 357

Quoted 9 lines · Mike Frysinger

$(VERSION_FILE):

Makefile +3 -5
-		@( echo -n "#define U_BOOT_VERSION \"U-Boot " ; \
-		echo -n "$(U_BOOT_VERSION)" ; \
-		echo -n $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion \
-			 $(TOPDIR)) ; \
-		echo "\"" ) > [email protected]
+		@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
+		 $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion $(TOPDIR)) \
+		 ) > [email protected]

i realized this may break if the setlocalversion generates a space ... but i dont think that's possible ? if it is, then we should quote the $(shell ...) -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080502/6cdb6ea2/attachment.pgp

#2 lore raw

PATCH 1/1 version_autogenerated.h: use printf rather than echo -n

Quoted 14 lines · In message <[email protected]> you wrote:

Makefile $(U_BOOT_ONENAND): $(ONENAND_IPL) $(obj)u-boot.bin $(obj)include/autoconf.mk · line 357

Quoted 9 lines · Mike Frysinger

$(VERSION_FILE):

Makefile +3 -5
-		@( echo -n "#define U_BOOT_VERSION \"U-Boot " ; \
-		echo -n "$(U_BOOT_VERSION)" ; \
-		echo -n $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion \
-			 $(TOPDIR)) ; \
-		echo "\"" ) > [email protected]
+		@( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)">  \
+		 $(shell $(CONFIG_SHELL) $(TOPDIR)/tools/setlocalversion $(TOPDIR)) \
+		 ) > [email protected]

i realized this may break if the setlocalversion generates a space ... but i dont think that's possible ? if it is, then we should quote the $(shell ...)

I added quotes, just to be sure.

Thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Thought for the day: What if there were no hypothetical situations?
#3 lore raw

PATCH 1/1 version_autogenerated.h: use printf rather than echo -n

In reply to Mike Frysinger
Quoted 7 lines · In message <[email protected]> you wrote:

Some systems are dumb and do not implement the -n flag to echo (like OS X). Convert the Makefile to use printf as this should work everywhere.

---
 Makefile |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
That was the thing about deserts. They had their  own  gravity.  They
sucked you into the centre.           - Terry Pratchett, _Small Gods_