xref: /rk3399_ARM-atf/make_helpers/utilities.mk (revision 3af4eb50c0b29474eaa05d62673abc796348bd5c)
14731c00bSChris Kay#
24731c00bSChris Kay# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
34731c00bSChris Kay#
44731c00bSChris Kay# SPDX-License-Identifier: BSD-3-Clause
54731c00bSChris Kay#
64731c00bSChris Kay
74731c00bSChris Kayspace :=
84731c00bSChris Kayspace := $(space) $(space)
94731c00bSChris Kaycomma := ,
104731c00bSChris Kay
114731c00bSChris Kaynull := �
124731c00bSChris Kay
134731c00bSChris Kaycompat-path = $(subst $(space),$(null),$(1))
144731c00bSChris Kaydecompat-path = $(subst $(null), ,$(1))
154731c00bSChris Kay
164731c00bSChris Kayabsolute-path = $(call decompat-path,$(abspath $(call compat-path,$(1))))
174731c00bSChris Kayreal-path = $(call decompat-path,$(realpath $(call compat-path,$(1))))
184731c00bSChris Kay
194731c00bSChris Kayfile-name = $(call decompat-path,$(notdir $(call compat-path,$(1))))
204731c00bSChris Kaydirectory-name = $(call decompat-path,$(dir $(call compat-path,$(1))))
214731c00bSChris Kay
224731c00bSChris Kayescape-shell = '$(subst ','\'',$(1))'
23*3af4eb50SChris Kay
24*3af4eb50SChris Kay#
25*3af4eb50SChris Kay# Upper-case a string value.
26*3af4eb50SChris Kay#
27*3af4eb50SChris Kay# Parameters:
28*3af4eb50SChris Kay#
29*3af4eb50SChris Kay#   - $(1): The string to upper-case.
30*3af4eb50SChris Kay#
31*3af4eb50SChris Kay# Example usage:
32*3af4eb50SChris Kay#
33*3af4eb50SChris Kay#     $(call uppercase,HeLlO wOrLd) # "HELLO WORLD"
34*3af4eb50SChris Kay#
35*3af4eb50SChris Kay
36*3af4eb50SChris Kayuppercase = $(shell echo $(call escape-shell,$(1)) | tr '[:lower:]' '[:upper:]')
37*3af4eb50SChris Kay
38*3af4eb50SChris Kay#
39*3af4eb50SChris Kay# Lower-case a string value.
40*3af4eb50SChris Kay#
41*3af4eb50SChris Kay# Parameters:
42*3af4eb50SChris Kay#
43*3af4eb50SChris Kay#   - $(1): The string to lower-case.
44*3af4eb50SChris Kay#
45*3af4eb50SChris Kay# Example usage:
46*3af4eb50SChris Kay#
47*3af4eb50SChris Kay#     $(call lowercase,HeLlO wOrLd) # "hello world"
48*3af4eb50SChris Kay#
49*3af4eb50SChris Kay
50*3af4eb50SChris Kaylowercase = $(shell echo $(call escape-shell,$(1)) | tr '[:upper:]' '[:lower:]')
51