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
[EMAIL PROTECTED]
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
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make