help-make
[Top][All Lists]
Advanced

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

Re: wildcard for directory?


From: Paul Smith
Subject: Re: wildcard for directory?
Date: Wed, 9 Jun 2010 19:57:32 -0400

On Wed, 2010-06-09 at 17:25 -0500, Peng Yu wrote:
> No. It doesn't work.
> $ make
> echo ./ *.txt/
> ./ x.txt/
> $ cat Makefile
> .PHONY: all
> 
> all:
>         echo $(dir (wildcard *.txt/.))

If someone tells you something works and it doesn't work for you, please
double- and triple-check your work before responding.  In programming
every single character counts.

Here, you've forgotten the "$" before the wildcard function.


Here's what I get:

        ~$ mkdir tst
        ~$ cd tst
        tst$ touch foo.txt
        tst$ mkdir bar.txt
        tst$ mkdir baz.txt
        tst$ touch blah.txt
        
        tst$ echo 'x: ; @echo "$(wildcard *.txt/.)"' | make -f-
        bar.txt/. baz.txt/.

Which appears to me to be what you were looking for.  Adding $(dir ...)
will strip off the "." but not the trailing slash (I forgot this is how
$(dir ...) is documented to work).  If you want to remove both you can
use patsubst:

        tst$ echo 'x: ; @echo "$(dir $(wildcard *.txt/.))"' | make -f-
        bar.txt/ baz.txt/
        
        tst$ echo 'x: ; @echo "$(patsubst %/.,%,$(wildcard *.txt/.))"' | make 
-f-
        bar.txt baz.txt






reply via email to

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