mirror of
https://github.com/reactos/ccache.git
synced 2024-12-03 17:11:10 +00:00
ccache - a fast compiler cache
args.c | ||
ccache.c | ||
ccache.h | ||
COPYING | ||
execute.c | ||
hash.c | ||
Makefile | ||
mdfour.c | ||
mdfour.h | ||
README | ||
util.c |
This is a re-implementation of "compilercache" in C The original compilercache scripts were by Erik Thiele (erikyyy@erikyyy.de) and I would like to thank him for an excellent piece of work. See http://www.erikyyy.de/compilercache/ for the original shell scripts. I wrote ccache because I wanted to get a bit more speed out of a compiler cache and I wanted to remove some of the limitations of the shell-script version. Installation ------------ To install ccache first compile it, then place the "ccache" somewhere in your path. You then need to create symbolic links from the ccache executable to symlinks of the same name as your compiler. These symlinks must come before the location of your real compiler in your PATH. For example the following will work on many systems: make ccache cp ccache /usr/local/bin ln -s /usr/local/bin/ccache /usr/local/bin/gcc ln -s /usr/local/bin/ccache /usr/local/bin/cc This will work as long as /usr/local/bin comes before the path to gcc (which is usually in /usr/bin). After installing you may wish to run "rehash; type gcc" to make sure that the correct link is being used. Configuration ------------- Configuration of ccache is done via a number of environment variables. In most cases you won't need any of these as the defaults will be fine. CCACHE_DIR the CCACHE_DIR environment variable specifies where ccache will keep its cached compiler output. The default is "$HOME/.ccache". 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_PATH You can optionally set CCACHE_PATH to a colon separated path where ccache will look for the real compilers. If you don't do this then ccache will look for the first executable in the normal PATH that isn't a link to ccache itself. Differences ----------- The biggest differences between Erik's compilercache script and ccache are: - ccache is written in C, which makes it a bit faster (calling out to external programs is mostly what slowed down the scripts). - ccache can automatically find the real compiler on Linux - ccache can cache compiler output that includes warnings. In many cases this gives ccache a much higher cache hit rate. - ccache can handle argument lists with spaces Note however that ccache is a very new piece of code (as of March 2002) whereas Erik's scripts have had a *lot* more testing. The overall speedup compared to compilercache is quite dramatic. For compiling rsync I get: compilercache uncached 28.9 seconds compilercache cached 10.5 seconds ccache uncached 24.6 seconds ccache cached 4.6 seconds How it works ------------ The basic idea is to detect when you are compiling exactly the same code a 2nd time and use the previously compiled output. You detect that it is the same code by forming a hash of: - the pre-processor output from running the compiler with -E - the command line options - the real compilers size and modification time - any stderr output generated by the compiler =================== tridge@samba.org March 2002 PS: I get far too much email to answer, so don't be surprised if you have a hard time getting hold of me. You might try the #samba-technical IRC channel on irc.openprojects.net if you need me quickly.