help-make
[Top][All Lists]
Advanced

[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:28:15 -0600

actually, it appears an issue with space handling is also preventing
rwildcard from working

does anyone have a way to obtain a recursive listing of all files
underneath a relative path that is robust against spaces (and
hopefully apostrophes too)?

On 3/27/06, Chris Chiasson <address@hidden> wrote:
> 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/
>


--
http://chris.chiasson.name/




reply via email to

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