windows.mk 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #
  2. # Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
  3. #
  4. # SPDX-License-Identifier: BSD-3-Clause
  5. #
  6. # OS specific parts for builds in a Windows_NT environment. The
  7. # environment variable OS is set to Windows_NT on all modern Windows platforms
  8. # Include generic windows command definitions.
  9. ifndef WINDOWS_MK
  10. WINDOWS_MK := $(lastword $(MAKEFILE_LIST))
  11. DIR_DELIM := $(strip \)
  12. BIN_EXT := .exe
  13. PATH_SEP := ;
  14. # For some Windows native commands there is a problem with the directory delimiter.
  15. # Make uses / (slash) and the commands expect \ (backslash)
  16. # We have to provide a means of translating these, so we define local functions.
  17. # ${1} is the file to be copied.
  18. # ${2} is the destination file name.
  19. define SHELL_COPY
  20. $(eval tmp_from_file:=$(subst /,\,${1}))
  21. $(eval tmp_to_file:=$(subst /,\,${2}))
  22. copy "${tmp_from_file}" "${tmp_to_file}"
  23. endef
  24. # ${1} is the directory to be copied.
  25. # ${2} is the destination directory path.
  26. define SHELL_COPY_TREE
  27. $(eval tmp_from_dir:=$(subst /,\,${1}))
  28. $(eval tmp_to_dir:=$(subst /,\,${2}))
  29. xcopy /HIVE "${tmp_from_dir}" "${tmp_to_dir}"
  30. endef
  31. # ${1} is the file to be deleted.
  32. define SHELL_DELETE
  33. $(eval tmp_del_file:=$(subst /,\,${*}))
  34. -@if exist $(tmp_del_file) del /Q $(tmp_del_file)
  35. endef
  36. # ${1} is a space delimited list of files to be deleted.
  37. define SHELL_DELETE_ALL
  38. $(eval $(foreach filename,$(wildcard ${1}),$(call DELETE_IF_THERE,${filename})))
  39. endef
  40. # ${1} is the directory to be removed.
  41. define SHELL_REMOVE_DIR
  42. $(eval tmp_dir:=$(subst /,\,${1}))
  43. -@if exist "$(tmp_dir)" rd /Q /S "$(tmp_dir)"
  44. endef
  45. nul := nul
  46. which = $(shell where "$(1)" 2>$(nul))
  47. endif
  48. # Because git is not available from CMD.EXE, we need to avoid
  49. # the BUILD_STRING generation which uses git.
  50. # For now we use "development build".
  51. # This can be overridden from the command line or environment.
  52. BUILD_STRING ?= development build
  53. MSVC_NMAKE := nmake.exe