GNU make manual 翻译( 一百三十二)

继续翻译

5.2 Recipe Echoing

==================



Normally `make' prints each line of the recipe before it is executed.

We call this "echoing" because it gives the appearance that you are

typing the lines yourself.



   When a line starts with `@', the echoing of that line is suppressed.

The `@' is discarded before the line is passed to the shell.  Typically

you would use this for a command whose only effect is to print

something, such as an `echo' command to indicate progress through the

makefile:



     @echo About to make distribution files



   When `make' is given the flag `-n' or `--just-print' it only echoes

most recipes, without executing them.  *Note Summary of Options:

Options Summary.  In this case even the recipe lines starting with `@'

are printed.  This flag is useful for finding out which recipes `make'

thinks are necessary without actually doing them.



   The `-s' or `--silent' flag to `make' prevents all echoing, as if

all recipes started with `@'.  A rule in the makefile for the special

target `.SILENT' without prerequisites has the same effect (*note

Special Built-in Target Names: Special Targets.).  `.SILENT' is

essentially obsolete since `@' is more flexible.

5.2 片段显示
==================

通常 make 在执行片段的一行之前,打印出此行。我们成为显示。因为它给出你自己输入的原样。当一行开始于@, 对此行的显示被禁止。在此行被传递给shell的时候,@被去掉。典型地,你可以用这个命令来单纯打印一些东西,比如用 echo 命令来显示 makefile 的进度,例如:

@echo About to make distribution files

当运行 make 时,给定了标志 -n 或者 --just-print ,它只显示所有的片段,而不执行它们。*Note Summary of Options: Opitons Summary. 在这种场合下既使是开始于 @ 的行也会被显示。 当想要找出 make 认为哪个片段应当执行而不必执行的时候,是有用的。

make 的 -s 或者 --silent 标志,禁止所有的显示,就好像素有的片段都开始于@一样。一个带有特殊目的 没有前提条件的.SLIENT 的makefile 也可以达成同样效果(*note Special Built-bin Target Names: Sepcial Targets.)。.SLIENT 更加的老式应当废弃,因为 @更加灵活。

后文待续

你可能感兴趣的:(Make)