mirror of
https://github.com/reactos/ccache.git
synced 2025-02-10 05:32:11 +00:00
3b4bf19848
- faster handling of error case
100 lines
3.1 KiB
Plaintext
100 lines
3.1 KiB
Plaintext
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 "/tmp/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.
|
|
|
|
|
|
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.
|