The wildcard
function takes several patterns. The addsuffix
function appends a suffix to each word in a list. So:
INC = $(wildcard $(addsuffix /*.hpp,$(DIRS)))
should do what you want. There are other ways like:
INC = $(foreach d,$(DIRS),$(wildcard $(d)/*.hpp))
or, if you have the find
utility and want to find all *.hpp
files, in any subdirectory at any depth (not just in $(DIRS)
):
INC = $(shell find . -type f -name '*.hpp')
This last form may be better because you do not need to provide the list of directories.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…