Sam Ravnborg wrote:
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
Thanks ! That was exactly what I was looking for. Problem solved :-)
I used idea with slight mod I'm adding FORCE to prerequisite list conditionally if
previous command and args  don't equal current one.

As far as I could tell kernel makefile system always creates rules but if command or prerequisites are not out of date
rule commands are empty so make doesn't execute rules,  really clever.

BTW Didn't know kernel has such a nice makefile system I'll be looking more into it for inspiration.

Chris



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to