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)



In article <20140817101611.GQ965%roskakori.fi@localhost>,
Jarmo Jaakkola  <jarmo.jaakkola%roskakori.fi@localhost> wrote:
>I'll put this here up-front: as for the other issues, do you have
>comments on them?

No, I don't.

>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?)

I think pattern rules first appeared in SVR4 make, and GNU make adopted
them fromthere.

>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.

Yes, this is why I mentioned pattern rules before. All the suffix stuff
can be implemented on top of pattern rules.

>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.

Right.

>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?

I think that (a) is workable. Or we can wait for pattern rules, then
deprecate .NULL.

>> >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.

You could make .NULL take a list of suffixes and then check a suffix against
the list. Wouldn't that work?

.NULL: .b .d

christos



Home | Main Index | Thread Index | Old Index