diff options
author | Patrick Georgi <patrick@georgi-clan.de> | 2014-11-12 19:11:50 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2014-11-14 15:12:33 +0100 |
commit | 3eefeea9d58ab2896aec7ded7aa1a15e8e9fa72c (patch) | |
tree | 5d666431a83a9afae3f0db82ef7e5d1d3dd48ab1 /Makefile.inc | |
parent | 77c7ecf73e513d19375d808aee5663e7bb597dd4 (diff) | |
download | coreboot-3eefeea9d58ab2896aec7ded7aa1a15e8e9fa72c.tar.xz |
build system: improve portability
There are too many differences, and calculating relatively
large integer using floats might not be the brightest idea
anyway.
Also avoid relying on ls(1) output format to determine file sizes.
Change-Id: I5f96c036737b74e20f525c3dc9edc011ad403662
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: http://review.coreboot.org/7447
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'Makefile.inc')
-rw-r--r-- | Makefile.inc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Makefile.inc b/Makefile.inc index 1aa4ddefda..a7854fcd9a 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -82,6 +82,19 @@ $(foreach supported_arch,$(ARCH_SUPPORTED), \ $(eval $(call define_class,rmodules_$(supported_arch),$(supported_arch)))) ####################################################################### +# Helper functions for various file placement matters +# +# int-add: adds an arbitrary number of space-separated integers in +# all formats understood by printf(1) +# int-align: align $1 to $2 units +# file-size: returns the filesize of the given file +_toint=$(shell printf "%d" $1) +_int-add2=$(shell expr $(call _toint,$1) + $(call _toint,$2)) +int-add=$(if $(filter 1,$(words $1)),$(strip $1),$(call int-add,$(call _int-add2,$(word 1,$1),$(word 2,$1)) $(wordlist 3,$(words $1),$1))) +int-align=$(shell expr $(call _toint,$1) + $(call _toint,$2) - 1 - $(call _toint,$1) % $(call _toint,$2)) +file-size=$(shell cat $1 | wc -c) + +####################################################################### # Helper functions for ramstage postprocess spc := spc += |