1 # Copyright 2020 The Pigweed Authors
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 # use this file except in compliance with the License. You may obtain a copy of
7 # https://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations under
15 import("//build_overrides/pigweed.gni")
18 if (host_os == "win") {
19 cp_command = "cp -af {{source}} {{output}}"
21 # Use python script in absence of cp command.
23 rebase_path(dir_pw_toolchain) + "/py/pw_toolchain/copy_with_metadata.py"
24 fallback_command = "python $copy_tool_path {{source}} {{output}}"
26 command = "cmd /c \"($cp_command > NUL 2>&1) || ($fallback_command)\""
28 # Use a hard link if possible as this is faster. Also, Mac doesn't
29 # preserve timestamps properly with cp -af.
30 fallback_command = string_join(" ",
39 command = string_join(" ",
46 "($fallback_command)",
49 description = "cp {{source}} {{output}}"
52 pw_universal_stamp = {
53 if (host_os == "win") {
54 command = "cmd /c type nul > \"{{output}}\""
56 command = "touch {{output}}"
58 description = "stamp {{output}}"