Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 1 | # |
Chris Kay | 523e864 | 2023-12-04 12:03:51 +0000 | [diff] [blame] | 2 | # Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved. |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 3 | # |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | # SPDX-License-Identifier: BSD-3-Clause |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 5 | # |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 6 | |
| 7 | # OS specific parts for builds in a Windows_NT environment. The |
| 8 | # environment variable OS is set to Windows_NT on all modern Windows platforms |
| 9 | |
| 10 | # Include generic windows command definitions. |
| 11 | |
| 12 | ifndef WINDOWS_MK |
| 13 | WINDOWS_MK := $(lastword $(MAKEFILE_LIST)) |
| 14 | |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 15 | DIR_DELIM := $(strip \) |
Evan Lloyd | 004c9a5 | 2015-12-03 11:35:40 +0000 | [diff] [blame] | 16 | BIN_EXT := .exe |
| 17 | PATH_SEP := ; |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 18 | |
| 19 | # For some Windows native commands there is a problem with the directory delimiter. |
| 20 | # Make uses / (slash) and the commands expect \ (backslash) |
| 21 | # We have to provide a means of translating these, so we define local functions. |
| 22 | |
| 23 | # ${1} is the file to be copied. |
| 24 | # ${2} is the destination file name. |
| 25 | define SHELL_COPY |
| 26 | $(eval tmp_from_file:=$(subst /,\,${1})) |
| 27 | $(eval tmp_to_file:=$(subst /,\,${2})) |
| 28 | copy "${tmp_from_file}" "${tmp_to_file}" |
| 29 | endef |
| 30 | |
| 31 | # ${1} is the directory to be copied. |
| 32 | # ${2} is the destination directory path. |
| 33 | define SHELL_COPY_TREE |
| 34 | $(eval tmp_from_dir:=$(subst /,\,${1})) |
| 35 | $(eval tmp_to_dir:=$(subst /,\,${2})) |
| 36 | xcopy /HIVE "${tmp_from_dir}" "${tmp_to_dir}" |
| 37 | endef |
| 38 | |
| 39 | # ${1} is the file to be deleted. |
| 40 | define SHELL_DELETE |
| 41 | $(eval tmp_del_file:=$(subst /,\,${*})) |
| 42 | -@if exist $(tmp_del_file) del /Q $(tmp_del_file) |
| 43 | endef |
| 44 | |
| 45 | # ${1} is a space delimited list of files to be deleted. |
| 46 | define SHELL_DELETE_ALL |
| 47 | $(eval $(foreach filename,$(wildcard ${1}),$(call DELETE_IF_THERE,${filename}))) |
| 48 | endef |
| 49 | |
| 50 | # ${1} is the directory to be generated. |
| 51 | # ${2} is optional, and allows prerequisites to be specified. |
Evan Lloyd | 4c3055f | 2017-04-07 16:58:57 +0100 | [diff] [blame] | 52 | # Do nothing if $1 == $2, to ignore self dependencies. |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 53 | define MAKE_PREREQ_DIR |
Evan Lloyd | 4c3055f | 2017-04-07 16:58:57 +0100 | [diff] [blame] | 54 | ifneq (${1},${2}) |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 55 | |
| 56 | ${1} : ${2} |
| 57 | $(eval tmp_dir:=$(subst /,\,${1})) |
| 58 | -@if not exist "$(tmp_dir)" mkdir "${tmp_dir}" |
| 59 | |
Evan Lloyd | 4c3055f | 2017-04-07 16:58:57 +0100 | [diff] [blame] | 60 | endif |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 61 | endef |
| 62 | |
| 63 | # ${1} is the directory to be removed. |
| 64 | define SHELL_REMOVE_DIR |
| 65 | $(eval tmp_dir:=$(subst /,\,${1})) |
| 66 | -@if exist "$(tmp_dir)" rd /Q /S "$(tmp_dir)" |
| 67 | endef |
| 68 | |
Chris Kay | c8a47ba | 2023-10-20 09:17:33 +0000 | [diff] [blame] | 69 | nul := nul |
| 70 | |
Chris Kay | 2c09bf6 | 2024-04-09 16:30:52 +0000 | [diff] [blame] | 71 | which = $(shell where "$(1)" 2>$(nul)) |
Evan Lloyd | a71d259 | 2015-12-02 18:56:06 +0000 | [diff] [blame] | 72 | endif |
| 73 | |
Evan Lloyd | cf6e9d4 | 2015-12-03 12:58:52 +0000 | [diff] [blame] | 74 | # Because git is not available from CMD.EXE, we need to avoid |
| 75 | # the BUILD_STRING generation which uses git. |
| 76 | # For now we use "development build". |
| 77 | # This can be overridden from the command line or environment. |
| 78 | BUILD_STRING ?= development build |
| 79 | |
Sami Mujawar | e7cdc3f | 2020-04-30 12:41:57 +0100 | [diff] [blame] | 80 | MSVC_NMAKE := nmake.exe |