help-make
[Top][All Lists]
Advanced

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

Re: Detecting Makefile changes in incremental builds.


From: Sam Ravnborg
Subject: Re: Detecting Makefile changes in incremental builds.
Date: Thu, 29 Jul 2010 09:10:32 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Wed, Jul 28, 2010 at 09:02:00PM +0100, Krzysztof Cieniuch wrote:
> Hi,
> I've implemented build system that uses advanced auto-dependency  
> generation as described by Paul Smith
> All works fine except one thing : if user changes compilation flags  
> (e.g. modifies  CFLAGS that are set in Makefile) or modifies list of  
> libraries to link with (e.g. via LDFLAGS) make obvoiusly can't detect  
> this. To fix that one may add Makefile itself as a prerequisite to all  
> object files and library/executable targets but that seems an overkill  
> any change in Makefile will cause full rebuild of all targets in that  
> Makefile.
>
> Is there more intelligent solution to this problem ?
>
> I was thinking about creating checksum from options passed to compiler  
> and store them in deps files similar to file dependency information but  
> how could I  tell make to mark target out of date if some checksum  
> doesn't match previously computed ?

For the linux kernel we have such a mechanishm in place.
We basically store the commandline in the same file where we store
the dependencies. We then check if the arguments has changed.

Most of the make logic can be found in scripts/Kbuild.include
in any recent kernel. But it may take you a few hours to grasp all
the details.


If you take a look then there is a few things worht to know.
1) The kernel uses fixdep to handle the situation that we
have several thousand configuration symbols and we rebuild
only if relevant config symbol changes.

2) We allow options to be reordered (cannot remember why atm)

3) We use a variable named PHONY that is assigned all PHONY
targets - so we can check for these.

There is likely more when we start to looks at it :-)

        Sam



reply via email to

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