unix.mk 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #
  2. # Copyright (c) 2016-2018, 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. ECHO_BLANK_LINE := echo
  10. ECHO_QUIET := @\#
  11. DIR_DELIM := /
  12. PATH_SEP := :
  13. # These defines provide Unix style equivalents of the shell commands
  14. # required by the Trusted Firmware build environment.
  15. # ${1} is the file to be copied.
  16. # ${2} is the destination file name.
  17. define SHELL_COPY
  18. ${Q}cp -f "${1}" "${2}"
  19. endef
  20. # ${1} is the directory to be copied.
  21. # ${2} is the destination directory path.
  22. define SHELL_COPY_TREE
  23. ${Q}cp -rf "${1}" "${2}"
  24. endef
  25. # ${1} is the file to be deleted.
  26. define SHELL_DELETE
  27. -${Q}rm -f "${1}"
  28. endef
  29. # ${1} is a space delimited list of files to be deleted.
  30. # Note that we do not quote ${1}, as multiple parameters may be passed.
  31. define SHELL_DELETE_ALL
  32. -${Q}rm -rf ${1}
  33. endef
  34. # ${1} is the directory to be generated.
  35. # ${2} is optional, and allows a prerequisite to be specified.
  36. # Do nothing if $1 == $2, to ignore self dependencies.
  37. define MAKE_PREREQ_DIR
  38. ifneq (${1},${2})
  39. ${1} : ${2}
  40. ${Q}mkdir -p "${1}"
  41. endif
  42. endef
  43. define SHELL_REMOVE_DIR
  44. -${Q}rm -rf "${1}"
  45. endef
  46. nul := /dev/null
  47. which = $(shell which $(1) 2>$(nul))
  48. endif