Skip to contentSkip to conversation

Makefile: use $(shell ...) for determining file_size

PATCH New Chris Packham 3 participants 3 messages Jul 24, 2014 – Aug 10, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Makefile: use $(shell ...) for determining file_size

file_size was being calculated using back-ticks but map_size uses $(shell ...). Update the file_size calculation to use $(shell ...).

From: Jeroen Hofstee <[email protected]>

The binary_size_check target relies on stat -c %s
to return the size of u-boot.bin. This only works
with GNU stat though. Use wc instead.

---
The back ticks didn't work in my environment (GNU Make 3.81). Updating to use $(shell ...) makes sense from a consistency view even if the problem is my environment.

Changes in v2:
- Restore the missing @ that was unintentionally removed in v1
- Incorporate Jeroen's change http://patchwork.ozlabs.org/patch/371936/

 Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index ca212b5..b98a80a 100644
@@ -786,7 +786,7 @@ u-boot.hex u-boot.srec: u-boot FORCE
 OBJCOPYFLAGS_u-boot.bin := -O binary
 
 binary_size_check: u-boot.bin System.map FORCE
-	@file_size=`stat -c %s u-boot.bin` ; \
+	@file_size=$(shell wc -c u-boot.bin | awk '{print $$1}') ; \
 	map_size=$(shell cat System.map | \
 		awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \
 		| bc); \
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/1 Makefile: use $(shell ...) for determining file_size

Quoted 10 lines · Chris Packham

file_size was being calculated using back-ticks but map_size uses $(shell ...). Update the file_size calculation to use $(shell ...).

From: Jeroen Hofstee <[email protected]>

The binary_size_check target relies on stat -c %s
to return the size of u-boot.bin. This only works
with GNU stat though. Use wc instead.

Thanks for joining these.

#2 lore raw

PATCH v2 1/1 Makefile: use $(shell ...) for determining file_size

In reply to Chris Packham
Quoted 11 lines · Chris Packham

file_size was being calculated using back-ticks but map_size uses $(shell ...). Update the file_size calculation to use $(shell ...).

From: Jeroen Hofstee <[email protected]>

The binary_size_check target relies on stat -c %s to return the size of u-boot.bin. This only works with GNU stat though. Use wc instead.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140810/373ea3b9/attachment.pgp>