[ccache] Single 'source' collection, multiple targets

Mathias De Maré mathias.de_mare at alcatel-lucent.com
Fri Nov 9 07:48:44 MST 2012


I've set up ccache for our builds and it seems to be working fine. Now, 
we have a bit of a special setup, and I believe things could be even better.

Our directory structure is (simplified):


During compilation, the current working directory is 'src', and the 
objects (depending on the target being built) end up in output/targetX.

There is a lot of overlap between some of the targets (some builds are 
done for the same processors); but they build entirely separate (so you 
build all of the objects for target1 and all of the objects for target2).
Ideally, the makefile structure would be improved to take advantage of 
the overlap, but this is a very complex and time-consuming job.

Ccache is used right now, but there is no overlap between the targets.
What I would like to do is to be able to share ccache objects between 
the different targets.
This doesn't work, because the generated dependency files look like this:
 > ../output/target1/somefile.o:
 >  (lots of files in src)

The dependency file contains the directory of the target. As a result, 
it's impossible to get any overlap between different targets.
I've tried to use CCACHE_BASEDIR to modify the path, but that only makes 
it relative to the current working directory (which it already is).

Is there any other way to achieve the desired effect?

Modifying the current working directory is not an option: the '__FILE__' 
now converts to a clean path. If I change the working directory to 
output/targetX, this will no longer be the case.


More information about the ccache mailing list