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 $(filter-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.
$@ is the name of the target being generated, and $< the first prerequisite (usually a source file). You can find a list of all these special variables in the GNU Make manual.
Finds whitespace-separated words in TEXT that match PATTERN and replaces them with REPLACEMENT. Here PATTERN may contain a % which acts as a wildcard, matching any number of any characters within a word.
MAKEFILE_LIST. Contains the name of each makefile that is parsed by make , in the order in which it was parsed. The name is appended just before make begins to parse the makefile. Thus, if the first thing a makefile does is examine the last word in this variable, it will be the name of the current makefile.
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))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With