如何在makefile中检查列表中的文件是否包含某些内容?

时间:2017-07-12 10:52:23

标签: bash makefile

我想检查具有特定名称的所有文件是否都包含字符串,如果不报告它们。我编写了这个序列并尝试了其他一些序列,但我不知道如何从列表中访问文件的包含。

SOURCES := $(shell find $(SOURCEDIR) -name 'mod.mak')#here I take the list of targeted files (this works fine)
$(foreach File, Files,
$(if $(grep -q "aaabbb" "$File"),,@echo "WARNING Missing sequence")
)

1 个答案:

答案 0 :(得分:1)

您的脚本存在多个问题。

首先,你need some rule/target。对于您的示例,我们可以制作PHONY target const cs = new pgp.helpers.ColumnSet(['one', 'two'], {table: 'my-table'}); const query = pgp.helpers.insert(values, cs); 。其次,要迭代test中的值,您需要reference it作为SOURCES。同样,$(SOURCES)调用$(file)。另外,grep的{​​{3}}是解释值,而不是退出代码,所以你不应该沉默make

这样做:

grep