import source from 1.3.40
[external/swig.git] / CCache / debian / README.Debian
1 Installing ccache
2 -----------------
3
4 The recommended way to use this with Debian is to either create "cc"
5 and "gcc" symlinks to /usr/bin/ccache in your private bin directory
6 (which must be before the real cc and gcc in your path), or use
7 CC="ccache gcc" on the make command line.
8
9 Another option is to just prepend /usr/lib/ccache in your PATH
10 environment variable, like
11
12   export PATH="/usr/lib/ccache:$PATH"
13
14 Note that ccache works with both native and cross compilers.
15
16 Ignoring whitespace
17 -------------------
18
19 If you wish to set up ccache so that it ignores blank lines, have a
20 look at the CCACHE_UNIFY option.  However, please note that this
21 option is off by default since the reported line numbers may not
22 match the source files anymore.
23
24
25 NFS Issues
26 ----------
27
28 (from John Coiner <john.coiner@amd.com> on the ccache mailing list)
29
30 When CCache creates a hardlinked output file, it calls utime() to update
31 the timestamp on the object, so that Make realizes that the object has
32 changed.
33
34 On NFS, utime() has no coherency guarantee, AFAIK. When utime() runs on
35 host A, and our parallel implementation of Make is running on host B,
36 sometimes Make doesn't see the new timestamp soon enough -- and neglects
37 to relink the final binary. That's a one-way ticket to Silent Mysterious
38 Failure Town.
39
40 Instead of relying on the object file timestamp, we create a dummy file
41 with a reliable timestamp:
42
43 objs/foo.o objs/foo.o.built :
44         if ( ccache gcc -o foo.o -c foo.c ) ; \
45         then touch objs/foo.o.built ; \
46         else exit 1; \
47         fi
48
49 binary : objs/foo.o.built
50         gcc -o binary objs/foo.o
51
52 NFS does make a coherency guarantee, that if a file is written and
53 close()d on host A, and subsequently open()ed on host B, that the second
54 open() will reflect all modifications and attributes from the close().
55 Since Make does open() when checking timestamps, and the dummy file is
56 close()d when it's created, the binary will always relink after the
57 object is recompiled.
58
59  -- Francois Marier <francois@debian.org>  Sun, 20 May 2007 17:35:36 +1200