2 # Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are met:
7 # Redistributions of source code must retain the above copyright notice, this
8 # list of conditions and the following disclaimer.
10 # Redistributions in binary form must reproduce the above copyright notice,
11 # this list of conditions and the following disclaimer in the documentation
12 # and/or other materials provided with the distribution.
14 # Neither the name of ARM nor the names of its contributors may be used
15 # to endorse or promote products derived from this software without specific
16 # prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 # POSSIBILITY OF SUCH DAMAGE.
32 # OS specific parts for builds in a Windows_NT environment. The
33 # environment variable OS is set to Windows_NT on all modern Windows platforms
35 # Include generic windows command definitions.
38 WINDOWS_MK
:= $(lastword
$(MAKEFILE_LIST
))
40 ECHO_BLANK_LINE
:= @cmd
/c echo.
41 DIR_DELIM
:= $(strip \
)
45 # For some Windows native commands there is a problem with the directory delimiter.
46 # Make uses / (slash) and the commands expect \ (backslash)
47 # We have to provide a means of translating these, so we define local functions.
49 # ${1} is the file to be copied.
50 # ${2} is the destination file name.
52 $(eval tmp_from_file
:=$(subst /,\
,${1}))
53 $(eval tmp_to_file
:=$(subst /,\
,${2}))
54 copy
"${tmp_from_file}" "${tmp_to_file}"
57 # ${1} is the directory to be copied.
58 # ${2} is the destination directory path.
59 define SHELL_COPY_TREE
60 $(eval tmp_from_dir
:=$(subst /,\
,${1}))
61 $(eval tmp_to_dir
:=$(subst /,\
,${2}))
62 xcopy
/HIVE
"${tmp_from_dir}" "${tmp_to_dir}"
65 # ${1} is the file to be deleted.
67 $(eval tmp_del_file
:=$(subst /,\
,${*}))
68 -@if exist
$(tmp_del_file
) del
/Q
$(tmp_del_file
)
71 # ${1} is a space delimited list of files to be deleted.
72 define SHELL_DELETE_ALL
73 $(eval
$(foreach filename
,$(wildcard ${1}),$(call DELETE_IF_THERE
,${filename})))
76 # ${1} is the directory to be generated.
77 # ${2} is optional, and allows prerequisites to be specified.
78 # Do nothing if $1 == $2, to ignore self dependencies.
79 define MAKE_PREREQ_DIR
83 $(eval tmp_dir
:=$(subst /,\
,${1}))
84 -@if not exist
"$(tmp_dir)" mkdir
"${tmp_dir}"
89 # ${1} is the directory to be removed.
90 define SHELL_REMOVE_DIR
91 $(eval tmp_dir
:=$(subst /,\
,${1}))
92 -@if exist
"$(tmp_dir)" rd
/Q
/S
"$(tmp_dir)"
97 # Because git is not available from CMD.EXE, we need to avoid
98 # the BUILD_STRING generation which uses git.
99 # For now we use "development build".
100 # This can be overridden from the command line or environment.
101 BUILD_STRING ?
= development build
103 # The DOS echo shell command does not strip ' characters from the command
104 # parameters before printing. We therefore use an alternative method invoked
105 # by defining the MAKE_BUILD_STRINGS macro.
106 BUILT_TIME_DATE_STRING
= const char build_message
[] = "Built : "${BUILD_MESSAGE_TIMESTAMP};
107 VERSION_STRING_MESSAGE
= const char version_string
[] = "${VERSION_STRING}";
108 define MAKE_BUILD_STRINGS
109 @echo
$$(BUILT_TIME_DATE_STRING
) $$(VERSION_STRING_MESSAGE
) | \
110 $$(CC
) $$(TF_CFLAGS
) $$(CFLAGS
) -x c
-c
- -o
$1