blob: 8fcc062d465e67bb29e96cf5ccb660db0bbcce75 [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.
pw_universal_copy = {
if (host_os == "win") {
command = "cp -af {{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}}"
}