tech-toolchain archive

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

Re: make: dealing with targets with multiple outputs



David Holland <dholland-tech%netbsd.org@localhost> wrote:
> We already have a solution for this problem, it's just waiting for
> someone to find time to implement it.
> 
> Namely: given multiple targets on the left, don't schedule them in
> parallel, and after building the first one check to see how many of
> the others also got knocked off at the same time.

Couple that with a special target to trigger it - sounds good.
That way you avoid the need to rewrite lots of makefiles with .for loops

The key is still to associate all the targets that were on lhs

> This covers the common case (multiple outputs) and works transparently
> for the other case (recipe shared over multiple independent targets)
> at some loss of parallelism.
> 
> If you are using the uncommon case on purpose and you want the
> parallelism back, you can write it with a for loop:
> 
>    foo.c bar.c baz.c: stuff
>            recipe
> 
> becomes
> 
>    .for T in foo.c bar.c baz.c
>    $(T): stuff
>            recipe
>    .endfor
> 
> which in most cases is preferred anyway.

considering that .for loops introduce their own side effects
I prefer to avoid them when unnecessary.

> I don't remember when I originally proposed this but I think it's been
> several years :(

Do you have any of it implemented?

Thanks
--sjg


Home | Main Index | Thread Index | Old Index