This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 4c9e11d559 tools: Support string upper/lower case in make
4c9e11d559 is described below
commit 4c9e11d559a3a22b078e1a82096c53edc25066c9
Author: Huang Qi <[email protected]>
AuthorDate: Fri Jun 2 17:34:53 2023 +0800
tools: Support string upper/lower case in make
Implement UPPER_CASE/LOWER_CASE function in pure make, usage:
```
UPPER = $(call UPPER_CASE,$(xxx))
```
Signed-off-by: Huang Qi <[email protected]>
---
tools/Config.mk | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/Config.mk b/tools/Config.mk
index 9b9dbfbb4c..ef78ee2b7e 100644
--- a/tools/Config.mk
+++ b/tools/Config.mk
@@ -683,3 +683,14 @@ ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
else
CONVERT_PATH = $1
endif
+
+# Upper/Lower case string, add the `UL` prefix to private function
+
+ULPOP = $(wordlist 3,$(words $(1)),$(1))
+ULSUB = $(subst $(word 1,$(1)),$(word 2,$(1)),$(2))
+ULMAP = $(if $(1),$(call ULSUB,$(1),$(call ULMAP,$(call
ULPOP,$(1)),$(2))),$(2))
+UPPERMAP = a A b B c C d D e E f F g G h H i I j J k K l L m M n N o O p P q Q
r R s S t T u U v V w W x X y Y z Z
+LOWERMAP = A a B b C c D d E e F f G g H h I i J j K k L l M m N n O o P p Q q
R r S s T t U u V v W w X x Y y Z z
+
+UPPER_CASE = $(call ULMAP,$(UPPERMAP),$(1))
+LOWER_CASE = $(call ULMAP,$(LOWERMAP),$(1))