[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: use of wildcard function recursively
From: |
John Graham-Cumming |
Subject: |
Re: use of wildcard function recursively |
Date: |
Thu, 16 Mar 2006 09:49:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
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/
- use of wildcard function recursively, Aditya Kher, 2006/03/16
- Re: use of wildcard function recursively,
John Graham-Cumming <=
- Re: use of wildcard function recursively, Chris Chiasson, 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, 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