继续翻译
Sometimes you want to split a long line inside of single quotes, but you don't want the backslash-newline to appear in the quoted content. This is often the case when passing scripts to languages such as Perl, where extraneous backslashes inside the script can change its meaning or even be a syntax error. One simple way of handling this is to place the quoted string, or even the entire command, into a `make' variable then use the variable in the recipe. In this situation the newline quoting rules for makefiles will be used, and the backslash-newline will be removed. If we rewrite our example above using this method: HELLO = 'hello \ world' all : ; @echo $(HELLO) we will get output like this: hello world If you like, you can also use target-specific variables (*note Target-specific Variable Values: Target-specific.) to obtain a tighter correspondence between the variable and the recipe that uses it.
有时候你可能想要分割一个在单引号中的长行,但是你不希望反斜线出现在引号内容中。当传递脚本到诸如Perl 之类的语言时,常常有此种情形。额外的反斜线会导致语义的改变,甚至一个语法错误。一个处理这个问题的简单方法是,把这个字符串甚至整个命令放入到一个 make 变量中,然后再在片段中使用此变量。在此种场合下,makefile的新行引用规则将其作用。反斜线将要被移出。如果我们用此种方法重写,会是如下样子:
HELLO = 'hello \
world'
all : ; @echo $(HELLO)
我们会得到如下的输出:
hello world
如果你愿意,你可以使用 目的特定的变量(*note Target-specific Variable Values: Target-specific)来在变量和使用变量的片断之间获得更紧密地联系。
后文待续