zoukankan      html  css  js  c++  java
  • GNU make manual 翻译( 一百三十)

    继续翻译

       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)来在变量和使用变量的片断之间获得更紧密地联系。

    后文待续

  • 相关阅读:
    redis远程连接超时
    GNU LIBC源代码学习之strcmp
    计算最小生成树
    域名和空间的绑定问题
    Spring MVC 基于Method的映射规则(注解版)
    Spring MVC 基于URL的映射规则(注解版)
    手把手教你编写Logstash插件
    Ruby中如何识别13位的时间戳
    [logstash-input-http] 插件使用详解
    Java直接(堆外)内存使用详解
  • 原文地址:https://www.cnblogs.com/gaojian/p/2705609.html
Copyright © 2011-2022 走看看