From 67c0a9b10b74cb56d863245bc2ccadd302b11924 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 24 Oct 2019 01:33:50 +0200 Subject: [PATCH] - helpers.mk: add case conversion macros; stolen from buildroot --- make/helpers.mk | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/make/helpers.mk b/make/helpers.mk index 8a120714..3960e938 100644 --- a/make/helpers.mk +++ b/make/helpers.mk @@ -60,6 +60,26 @@ endef # ----------------------------------------------------------------------------- +# +# Case conversion macros. +# + +[LOWER] := a b c d e f g h i j k l m n o p q r s t u v w x y z +[UPPER] := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z + +define caseconvert-helper +$(1) = $$(strip \ + $$(eval __tmp := $$(1))\ + $(foreach c, $(2),\ + $$(eval __tmp := $$(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)),$$(__tmp))))\ + $$(__tmp)) +endef + +$(eval $(call caseconvert-helper,UPPERCASE,$(join $(addsuffix :,$([LOWER])),$([UPPER])))) +$(eval $(call caseconvert-helper,LOWERCASE,$(join $(addsuffix :,$([UPPER])),$([LOWER])))) + +# ----------------------------------------------------------------------------- + # # $(1) = title # $(2) = color