After [JDK-8313374](https://bugs.openjdk.org/browse/JDK-8313374), out of tree incremental builds with ccache started failing. The rewriting of the generated dependency (*.d) files creates object file paths with `/../` in them which make does not match to other rules. I don't think we should apply the rewriting when the build dir is outside CCACHE_BASEDIR.
During review of [JDK-8313374](https://bugs.openjdk.org/browse/JDK-8313374) I also noted that the CCACHE_BASEDIR should point to WORKSPACE_ROOT rather than TOPDIR for ccache to work uniformly for OracleJDK and OpenJDK builds. Both of these issues are addressed with this patch. I have tried various scenarios and it seems to be working for me, but would appreciate some more verification by people using ccache. ------------- Commit messages: - Add comment - JDK-8315060 Changes: https://git.openjdk.org/jdk/pull/15434/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15434&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8315060 Stats: 9 lines in 2 files changed: 6 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/15434.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15434/head:pull/15434 PR: https://git.openjdk.org/jdk/pull/15434