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