Browse Source

- helpers.mk: add case conversion macros; stolen from buildroot

master
vanhofen 5 years ago
parent
commit
67c0a9b10b
  1. 20
      make/helpers.mk

20
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

Loading…
Cancel
Save