build: add string casing facilities to utilities
This is a small modification to two existing functions in the build
system: `uppercase` and `lowercase`.
These functions have been moved to the common utilities makefile, and
use the `tr` tool to simplify their implementation. Behaviour is, for
virtually all use-cases, identical.
Change-Id: I0e459d92e454087e4188b2fa5968244e5db89906
Signed-off-by: Chris Kay <chris.kay@arm.com>
diff --git a/make_helpers/utilities.mk b/make_helpers/utilities.mk
index 62769fb..5bb1806 100644
--- a/make_helpers/utilities.mk
+++ b/make_helpers/utilities.mk
@@ -20,3 +20,31 @@
directory-name = $(call decompat-path,$(dir $(call compat-path,$(1))))
escape-shell = '$(subst ','\'',$(1))'
+
+#
+# Upper-case a string value.
+#
+# Parameters:
+#
+# - $(1): The string to upper-case.
+#
+# Example usage:
+#
+# $(call uppercase,HeLlO wOrLd) # "HELLO WORLD"
+#
+
+uppercase = $(shell echo $(call escape-shell,$(1)) | tr '[:lower:]' '[:upper:]')
+
+#
+# Lower-case a string value.
+#
+# Parameters:
+#
+# - $(1): The string to lower-case.
+#
+# Example usage:
+#
+# $(call lowercase,HeLlO wOrLd) # "hello world"
+#
+
+lowercase = $(shell echo $(call escape-shell,$(1)) | tr '[:upper:]' '[:lower:]')