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:
>  > Ideally any solution should DTRT even with suffix rules.
> 
> There's no way to unless you want to invent a syntax for it or a way
> to graft additional stuff onto the left of a rule, which I don't think
> is a good idea.

This is why I suggested a special source.

foo.c foo.h: foo.y .NAMING_STUFF_IS_HARD

is all that is needed to mark foo.c foo.h as a set of related nodes

The actual rules used are unaffected.
The first listed node is the one we build, and expect the others to be
produced as side effect.

Note sure why anything more complicated should be necessary.
The above would have no impact on makes ability to build stuff in
parallel either (since foo.h would never be made directly).


> In general my recommendation remains to write
> 
>    .for S in $(SRCS:M*.y)
>    $(S:T:R).c $(S:T:R).h: $(S)
>            $(YACC) -d $(S) -o $(S:T:R).c
>            mv -f y.tab.h $(S:T:R).h
>    .endfor
>
> because (once the real problem we're talking about is finally fixed)
> that gives you exactly what it says, works when the sources are in
> another directory, and can easily be extended to work when the build
> products *also* go in another directory. None of that's true of suffix

Hmm I can't say I've noticed a problem with suffix rules working with
SRCS found via .PATH and products dropping in .OBJDIR


Home | Main Index | Thread Index | Old Index