我想使用 Make 以增量方式将 Gimpel PC-Lint 应用到我的源代码。我希望它仅在源文件自上次运行 lint 后发生更改时才对源文件运行 lint。有人这样做吗?你是如何接近它的?
最佳答案
常见的模式是创建输出(如果没有,则创建人工输出)。
编辑注意$(LINT) $< > $@
将扩展为类似 lint test.cpp > test.lint
的内容(将输出重定向到该文件)
例如
%.o: %.cpp | %.lint
S(CC) -o $@ $(CPPFLAGS) $<
%.lint: %.cpp
$(LINT) $< > $@
或者对于没有输出的过程:
%.o: %.cpp | %.emailsent
S(CC) -o $@ $(CPPFLAGS) $<
%.emailsent: %.cpp
$(DOEMAIL) $^ # no output from mail sender
touch $@ # won't be reached DOEMAIL returned error
关于c++ - 如何使用 make 运行增量 PC-Lint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8399735/