我有以下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 $^ > $@
如何从含有“sample1”一词的${INPUT}
中提取文件?我知道$(findstring)
,但它返回密钥,而不是匹配。
答案 0 :(得分:1)
你必须使用for循环:
sample1 = $(foreach F,$(INPUT),$(if $(findstring sample1,$F),$F))