[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #61328] elide the distinction between "dir" and "dir/"
From: |
David Boyce |
Subject: |
[bug #61328] elide the distinction between "dir" and "dir/" |
Date: |
Sun, 10 Oct 2021 19:01:27 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 |
URL:
<https://savannah.gnu.org/bugs/?61328>
Summary: elide the distinction between "dir" and "dir/"
Project: make
Submitted by: boyski
Submitted on: Sun 10 Oct 2021 11:01:25 PM UTC
Severity: 3 - Normal
Item Group: Enhancement
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: SCM
Operating System: None
Fixed Release: None
Triage Status: None
_______________________________________________________
Details:
It's documented that make implements a special case to treat pathnames
"foobar" and "./foobar" as identical even though comparisons are usually
lexical, but it does not do something similar with trailing slashes on
directory names. For instance in the test case below the target depends on its
parent directory $(@D) which comes out as "foo". We've supplied a rule for
making it but due to the behavior of the $(dir ...) function the target comes
out as "foo/" which doesn't match. This can be "fixed" with the patsubst
function but life would be more convenient and less mysterious if make
recognized them as the same.
The obvious concern is that we don't know a priori whether a target is a
directory or file. However, since "foo/" is illegal for anything but a
directory it seems harmless to assume directory. This special case could also
be made to apply exclusively to order-only prerequisites which is where
directory dependencies should be anyway.
Test case:
$ cat Makefile
.SECONDEXPANSION:
target := foo/bar
$(target): $$(@D)
touch $@
$(dir $(target)):
mkdir -p $@
$ make
make: *** No rule to make target 'foo', needed by 'foo/bar'. Stop.
If $(dir $(target)) is wrapped as $(patsubst %/,%,$(dir $(target))) everything
works as anticipated.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61328>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #61328] elide the distinction between "dir" and "dir/",
David Boyce <=
- [bug #61328] elide the distinction between "dir" and "dir/", Dmitry Goncharov, 2021/10/10
- [bug #61328] elide the distinction between "dir" and "dir/", David Boyce, 2021/10/11
- [bug #61328] elide the distinction between "dir" and "dir/", Dmitry Goncharov, 2021/10/11
- [bug #61328] elide the distinction between "dir" and "dir/", Paul D. Smith, 2021/10/11
- [bug #61328] elide the distinction between "dir" and "dir/", David Boyce, 2021/10/11
- [bug #61328] elide the distinction between "dir" and "dir/", Paul D. Smith, 2021/10/11
- [bug #61328] elide the distinction between "dir" and "dir/", David Boyce, 2021/10/12