help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Automatic macro dependencies


From: Dave Korn
Subject: RE: Automatic macro dependencies
Date: Wed, 6 Aug 2008 13:27:45 +0100

Dave Korn wrote on 06 August 2008 10:45:

> Harvey Chapman wrote on 05 August 2008 21:50:
> 
>> Sam Ravnborg wrote:
>>> http://www.kernel.org :-)
>>> 
>>> In the kernel we use a lot of CONFIG_ named variables and
>>> changing one of these cause the relevant files to be rebuilt.
>>> 
>>> The steps are basically:....
>> 
>> Ah, thanks to all that replied. This is what I was looking for.
> 
>   Or just use ccache.
> 
> http://ccache.samba.org/

  That was a bit obtuse of me; let me expand slightly.

  The thing that ccache does that particularly suits your goal is that it
caches the pre-processed source of your files, along with the object file
generated, and a record of the command-line parameters.  If the same source
gets compiled again with the same compiler flags, it fetches the saved
object file rather than invoking the compiler.

  The reason this is good for you is that it doesn't actually track macro
definitions at all: what it does is track the effects of those definitions
on your source code.  So it doesn't rebuild files just because a macro has
changed; it only rebuilds them if the change to the macro actually results
in a difference in the resulting pre-processed source (what the compiler
actually ends up seeing), whereas a change to a macro that doesn't affect
the actual generated code won't provoke an unnecessary rebuild.  (E.g.,
consider changing a #define macro that's only referenced inside a bit of
code that's currently "#if 0"'d out; with the kernel build system, the
corresponding artificial dependency .c file would still have changed, so the
module would still recompile).


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....





reply via email to

[Prev in Thread] Current Thread [Next in Thread]