@:(在符号冒号处)在Makefile中是什么意思?
Makefile中的以下内容是什么?
What does the following do in a Makefile?
rule: $(deps)
@:
我似乎无法在制作手册中找到它.
I can't seem to find this in the make manual.
这表示不要在输出中回显此命令".因此,此规则是说执行shell命令:
,不要回显输出.
It means "don't echo this command on the output." So this rule is saying "execute the shell command :
and don't echo the output.
当然,shell命令:
是无操作的,因此它的意思是什么也不做,不要告诉."
Of course the shell command :
is a no-op, so this is saying "do nothing, and don't tell."
为什么?
这里的窍门是,您将两种不同的语法混为一谈. make(1)语法是使用以@开头的动作,它只是不回显命令.像
The trick here is that you've got an obscure combination of two different syntaxes. The make(1) syntax is the use of an action starting with @, which is simply not to echo the command. So a rule like
always:
@echo this always happens
不会发射
echo this always happens
this always happens
现在,规则的操作部分可以是 any shell命令,包括:
. Bash帮助可以在任何地方对此进行解释:
Now, the action part of a rule can be any shell command, including :
. Bash help explains this as well as anywhere:
$ help :
:: :
Null command.
No effect; the command does nothing.
Exit Status:
Always succeeds.