Makefile: Filter out strings containing a character
I'm trying to filter out strings that contain a particular character, but it doesn't work. I guess make
does not support multiple %
patterns?
.PHONY: test
test:
echo $(fi开发者_如何转开发lter-out %g%, seven eight nine ten)
Gives:
$ make test
echo seven eight nine ten
seven eight nine ten
It doesn't filter out "eight"? Actually what I want to do is filter out from a list of filenames those containing "$". (In a Java context.)
Any hope, or do I have to use $(shell)
?
Thanks.
Does the following function meet the purpose?
FILTER_OUT = $(foreach v,$(2),$(if $(findstring $(1),$(v)),,$(v)))
$(call FILTER_OUT,g, seven eight nine ten)
I recently did something similar using two wildcards
functions for excluding some files
.PHONY: test
test:
echo $(filter-out $(wildcard *g*.c),$(wildcard *.c))
精彩评论