[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: should make elide the difference between "dir" and "dir/"?
From: |
Mark Piffer |
Subject: |
Re: should make elide the difference between "dir" and "dir/"? |
Date: |
Fri, 8 Oct 2021 10:42:59 +0200 |
The GNUmake table toolkit has an extension to the wildcard function, maybe
this could help you:
https://github.com/markpiffer/gmtt#call-wildcard-reclist-of-globs
Am So., 3. Okt. 2021 um 22:51 Uhr schrieb David Boyce <
david.s.boyce@gmail.com>:
> It's documented that make implements a special case to treat pathnames
> "foobar" and "./foobar" as identical even though comparisons are usually
> lexical, but I notice that it doesn't do the same 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 that 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. Has this been considered in the past?
>
> 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 matching could also
> be made to apply exclusively to order-only prerequisites which is where
> directories should be anyway.
>
> David
>
> $ 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.
>
- should make elide the difference between "dir" and "dir/"?, David Boyce, 2021/10/03
- Re: should make elide the difference between "dir" and "dir/"?,
Mark Piffer <=
- Re: should make elide the difference between "dir" and "dir/"?, David Boyce, 2021/10/08
- Re: should make elide the difference between "dir" and "dir/"?, Mark Piffer, 2021/10/08
- Re: should make elide the difference between "dir" and "dir/"?, Paul Smith, 2021/10/08
- Re: should make elide the difference between "dir" and "dir/"?, David Boyce, 2021/10/08
- Re: should make elide the difference between "dir" and "dir/"?, Paul Smith, 2021/10/08
- Re: should make elide the difference between "dir" and "dir/"?, Nicholas Clark, 2021/10/08
- Message not available
- Fwd: should make elide the difference between "dir" and "dir/"?, Britton Kerin, 2021/10/10
Re: should make elide the difference between "dir" and "dir/"?, Steven Simpson, 2021/10/10