blob: fa7722a6c6a02c666856308def8ff6a0713dc9e8 [file] [log] [blame]
Evan Lloyd26c6cb42015-12-02 18:33:55 +00001#
Chris Kay2c09bf62024-04-09 16:30:52 +00002# Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
Evan Lloyd26c6cb42015-12-02 18:33:55 +00003#
dp-armfa3cf0b2017-05-03 09:38:09 +01004# SPDX-License-Identifier: BSD-3-Clause
Evan Lloyd26c6cb42015-12-02 18:33:55 +00005#
Evan Lloyd26c6cb42015-12-02 18:33:55 +00006
7# Trusted Firmware shell command definitions for a Unix style environment.
8
9ifndef UNIX_MK
10 UNIX_MK := $(lastword $(MAKEFILE_LIST))
11
Evan Lloyd26c6cb42015-12-02 18:33:55 +000012 DIR_DELIM := /
13 PATH_SEP := :
14
15 # These defines provide Unix style equivalents of the shell commands
16 # required by the Trusted Firmware build environment.
17
18 # ${1} is the file to be copied.
19 # ${2} is the destination file name.
20 define SHELL_COPY
Chris Kay1870c722024-05-02 17:52:37 +000021 $(q)cp -f "${1}" "${2}"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000022 endef
23
24 # ${1} is the directory to be copied.
25 # ${2} is the destination directory path.
26 define SHELL_COPY_TREE
Chris Kay1870c722024-05-02 17:52:37 +000027 $(q)cp -rf "${1}" "${2}"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000028 endef
29
30 # ${1} is the file to be deleted.
31 define SHELL_DELETE
Chris Kay1870c722024-05-02 17:52:37 +000032 -$(q)rm -f "${1}"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000033 endef
34
35 # ${1} is a space delimited list of files to be deleted.
36 # Note that we do not quote ${1}, as multiple parameters may be passed.
37 define SHELL_DELETE_ALL
Chris Kay1870c722024-05-02 17:52:37 +000038 -$(q)rm -rf ${1}
Evan Lloyd26c6cb42015-12-02 18:33:55 +000039 endef
40
Evan Lloyd26c6cb42015-12-02 18:33:55 +000041 define SHELL_REMOVE_DIR
Chris Kay1870c722024-05-02 17:52:37 +000042 -$(q)rm -rf "${1}"
Evan Lloyd26c6cb42015-12-02 18:33:55 +000043 endef
44
Chris Kayc8a47ba2023-10-20 09:17:33 +000045 nul := /dev/null
46
Chris Kay2c09bf62024-04-09 16:30:52 +000047 which = $(shell command -v $(call escape-shell,$(1)) 2>$(nul))
Evan Lloyd26c6cb42015-12-02 18:33:55 +000048endif