Chris Kay | 4731c00 | 2024-04-09 16:30:52 +0000 | [diff] [blame] | 1 | # |
| 2 | # Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | |
| 7 | space := |
| 8 | space := $(space) $(space) |
| 9 | comma := , |
| 10 | |
| 11 | null := � |
| 12 | |
| 13 | compat-path = $(subst $(space),$(null),$(1)) |
| 14 | decompat-path = $(subst $(null), ,$(1)) |
| 15 | |
| 16 | absolute-path = $(call decompat-path,$(abspath $(call compat-path,$(1)))) |
| 17 | real-path = $(call decompat-path,$(realpath $(call compat-path,$(1)))) |
| 18 | |
| 19 | file-name = $(call decompat-path,$(notdir $(call compat-path,$(1)))) |
| 20 | directory-name = $(call decompat-path,$(dir $(call compat-path,$(1)))) |
| 21 | |
| 22 | escape-shell = '$(subst ','\'',$(1))' |
Chris Kay | 3af4eb5 | 2024-05-29 22:09:26 +0000 | [diff] [blame^] | 23 | |
| 24 | # |
| 25 | # Upper-case a string value. |
| 26 | # |
| 27 | # Parameters: |
| 28 | # |
| 29 | # - $(1): The string to upper-case. |
| 30 | # |
| 31 | # Example usage: |
| 32 | # |
| 33 | # $(call uppercase,HeLlO wOrLd) # "HELLO WORLD" |
| 34 | # |
| 35 | |
| 36 | uppercase = $(shell echo $(call escape-shell,$(1)) | tr '[:lower:]' '[:upper:]') |
| 37 | |
| 38 | # |
| 39 | # Lower-case a string value. |
| 40 | # |
| 41 | # Parameters: |
| 42 | # |
| 43 | # - $(1): The string to lower-case. |
| 44 | # |
| 45 | # Example usage: |
| 46 | # |
| 47 | # $(call lowercase,HeLlO wOrLd) # "hello world" |
| 48 | # |
| 49 | |
| 50 | lowercase = $(shell echo $(call escape-shell,$(1)) | tr '[:upper:]' '[:lower:]') |