-
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
cleanup.o snprintf.o unify.o
HEADERS = ccache.h mdfour.h
-all: ccache ccache.1
+all: ccache
+
+docs: ccache.1 web/ccache-man.html
ccache: $(OBJS) $(HEADERS)
$(CC) $(CFLAGS) -o $@ $(OBJS)
ccache.1: ccache.yo
yodl2man -o ccache.1 ccache.yo
+
+web/ccache-man.html: ccache.yo
+ mkdir -p man
yodl2html -o web/ccache-man.html ccache.yo
install:
CCACHE_DISABLE then ccache will just call the real compiler,
bypassing the cache completely\&.
.IP
+.IP "\fBCCACHE_NOUNIFY\fP"
+If you set the environment variable
+CCACHE_NOUNIFY then ccache will not use the C/C++ unifier when hashing
+the pre-processor output\&. The unifier is slower than a normal hash, so
+setting this environment variable gains a little bit of speed, but it
+means that ccache can\&'t take advantage of not recompiling when the
+changes to the source code consist of reformatting only\&.
+.IP
.PP
.SH "CACHE SIZE MANAGEMENT"
.PP
free(path_stderr);
}
-
-/* hash a file that consists of preprocessor output, but remove any line
- number information from the hash
-*/
-static void stabs_hash(const char *fname)
-{
- int fd;
- struct stat st;
- char *map;
-
- fd = open(fname, O_RDONLY);
- if (fd == -1 || fstat(fd, &st) != 0) {
- cc_log("Failed to open preprocessor output %s\n", fname);
- stats_update(STATS_PREPROCESSOR);
- failed();
- }
-
- /* we use mmap() to make it easy to handle arbitrarily long
- lines in preprocessor output. I have seen lines of over
- 100k in length, so this is well worth it */
- map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (map == (char *)-1) {
- cc_log("Failed to mmap %s\n", fname);
- failed();
- }
- close(fd);
-
- /* pass it through the unifier */
- unify(map, st.st_size);
-
- munmap(map, st.st_size);
-}
-
-
/* find the hash for a command. The hash includes all argument lists,
plus the output from running the compiler with -E */
static void find_hash(ARGS *args)
information. Otherwise we can discard line number info, which makes
us less sensitive to reformatting changes
*/
- if (found_debug) {
+ if (found_debug || getenv("CCACHE_NOUNIFY")) {
hash_file(path_stdout);
} else {
- stabs_hash(path_stdout);
+ if (unify_hash(path_stdout) != 0) {
+ failed();
+ }
}
hash_file(path_stderr);
size_t value_units(const char *s);
void stats_set_sizes(const char *dir, size_t num_files, size_t total_size);
-void unify(unsigned char *p, size_t size);
+int unify_hash(const char *fname);
+
void cleanup_dir(const char *dir, size_t maxfiles, size_t maxsize);
CCACHE_DISABLE then ccache will just call the real compiler,
bypassing the cache completely.
+dit(bf(CCACHE_NOUNIFY)) If you set the environment variable
+CCACHE_NOUNIFY then ccache will not use the C/C++ unifier when hashing
+the pre-processor output. The unifier is slower than a normal hash, so
+setting this environment variable gains a little bit of speed, but it
+means that ccache can't take advantage of not recompiling when the
+changes to the source code consist of reformatting only.
+
enddit()
manpagesection(CACHE SIZE MANAGEMENT)
}
/* hash some C/C++ code after unifying */
-void unify(unsigned char *p, size_t size)
+static void unify(unsigned char *p, size_t size)
{
size_t ofs;
unsigned char q;
pushchar(0);
}
+
+/* hash a file that consists of preprocessor output, but remove any line
+ number information from the hash
+*/
+int unify_hash(const char *fname)
+{
+ int fd;
+ struct stat st;
+ char *map;
+
+ fd = open(fname, O_RDONLY);
+ if (fd == -1 || fstat(fd, &st) != 0) {
+ cc_log("Failed to open preprocessor output %s\n", fname);
+ stats_update(STATS_PREPROCESSOR);
+ return -1;
+ }
+
+ /* we use mmap() to make it easy to handle arbitrarily long
+ lines in preprocessor output. I have seen lines of over
+ 100k in length, so this is well worth it */
+ map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
+ if (map == (char *)-1) {
+ cc_log("Failed to mmap %s\n", fname);
+ return -1;
+ }
+ close(fd);
+
+ /* pass it through the unifier */
+ unify(map, st.st_size);
+
+ munmap(map, st.st_size);
+
+ return 0;
+}
+