[coreboot-gerrit] Patch set updated for coreboot: Makefile.inc: Add toupper, tolower, and ws_to_under macros

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Mon Mar 14 23:53:35 CET 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14093

-gerrit

commit 564697e47a897d49ee0b13bfa4cb90ff9d75e931
Author: Martin Roth <martinroth at google.com>
Date:   Mon Mar 14 15:07:14 2016 -0600

    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 at google.com>
---
 Makefile.inc | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile.inc b/Makefile.inc
index a07f92a..a70ff5c 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



More information about the coreboot-gerrit mailing list