mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
765f3e9327
Add make only function to convert strings to lowercase and uppercase. This can replace the `$(shell echo $(var) | tr 'a-z-' 'A-Z_')` pattern. Using the 'make' implementation results in being around 100 times faster.
15 lines
755 B
Makefile
15 lines
755 B
Makefile
include strings.mk
|
|
|
|
STRING_LOWER = abcdefghijklmnopqrstuvwxyz-123456789
|
|
STRING_UPPER = ABCDEFGHIJKLMNOPQRSTUVWXYZ-123456789
|
|
STRING_MACRO = ABCDEFGHIJKLMNOPQRSTUVWXYZ_123456789
|
|
|
|
test-lowercase:
|
|
$(Q)bash -c 'test "$(STRING_LOWER)" = "$(call lowercase,$(STRING_UPPER))" || { echo ERROR: "$(STRING_LOWER)" != "$(call lowercase,$(STRING_UPPER))"; exit 1; }'
|
|
|
|
test-uppercase:
|
|
$(Q)bash -c 'test "$(STRING_UPPER)" = "$(call uppercase,$(STRING_LOWER))" || { echo ERROR: "$(STRING_UPPER)" != "$(call uppercase,$(STRING_LOWER))"; exit 1; }'
|
|
|
|
test-uppercase_and_underscore:
|
|
$(Q)bash -c 'test "$(STRING_MACRO)" = "$(call uppercase_and_underscore,$(STRING_LOWER))" || { echo ERROR: "$(STRING_MACRO)" != "$(call uppercase_and_underscore,$(STRING_LOWER))"; exit 1; }'
|