help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: should make elide the difference between "dir" and "dir/"?


From: David Boyce
Subject: Re: should make elide the difference between "dir" and "dir/"?
Date: Fri, 8 Oct 2021 10:11:38 -0700

Yes, exactly, what Paul said. Paul, this felt like a topic that might have
been beaten to death in the past but if not, and if it's viable, should I
file an enhancement request?

David

On Fri, Oct 8, 2021 at 9:31 AM Paul Smith <paul@mad-scientist.net> wrote:

> On Fri, 2021-10-08 at 18:01 +0200, Mark Piffer wrote:
> > There was a discussion recently here:
> >
> >
> https://stackoverflow.com/questions/66271761/gnu-make-wildcard-function-and-terminating-slashes-on-directory-names
> >
> > Short version: GNU make doesn't implement its own globbing (using
> > that which the libc is providing) and thus you can't really change
> > its behaviour in this regard, or at least you'll pay a heavy price.
>
> I think you're not quite following David's request.
>
> Today if you run this makefile:
>
>    all: ./foo
>
>    foo: ; @echo hi
>
> make will say "hi" even though the text "./foo" does not match the text
> "foo" (remember make's dependency/target matching is all done using
> simple text comparison, _normally_ you would not expect this to match).
>
> That's because make has a special built-in feature that it is smart
> enough to ignore the leading "./" when matching up prerequisites and
> targets.
>
> But if you run this makefile:
>
>    all: dir/
>
>    dir: ; @echo hi
>
> you'll get an error saying "no rule to make target dir/", because
> there's no special case that strips trailing "/" in GNU make, and the
> string "dir/" obviously is not equal to the string "dir".
>
> So David is asking that make have a new special-case rule that allows
> it to match while ignoring trailing slash, like it has to ignore
> preceding "./".
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]