unix.mk 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #
  2. # Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
  3. #
  4. # SPDX-License-Identifier: BSD-3-Clause
  5. #
  6. # Trusted Firmware shell command definitions for a Unix style environment.
  7. ifndef UNIX_MK
  8. UNIX_MK := $(lastword $(MAKEFILE_LIST))
  9. DIR_DELIM := /
  10. PATH_SEP := :
  11. # These defines provide Unix style equivalents of the shell commands
  12. # required by the Trusted Firmware build environment.
  13. # ${1} is the file to be copied.
  14. # ${2} is the destination file name.
  15. define SHELL_COPY
  16. $(q)cp -f "${1}" "${2}"
  17. endef
  18. # ${1} is the directory to be copied.
  19. # ${2} is the destination directory path.
  20. define SHELL_COPY_TREE
  21. $(q)cp -rf "${1}" "${2}"
  22. endef
  23. # ${1} is the file to be deleted.
  24. define SHELL_DELETE
  25. -$(q)rm -f "${1}"
  26. endef
  27. # ${1} is a space delimited list of files to be deleted.
  28. # Note that we do not quote ${1}, as multiple parameters may be passed.
  29. define SHELL_DELETE_ALL
  30. -$(q)rm -rf ${1}
  31. endef
  32. define SHELL_REMOVE_DIR
  33. -$(q)rm -rf "${1}"
  34. endef
  35. nul := /dev/null
  36. which = $(shell command -v $(call escape-shell,$(1)) 2>$(nul))
  37. endif