[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use of wildcard function recursively
From: |
Chris Chiasson |
Subject: |
Re: use of wildcard function recursively |
Date: |
Mon, 27 Mar 2006 19:14:28 -0600 |
my bash script is failing me on file names with spaces... so i decided
to use rwildcard
in my tests, rwildcard seems to be returning file names without their
paths - is there a way to make it prepend the relative path?
thank you,
On 3/16/06, John Graham-Cumming <address@hidden> wrote:
> Aditya Kher wrote:
> > Is there any way to use wildcard to *find recursively* under given path
> > e.g.
> >
> > SOURCE = $(wildcard source_dir/*.c)
>
> $(wildcard ...) itself is not recursive, but it's pretty easy to wrap
> about $(wildcard ...) to make it recursive. Here's my rwildcard
> function which works like wildcard but it recursive:
>
> rwildcard = $(foreach d,$(wildcard $1*),$(call
> rwildcard,$d/)$(filter $(subst *,%,$2),$d))
>
> rwildcard has two parameters: the directory in which to start looking
> for files (this must either be blank for the current directory or end in
> a /); the second parameter is the search specification.
>
> For example to find all .c files in the current directory and
> subdirectories do
>
> $(call rwildcard,,*.c)
>
> To find all .c files in /tmp do
>
> $(call rwildcard,/tmp,*.c)
>
> To find all .c file in a/b/c do
>
> $(call rwildcard,a/b/c,*.c)
>
> rwildcard only handles the * glob and not other more complex patterns.
> The nice thing about rwildcard is that it doesn't depend on a specific
> shell or shell executable function like find.
>
> John.
> --
> John Graham-Cumming
> address@hidden
>
> Home: http://www.jgc.org/
> Blog: http://www.jgc.org/blog/
>
> POPFile: http://getpopfile.org/
> GNU Make Standard Library: http://gmsl.sf.net/
> GNU Make Debugger: http://gmd.sf.net/
> Fast, Parallel Builds: http://www.electric-cloud.com/
>
> Sign up for my Spam and Anti-spam Newsletter
> at http://www.jgc.org/
>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
>
--
http://chris.chiasson.name/
- use of wildcard function recursively, Aditya Kher, 2006/03/16
- Re: use of wildcard function recursively, John Graham-Cumming, 2006/03/16
- Re: use of wildcard function recursively,
Chris Chiasson <=
- Re: use of wildcard function recursively, Chris Chiasson, 2006/03/27
- Re: use of wildcard function recursively, Paul D. Smith, 2006/03/27
- Re: use of wildcard function recursively, Aditya Kher, 2006/03/27
- Re: use of wildcard function recursively, Chris Chiasson, 2006/03/27
- Re: use of wildcard function recursively, Paul D. Smith, 2006/03/27
- Re: use of wildcard function recursively, Chris Chiasson, 2006/03/28
- Re: use of wildcard function recursively, Paul D. Smith, 2006/03/28
- Re: use of wildcard function recursively, Paul D. Smith, 2006/03/27