On Wed, Nov 14, 2012 at 11:34 AM, Guillaume Melquiond
<
guillaume...@gmail.com> wrote:
> Le mercredi 14 novembre 2012 14:29:07 UTC+1, Diggory Hardy a écrit :
>> Looks pretty good. I might give it a try next time I write some new build
>> rules!
>>
>> One question: does it support dynamic determination of targets? Javac, for
>> instance, outputs several object files for a source depending on the classes
>> defined within — would this list have to be updated by hand?
>
> It would have to be updated by hand. From the point of view of the system,
> if you don't know the name of a target beforehand, being able to build it
> through its name is useless; you presumably have some other way to refer to
> it. For instance, you could have a pseudo-target that would point at the
> source file. Am I missing some use case where you really need its name as a
> target of a rule?
Well, fundamentally, this is the requirement that makes it hard to
implement the feature in redo :) Otherwise we'd just have a file
named fileA_and_fileB.do to generate both fileA and fileB, and we
could do some caching thing to make sure lookups of that .do file are
efficient. The ability to produce multiple targets from the same rule
seems to be the only claimed advantage of your system over redo, so it
needs to work right. :) (Putting all your rules in one file is
entirely possible in redo; just put a case statement in default.do.)
pseudo-targets work okay, but aren't great. You then have to remember
to refer to that pseudo-target every time you refer to the dependency,
rather than referring to a file by name. So if a 'configured' target
runs ./configure and produces config.h, you have to remember, in every
C file that depends on config.h, to actually depend on 'configured'
instead. That's messy.
(I realize that with config.h you could just use a multi-target rule
with defined outputs that include config.h. But imagine instead that
./configure produces a variable set of config_*.h files, for example.
You don't seem to have solved the general case, and redo has been
leaving out that feature until we can solve the general case.)
Have fun,
Avery