[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Handling Tools that Produce Many Outputs
From: |
Oren Ben-Kiki |
Subject: |
Handling Tools that Produce Many Outputs |
Date: |
Sun, 15 Feb 2004 00:44:51 +0200 |
My GNU Make manual says (10.5.2):
This pattern rule has two targets:
%.tab.c %.tab.h: %.y
bison -f $<
This tells make the command 'bison -d x.y' will make
both 'x.tab.c' and 'x.tab.h' ...
I know GNU make has a strange interpretation for multi-target rules, but
I read the above to mean that, for some strange reason, it does the
"right thing" for a multi-target _pattern_ rule. So, while it is true
that:
> # This is incorrect.
> data.c data.h: data.foo
> foo data.foo
My usual workaround is to simply write:
%ata.c %ata.h: %ata.foo
foo $<
That is, find some way to pattern-ify the rule. Of course, it is a hack,
like all solutions to the multiple targets problem. Besides, often the
pattern rule is "real" anyway:
%.c %.h: %.foo
foo $<
The down-side of this is, of course, that it assumes GNU Make. Is that
why this isn't the right way to go about it? Even if it is, it might be
useful for people who choose to rely on GNU Make.
I think it would make a good side note to the documentation - either
saying it is limited to GNU Make, or explaining why it doesn't work
(even though the manual implies it should).
Have fun,
Oren Ben-Kiki