cp ccache /usr/local/bin/
ln -s /usr/local/bin/ccache /usr/local/bin/gcc
+ ln -s /usr/local/bin/ccache /usr/local/bin/g++
ln -s /usr/local/bin/ccache /usr/local/bin/cc
.fi
When run as a compiler front end ccache usually just takes the same
command line options as the compiler you are using\&. The only exception
to this is the option \&'--ccache-skip\&'\&. That option can be used to tell
-ccache that the next option is definately not a input filename, and
+ccache that the next option is definitely not a input filename, and
should be passed along to the compiler as-is\&.
.PP
The reason this can be important is that ccache does need to parse the
where ccache will keep its cached compiler output\&. The default is
"$HOME/\&.ccache"\&.
.IP
+.IP "\fBCCACHE_TEMPDIR\fP"
+the CCACHE_TEMPDIR environment variable specifies
+where ccache will put temporary files\&. The default is the same as
+CCACHE_DIR\&. Note that the CCACHE_TEMPDIR path must be on the same
+filesystem as the CCACHE_DIR path, so that renames of files between
+the two directories can work\&.
+.IP
.IP "\fBCCACHE_LOGFILE\fP"
If you set the CCACHE_LOGFILE environment
variable then ccache will write some log information on cache hits
CCACHE_DISABLE then ccache will just call the real compiler,
bypassing the cache completely\&.
.IP
+.IP "\fBCCACHE_READONLY\fP"
+the CCACHE_READONLY environment variable
+tells ccache to attempt to use existing cached object files, but not
+to try to add anything new to the cache\&. If you are using this because
+your CCACHE_DIR is read-only, then you may find that you also need to
+set CCACHE_TEMPDIR as otherwise ccache will fail to create the
+temporary files\&.
+.IP
.IP "\fBCCACHE_CPP2\fP"
If you set the environment variable CCACHE_CPP2
then ccache will not use the optimisation of avoiding the 2nd call to
.IP o
Use the same \fBCCACHE_DIR\fP environment variable setting
.IP o
-Make sure that all users have write permission in the entire
-cache directory (and that you trust all users of the shared cache)\&.
+Set the \fBCCACHE_NOLINK\fP environment variable
.IP o
Make sure everyone sets the CCACHE_UMASK environment variable
-to 002, this ensures that cached files are accessible to everyone\&.
+to 002, this ensures that cached files are accessible to everyone in
+the group\&.
+.IP o
+Make sure that all users have write permission in the entire
+cache directory (and that you trust all users of the shared cache)\&.
.IP o
Make sure that the setgid bit is set on all directories in the
cache\&. This tells the filesystem to inherit group ownership for new
/* the base cache directory */
char *cache_dir = NULL;
+/* the directory for temporary files */
+static char *temp_dir = NULL;
+
/* the debug logfile name, if set */
char *cache_logfile = NULL;
struct stat st1, st2;
int status;
- x_asprintf(&tmp_stdout, "%s/tmp.stdout.%s", cache_dir, tmp_string());
- x_asprintf(&tmp_stderr, "%s/tmp.stderr.%s", cache_dir, tmp_string());
- x_asprintf(&tmp_hashname, "%s/tmp.hash.%s.o", cache_dir, tmp_string());
+ x_asprintf(&tmp_stdout, "%s/tmp.stdout.%s", temp_dir, tmp_string());
+ x_asprintf(&tmp_stderr, "%s/tmp.stderr.%s", temp_dir, tmp_string());
+ x_asprintf(&tmp_hashname, "%s/tmp.hash.%s.o", temp_dir, tmp_string());
args_add(args, "-o");
args_add(args, tmp_hashname);
}
/* now the run */
- x_asprintf(&path_stdout, "%s/%s.tmp.%s.%s", cache_dir,
+ x_asprintf(&path_stdout, "%s/%s.tmp.%s.%s", temp_dir,
input_base, tmp_string(),
i_extension);
- x_asprintf(&path_stderr, "%s/tmp.cpp_stderr.%s", cache_dir, tmp_string());
+ x_asprintf(&path_stderr, "%s/tmp.cpp_stderr.%s", temp_dir, tmp_string());
if (!direct_i_file) {
/* run cpp on the input file to obtain the .i */
/* if we can return from cache at this point then do */
from_cache(1);
+
+ if (getenv("CCACHE_READONLY")) {
+ cc_log("read-only set - doing real compile\n");
+ failed();
+ }
/* run real compiler, sending output to cache */
to_cache(stripped_args);
x_asprintf(&cache_dir, "%s/.ccache", get_home_directory());
}
+ temp_dir = getenv("CCACHE_TEMPDIR");
+ if (!temp_dir) {
+ temp_dir = cache_dir;
+ }
+
cache_logfile = getenv("CCACHE_LOGFILE");
setup_uncached_err();
where ccache will keep its cached compiler output. The default is
"$HOME/.ccache".
+dit(bf(CCACHE_TEMPDIR)) the CCACHE_TEMPDIR environment variable specifies
+where ccache will put temporary files. The default is the same as
+CCACHE_DIR. Note that the CCACHE_TEMPDIR path must be on the same
+filesystem as the CCACHE_DIR path, so that renames of files between
+the two directories can work.
+
dit(bf(CCACHE_LOGFILE)) If you set the CCACHE_LOGFILE environment
variable then ccache will write some log information on cache hits
and misses in that file. This is useful for tracking down problems.
CCACHE_DISABLE then ccache will just call the real compiler,
bypassing the cache completely.
+dit(bf(CCACHE_READONLY)) the CCACHE_READONLY environment variable
+tells ccache to attempt to use existing cached object files, but not
+to try to add anything new to the cache. If you are using this because
+your CCACHE_DIR is read-only, then you may find that you also need to
+set CCACHE_TEMPDIR as otherwise ccache will fail to create the
+temporary files.
+
dit(bf(CCACHE_CPP2)) If you set the environment variable CCACHE_CPP2
then ccache will not use the optimisation of avoiding the 2nd call to
the pre-processor by compiling the pre-processed output that was used