summaryrefslogtreecommitdiffstats
path: root/Makefile.inc
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2023-02-11 16:28:16 +0800
committerFelix Held <felix-coreboot@felixheld.de>2023-03-10 22:24:26 +0000
commitc1cc7eb8699f0858ecb3e5c9cc1150a067324c17 (patch)
treee9b16c6e2110b59090e61eb3abb14bbf27755750 /Makefile.inc
parent1ddb40f491e4e4487e243249cee062098fb6a17f (diff)
downloadcoreboot-c1cc7eb8699f0858ecb3e5c9cc1150a067324c17.tar.gz
coreboot-c1cc7eb8699f0858ecb3e5c9cc1150a067324c17.tar.bz2
coreboot-c1cc7eb8699f0858ecb3e5c9cc1150a067324c17.zip
top/Makefile.inc: add _tohex
Get string of hex value of a given number. Change-Id: I6d3525db19089938897b9d19ad9875bb07e0eecf Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/72953 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martin.roth@amd.corp-partner.google.com>
Diffstat (limited to 'Makefile.inc')
-rw-r--r--Makefile.inc1
1 files changed, 1 insertions, 0 deletions
diff --git a/Makefile.inc b/Makefile.inc
index 96121d40193b..7258043ff11d 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -141,6 +141,7 @@ $(foreach supported_arch,$(ARCH_SUPPORTED), \
# toupper: returns the value in all uppercase
# ws_to_under: returns the value with any whitespace changed to underscores
_toint=$(shell printf "%d" $1)
+_tohex=$(shell printf 0x"%x" $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-subtract=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) - $(call _toint,$(word 2,$1))))