在以下 Makefile 片段中,asciidoctor如果当前文件是“list.html”,我将如何避免运行命令。
%.html: src/%.m4
@echo $@
@asciidoctor -s -a linkcss -a stylesheet=plain.css src/$(LATEST).adoc
@m4 -D__latest=$(LATEST) $< > out/$@
Run Code Online (Sandbox Code Playgroud)
制定一个明确的规则来list.html覆盖通配符。
我没有你的asciidoctor或设置,所以我将用 just和 as 规则的操作m4来显示它(这里是必要的,因为没有操作的空规则将不起作用,在你的情况下,你将在没有for 的情况下运行) ,具有以下内容:cp::m4asciidoctorlist.htmlMakefile
list.html:
: do nothing for $@
%.html: %.m4
cp $< $@
Run Code Online (Sandbox Code Playgroud)
运行示例:
list.html:
: do nothing for $@
%.html: %.m4
cp $< $@
Run Code Online (Sandbox Code Playgroud)
:是 sh 中的“空命令”。来自help :bash:
:: : 空命令。
Run Code Online (Sandbox Code Playgroud)No effect; the command does nothing. Exit Status: Always succeeds.
可以像往常一样使用 抑制输出@:。 true或者@true也会起作用。