----- Original Message ----- From: "Ken Smith" <[EMAIL PROTECTED]>
To: "Angel Tsankov" <[EMAIL PROTECTED]>
Cc: "make-help mailing list" <[email protected]>
Sent: Friday, August 12, 2005 6:00 AM
Subject: Re: Getting a list of all source files in a tree


On Thu, Aug 11, 2005 at 11:54:46PM +0300, Angel Tsankov wrote:
Is it possible to get a list of all cpp files in a folder (including
subfolders) using wildcard functions only?

Using wildcard alone, this can only be done using Paul's suggestion.
However, you could define a function and recurse on it. It is much more
efficient than $(shell)ing to find.  It violates your original
constraint by strip, eval, addsuffix, if, and call ;)

find = \
$(strip \
 $(eval these-files := $(wildcard $(addsuffix /*,$(strip $(1))))) \
 $(these-files) \
 $(if $(strip $(these-files)),$(call find,$(these-files))) \
)

This gets you everything. You can $(filter %.cpp,$(call find,dir)) to make this more specific or define another function which does that for
you or modify the find function to deal with file suffixes or ...

 Ken


I think this is exactly what I need, Ken. Thanks a lot!

Angel Tsankov
[EMAIL PROTECTED]


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to