diff options
author | Arnout Vandecappelle <arnout@mind.be> | 2015-10-04 16:25:32 +0100 |
---|---|---|
committer | Peter Korsgaard <peter@korsgaard.com> | 2015-10-04 18:22:21 +0200 |
commit | 1e97b2787331c5f4452d8c9a76961a89ec355d9d (patch) | |
tree | 3650a31a1a9b2fa3b9955823839057fa7b91ac89 /toolchain/toolchain-wrapper.c | |
parent | f4682cf933a3e0e1017aa8827a8c57fdd79e30f3 (diff) |
ccache: support changing the output directory
When building in a different output directory than the original build,
there will currently be a lot of ccache misses because in many cases
there is some -I/... absolute path in the compilation. Ccache has an
option CCACHE_BASEDIR to substitute absolute paths with relative paths,
so they wil be the same in the hash (and in the output).
Since there are some disadvantages to this path rewriting, it is made
optional as BR2_CCACHE_USE_BASEDIR. It defaults to y because the
usefulness of ccache is severely reduced without this option.
In addition to CCACHE_BASEDIR, we also substitute away the occurences
of $(HOST_DIR) in the calculation of the compiler hash. This is done
regardless of the setting of BR2_CCACHE_USE_BASEDIR because it's
quite harmless.
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Diffstat (limited to 'toolchain/toolchain-wrapper.c')
-rw-r--r-- | toolchain/toolchain-wrapper.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c index d52115f51..11f93f0fd 100644 --- a/toolchain/toolchain-wrapper.c +++ b/toolchain/toolchain-wrapper.c @@ -268,6 +268,10 @@ int main(int argc, char **argv) fprintf(stderr, "%sCCACHE_COMPILERCHECK='string:" BR_CCACHE_HASH "'", (debug == 2) ? "\n " : " "); #endif +#ifdef BR_CCACHE_BASEDIR + fprintf(stderr, "%sCCACHE_BASEDIR='" BR_CCACHE_BASEDIR "'", + (debug == 2) ? "\n " : " "); +#endif for (i = 0; exec_args[i]; i++) fprintf(stderr, "%s'%s'", (debug == 2) ? "\n " : " ", exec_args[i]); @@ -282,6 +286,13 @@ int main(int argc, char **argv) return 3; } #endif +#ifdef BR_CCACHE_BASEDIR + /* Allow compilercheck to be overridden through the environment */ + if (setenv("CCACHE_BASEDIR", BR_CCACHE_BASEDIR, 0)) { + perror(__FILE__ ": Failed to set CCACHE_BASEDIR"); + return 3; + } +#endif if (execv(exec_args[0], exec_args)) perror(path); |