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>
This commit is contained in:
committed by
Patrick Georgi
parent
77c7ecf73e
commit
3eefeea9d5
13
Makefile.inc
13
Makefile.inc
@ -81,6 +81,19 @@ classes-y := ramstage romstage bootblock smm smmstub cpu_microcode
|
||||
$(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 :=
|
||||
|
Reference in New Issue
Block a user