[Top][All Lists]

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

Re: problems with $(eval include...)

From: Fabio Alemagna
Subject: Re: problems with $(eval include...)
Date: Fri, 27 Jun 2003 01:16:38 +0200 (CEST)

On Thu, 26 Jun 2003, Ted Stern wrote:

> Ah, you have autogenerated headers!

Not necessarily, but it may happen. I'm working on a complete and generic
build system, which understands "modules types", and on the basis of thos
types it takes some actions. It uses only make and the $(eval) function to
do all the job. It's quite powerful, but has this "little" problem I've
talked about: for every included .d file there's a corresponding .d : .c
rule which builds that .d file; now, including a .d file leads make to run
that rule to check whether the .d file needs to be rebuilt, and this
_regardless_ of whether the corresponding .o file will be used or not in
that compilation, just because the .d file has been included.

This is unacceptable for VERY large projects with lots of modules and .c
files belonging to those modules: say I want to build module A and B only,
which don't depend on any other module; since I include ALL .d files for
ALL modules and ALL .c files anyway, it doesn't matter how many modules I
want to build, ALL .c files from ALL modules will be checked anyway, which
is wasteful.

My solution (if only it worked) is to include the .d files for a given
module ONLY when that module is about to be built, which is right after
the module's rule is run, and right before the .o rules are run. This, as
said, works only in very rare situations... most of the time make
segfaults and if the included file is missing the rule which generates it
is not invoked as it should.

The other solution would be to have make let you define other ways than
timestamps checks to see whether a target needs to be rebuilt or not: if
for example I could write prerequisites which expanded macros only when
the target were invoked, then I could write macros which expanded to an
empty target if the file needed to be built for some reasons - thus
leading the target to be rebuilt - and to nothing if the target doesn't
need to be rebuilt. This would be a very useful feature, imho. It, I
think, would just require to define a new syntax for this special macro,
like for example $@(macro): $@ would not be usable in a prerequisite list
anyway, so using it like that is perfectly possible, I think.

Fabio Alemagna

reply via email to

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