| # Copyright 2020 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Each toolchain must define "stamp" and "copy" tools, |
| # but they are always the same in every toolchain. |
| stamp_command = "touch {{output}}" |
| stamp_description = "STAMP {{output}}" |
| |
| # We use link instead of copy; the way "copy" tool is being used is |
| # compatible with links since Ninja is tracking changes to the source. |
| if (host_os == "mac") { |
| # ln cannot hardlink directories on Mac, but `cp -af` does not correctly |
| # preserve mtime (the nanoseconds are truncated to microseconds) which causes |
| # spurious ninja rebuilds. As a result, shell to a helper to copy rather than |
| # calling cp -r. See https://fxbug.dev/56376#c5. |
| copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (" + |
| rebase_path("//build/toolchain/recursive_copy.py") + |
| " {{source}} {{output}})" |
| } else { |
| copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" |
| } |
| copy_description = "COPY {{source}} {{output}}" |