help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a list of all source files in a tree


From: Angel Tsankov
Subject: Re: Getting a list of all source files in a tree
Date: Fri, 12 Aug 2005 09:58:53 +0300

----- Original Message ----- From: "Ken Smith" <address@hidden>
To: "Angel Tsankov" <address@hidden>
Cc: "make-help mailing list" <address@hidden>
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
address@hidden




reply via email to

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