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



On Tue, Jun 11, 2019 at 08:56:31AM -0700, Simon J. Gerraty wrote:
 > > AFAICT, yacc handling is currently poor and is (part of)
 > 
 > Yes I know, that's why I started this thread ;-)
 > Since I had a thought on how to fix.
 > 
 > > what dholland is trying to propose a fix for.
 > 
 > 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.

You could imagine something like

.y.c: ::<<:: $(@:.c=.h)
	$(YACC) -d $<

but that would be pretty gross.

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
rules, and only some of it for gmake pattern rules.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index