blob: 19717ba5ecc3fc33f0eef4e026c35718a823eec3 [file] [log] [blame]
# Copyright 2020 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
import("//build_overrides/pigweed.gni")
pw_universal_copy = {
if (host_os == "win") {
command = string_join(" ",
[
python_path,
rebase_path("$dir_pw_toolchain/copy_file.py"),
"{{source}}",
"{{output}}",
])
} else {
# Use a hard link if possible as this is faster. Also, Mac doesn't
# preserve timestamps properly with cp -af.
fallback_command = string_join(" ",
[
"rm -rf",
"{{output}}",
"&&",
"cp -af",
"{{source}}",
"{{output}}",
])
command = string_join(" ",
[
"ln -f",
"{{source}}",
"{{output}}",
"2>/dev/null",
"||",
"($fallback_command)",
])
}
description = "cp {{source}} {{output}}"
}
pw_universal_stamp = {
if (host_os == "win") {
command = "cmd /c type nul > \"{{output}}\""
} else {
command = "touch {{output}}"
}
description = "stamp {{output}}"
}