blob: f6e8d55bdb5e19dc272f4c8ca148b1901ba3a189 [file] [log] [blame]
Evan Lloyda71d2592015-12-02 18:56:06 +00001#
2# Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3#
dp-armfa3cf0b2017-05-03 09:38:09 +01004# SPDX-License-Identifier: BSD-3-Clause
Evan Lloyda71d2592015-12-02 18:56:06 +00005#
6#
7
8# OS specific parts for builds in a Windows_NT environment. The
9# environment variable OS is set to Windows_NT on all modern Windows platforms
10
11# Include generic windows command definitions.
12
13ifndef WINDOWS_MK
14 WINDOWS_MK := $(lastword $(MAKEFILE_LIST))
15
16 ECHO_BLANK_LINE := @cmd /c echo.
Evan Lloyda71d2592015-12-02 18:56:06 +000017 DIR_DELIM := $(strip \)
Evan Lloyd004c9a52015-12-03 11:35:40 +000018 BIN_EXT := .exe
19 PATH_SEP := ;
Evan Lloyda71d2592015-12-02 18:56:06 +000020
21 # For some Windows native commands there is a problem with the directory delimiter.
22 # Make uses / (slash) and the commands expect \ (backslash)
23 # We have to provide a means of translating these, so we define local functions.
24
25 # ${1} is the file to be copied.
26 # ${2} is the destination file name.
27 define SHELL_COPY
28 $(eval tmp_from_file:=$(subst /,\,${1}))
29 $(eval tmp_to_file:=$(subst /,\,${2}))
30 copy "${tmp_from_file}" "${tmp_to_file}"
31 endef
32
33 # ${1} is the directory to be copied.
34 # ${2} is the destination directory path.
35 define SHELL_COPY_TREE
36 $(eval tmp_from_dir:=$(subst /,\,${1}))
37 $(eval tmp_to_dir:=$(subst /,\,${2}))
38 xcopy /HIVE "${tmp_from_dir}" "${tmp_to_dir}"
39 endef
40
41 # ${1} is the file to be deleted.
42 define SHELL_DELETE
43 $(eval tmp_del_file:=$(subst /,\,${*}))
44 -@if exist $(tmp_del_file) del /Q $(tmp_del_file)
45 endef
46
47 # ${1} is a space delimited list of files to be deleted.
48 define SHELL_DELETE_ALL
49 $(eval $(foreach filename,$(wildcard ${1}),$(call DELETE_IF_THERE,${filename})))
50 endef
51
52 # ${1} is the directory to be generated.
53 # ${2} is optional, and allows prerequisites to be specified.
54 define MAKE_PREREQ_DIR
55
56${1} : ${2}
57 $(eval tmp_dir:=$(subst /,\,${1}))
58 -@if not exist "$(tmp_dir)" mkdir "${tmp_dir}"
59
60 endef
61
62 # ${1} is the directory to be removed.
63 define SHELL_REMOVE_DIR
64 $(eval tmp_dir:=$(subst /,\,${1}))
65 -@if exist "$(tmp_dir)" rd /Q /S "$(tmp_dir)"
66 endef
67
68endif
69
Evan Lloydcf6e9d42015-12-03 12:58:52 +000070# Because git is not available from CMD.EXE, we need to avoid
71# the BUILD_STRING generation which uses git.
72# For now we use "development build".
73# This can be overridden from the command line or environment.
74BUILD_STRING ?= development build
75
76# The DOS echo shell command does not strip ' characters from the command
77# parameters before printing. We therefore use an alternative method invoked
78# by defining the MAKE_BUILD_STRINGS macro.
79BUILT_TIME_DATE_STRING = const char build_message[] = "Built : "${BUILD_MESSAGE_TIMESTAMP};
80VERSION_STRING_MESSAGE = const char version_string[] = "${VERSION_STRING}";
81define MAKE_BUILD_STRINGS
82 @echo $$(BUILT_TIME_DATE_STRING) $$(VERSION_STRING_MESSAGE) | \
Masahiro Yamada49071ae2016-12-22 12:39:55 +090083 $$(CC) $$(TF_CFLAGS) $$(CFLAGS) -x c -c - -o $1
Evan Lloydcf6e9d42015-12-03 12:58:52 +000084endef
85