Reputation: 35276
I've got the following Makefile:
INPUT= prefixABC_sample1_suffixXYZ.txt prefixDEFG_sample1_suffixWXY.txt prefixUGAZ_sample1_suffixAZE.txt \
prefixHIJK_sample2_suffixUAG.txt prefix9878_sample2_suffixIUHAZD.txt
SAMPLES= sample1 sample2
sample1.out: $(missingfunction sample1,${INPUT})
echo $^ > $@
How can I extract the files from ${INPUT}
containing the word "sample1" ? I known about $(findstring)
but it returns the key, not the matches.
Upvotes: 0
Views: 59
Reputation: 100956
You'll have to do it using a for loop:
sample1 = $(foreach F,$(INPUT),$(if $(findstring sample1,$F),$F))
Upvotes: 1