• GNU make manual 翻译( 一百三十四)


    继续翻译

    5.3.1 Using One Shell
    ---------------------
    
    Sometimes you would prefer that all the lines in the recipe be passed
    to a single invocation of the shell.  There are generally two
    situations where this is useful: first, it can improve performance in
    makefiles where recipes consist of many command lines, by avoiding
    extra processes.  Second, you might want newlines to be included in
    your recipe command (for example perhaps you are using a very different
    interpreter as your `SHELL').  If the `.ONESHELL' special target
    appears anywhere in the makefile then _all_ recipe lines for each
    target will be provided to a single invocation of the shell.  Newlines
    between recipe lines will be preserved.  For example:
    
         .ONESHELL:
         foo : bar/lose
                 cd $(@D)
                 gobble $(@F) > ../$@
    
    would now work as expected even though the commands are on different
    recipe lines.

    5.3.1 使用 One Shell
    ---------------------

    有些时候可能想要一个片段的所有行都被传递给shell的一次激活。在两种情况下,这是有用的: 

    首先,当片段由很多命令行组成的时候,它能够避免额外的处理以提高性能。

    第二,你可能想要在片段中包含新的行 (例如你可能正在使用一个非常不一样的解释器来作为你的shell)。

    如果特殊目的 .ONESHELL 出现在makefile的任何地方,每一个目的的所有行都会被一个单独的shell 激活所处理。片段之间的新行被保留。例如:

    .ONESHELL:

    foo : bar/lose
    cd $(@D)
    gobble $(@F) > ../$@

    将会按照预想的方式来工作,哪怕是他们在不同的行。

    后文待续

  • 相关阅读:
    P2676 超级书架
    P2955 [USACO09OCT]奇数偶数Even? Odd?
    P1554 梦中的统计
    P2614 计算器弹琴
    4246 奶牛的身高
    Render2
    @viewChild
    querySelector
    ionic4封装样式原理
    事件委托和事件冒泡
  • 原文地址:https://www.cnblogs.com/gaojian/p/2707016.html
Copyright © 2020-2023  润新知