Make fails to restrict output to just directories when a wildcard
contains both a trailing slash and internal slashes, even though it does
the right thing with no internal slashes.

$ mkdir /tmp/example
$ cd /tmp/example/
$ touch a
$ mkdir b
$ printf 'all:\n\t@echo $(wildcard */)' | make -f -
b/
$ printf 'all:\n\t@echo $(wildcard ./*/)' | make -f -
./b/ ./a

Both invocations should have omitted a, since the trailing slash cannot
match a non-directory (other than a symlink to a directory).

$ make --version | head -n2
GNU Make 3.82
Built for x86_64-redhat-linux-gnu

I encountered this while writing a macro for libvirt; as a workaround, I
ended up using a trailing /. to force just directories, then using
$(patsubst) to strip things back to what I wanted in the first place.

cross_dirs=$(patsubst $(srcdir)/src/%.,%,$(wildcard $(srcdir)/src/*/.))

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to