bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in $(wildcard) with trailing slash


From: Eric Blake
Subject: bug in $(wildcard) with trailing slash
Date: Fri, 02 Mar 2012 06:57:06 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

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:address@hidden $(wildcard */)' | make -f -
b/
$ printf 'all:address@hidden $(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   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]