tech-toolchain archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Make and makefile bugs (PRs 49085, 49086, 49087)
I'll put this here up-front: as for the other issues, do you have
comments on them?
Now back to the discussion about the .NULL target.
On Sat, Aug 16, 2014 at 11:13:07AM +0000, Christos Zoulas wrote:
> In article <20140810124542.GO965%roskakori.fi@localhost> you write:
> >I'm sorry but I do not understand what your example should do, therefore
> >I cannot answer your question.
>
> Yes, I got the example wrong... Here's what I meant. (Thanks for the example)
>
> $ cat << EOF > Makefile
> .SUFFIXES: .crap .gz
> .crap.gz:
> gzip ${.ALLSRC}
>
> .NULL: .crap
> all: foo.gz
> EOF
> $ touch foo
> $ make
> gzip foo
> $
>
> Can this be done with a single suffix rule?
Oh! Now I get it. This is a limited equivalent (only one supported
suffix) of the GNU pattern rule
%: %.gz
(I've only used NetBSD and GNU makes. Are there other makes which
support pattern rules?)
Looks like I had a reading comprehension problem with the code and
a limited imagination. I didn't realize and didn't even consider
the possibility of adding a suffix with the .NULL feature. We really
do need support for the pattern rules, so this would then truly be
an obsolete feature.
And the answer to your question now is: no, there's no way (that
I know of) how this could be achieved with a single suffix rule.
So straight up removing support for .NULL might not be a solution. What
would then be the proper fix for this? The case, as I see it, is:
1) "remove a suffix" aspect is redundant with the POSIX single
suffix rules. And as currently implemented, does actually break
them if used.
2) "add a suffix" aspect has no POSIX transformation rule equivalent.
And these are the three possible solutions I could come up with:
a) Retain full .NULL support. We then need to specify how it
interacts with the POSIX single suffix rules. This would IMO get
ugly and complicated.
b) Retain support for case 2 only. This would be a problem if
anyone has used the feature for doing case 1, as I think would be
the more common case. I don't think there is an easy, if any, way
to detect what the user meant, so only a warning could be issued
and it would probably drown in the flurry of compilation messages.
Unless issued at the end of the run, if the feature is used.
c) Remove support completely regardless. Firstly, the feature
is not documented in the manual page at all; and secondly what is
mentioned in "PMake -- A tutorial" did not, IMHO, suggest
that it would work in the other direction too. (even if version
history seems to suggest this feature has been there since forever)
This should work around the lack of "add a suffix" inference until
pattern rules are implemented:
FILES := file1 ... fileN
.for i in $(FILES)
$(i): $(i).suffix
commands...
.endfor
I admit it is not as convenient.
What should be done? Are there some other solutions?
> >Note that the functionality of .NULL is actually a subset of the single
> >suffix transformations. If you had the rules .a.b and .c.d, and files
> >foo.a and bar.c, you couldn't make both foo and bar with the same
> >makefile with .NULL only.
>
> Right, but that can be fixed.
Do you mean that .NULL should support multiple suffixes? Sounds a bit
hairy.
--
Jarmo Jaakkola
Home |
Main Index |
Thread Index |
Old Index