diff options
author | Martin Roth <martinroth@google.com> | 2016-03-14 15:07:14 -0600 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2016-03-15 21:18:28 +0100 |
commit | 621dd8468ff1ccc915498c5ee8db824ab286193e (patch) | |
tree | aa5ebdb004225cb1813a3d1a4107d96c7ffbc718 | |
parent | 9125073d2af2e1c34977c9caeb5f9c5710d5b9c4 (diff) | |
download | coreboot-621dd8468ff1ccc915498c5ee8db824ab286193e.tar.xz |
Makefile.inc: Add toupper, tolower, and ws_to_under macros
Add a few additional macros that can be used throughout the coreboot
makefiles.
tolower: returns the value in all lowercase
toupper: returns the value in all uppercase
ws_to_under: returns the value with any whitespace changed to underscores
Change-Id: Icd0e6586481d8f229af0e899e0c94ef7c5c672c3
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/14093
Tested-by: build bot (Jenkins)
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r-- | Makefile.inc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Makefile.inc b/Makefile.inc index a07f92a800..a70ff5c2ce 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -94,7 +94,7 @@ $(foreach supported_arch,$(ARCH_SUPPORTED), \ $(eval rmodules_$(supported_arch)-generic-ccopts += -D__RMODULE__)) ####################################################################### -# Helper functions for math and various file placement matters. +# Helper functions for math, strings, and various file placement matters. # macros work on all formats understood by printf(1) # values are space separated if using more than one value # @@ -108,6 +108,9 @@ $(foreach supported_arch,$(ARCH_SUPPORTED), \ # int-eq: 1 if the two values are equal. 0 otherwise # int-align: align $1 to $2 units # file-size: returns the filesize of the given file +# tolower: returns the value in all lowercase +# toupper: returns the value in all uppercase +# ws_to_under: returns the value with any whitespace changed to underscores _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))) @@ -121,6 +124,9 @@ int-gt=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(wor int-eq=$(if $(filter 1,$(words $1)),$(strip $1),$(shell expr $(call _toint,$(word 1,$1)) = $(call _toint,$(word 2,$1)))) int-align=$(shell A=$(call _toint,$1) B=$(call _toint,$2); expr $$A + \( \( $$B - \( $$A % $$B \) \) % $$B \) ) file-size=$(shell cat $1 | wc -c) +tolower=$(shell echo '$1' | tr '[:upper:]' '[:lower:]') +toupper=$(shell echo '$1' | tr '[:lower:]' '[:upper:]') +ws_to_under=$(shell echo '$1' | tr ' \t' '_') ####################################################################### # Helper functions for ramstage postprocess |