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: Paul Smith
Subject: Re: should make elide the difference between "dir" and "dir/"?
Date: Fri, 08 Oct 2021 12:31:31 -0400
User-agent: Evolution 3.36.5-0ubuntu1

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]