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


    继续翻译

    5.3.2 Choosing the Shell
    ------------------------
    
    The program used as the shell is taken from the variable `SHELL'.  If
    this variable is not set in your makefile, the program `/bin/sh' is
    used as the shell.  The argument(s) passed to the shell are taken from
    the variable `.SHELLFLAGS'.  The default value of `.SHELLFLAGS' is `-c'
    normally, or `-ec' in POSIX-conforming mode.
    
       Unlike most variables, the variable `SHELL' is never set from the
    environment.  This is because the `SHELL' environment variable is used
    to specify your personal choice of shell program for interactive use.
    It would be very bad for personal choices like this to affect the
    functioning of makefiles.  *Note Variables from the Environment:
    Environment.
    
       Furthermore, when you do set `SHELL' in your makefile that value is
    _not_ exported in the environment to recipe lines that `make' invokes.
    Instead, the value inherited from the user's environment, if any, is
    exported.  You can override this behavior by explicitly exporting
    `SHELL' (*note Communicating Variables to a Sub-`make':
    Variables/Recursion.), forcing it to be passed in the environment to
    recipe lines.
    
       However, on MS-DOS and MS-Windows the value of `SHELL' in the
    environment *is* used, since on those systems most users do not set
    this variable, and therefore it is most likely set specifically to be
    used by `make'.  On MS-DOS, if the setting of `SHELL' is not suitable
    for `make', you can set the variable `MAKESHELL' to the shell that
    `make' should use; if set it will be used as the shell instead of the
    value of `SHELL'.

    5.3.2 选择Shell
    ------------------------

    作为shell 来运行的程序是由变量SHELL指定的。如果在你的makefile里面没有设定此变量,程序 /bin/sh将作为shell 被使用。传递给 shell的参数从变量 .SHELLFLAGS中来。.SHELLFLAGS的缺省值是-c,或者在POSIX-一致的模式下是 -ec。

    不像大多数变量,变量SHELL永远不能从环境中设定。 这是因为SHELL环境变量是用来制定你的个人为了通系统交互的shell程序的。由于个人的选择而影响到makefile的运作是非常糟糕的。*Note Variables from the Environment:Environment.

    而且, 当你确实在makefile中设定了SHELL,这个值不会输出到make的片段行所激活的环境中,反而,
    Instead, 从用户环境中继承来的变量,会被导出。 你可以通过显式到处SHELL,来覆盖这种行为。(*note Communicating Variables to a Sub-`make':Variables/Recursion.), 将此值传递到片段行的环境中。

    然而,在MS-DOS 和 MS-Windows 环境中,SHELL 在环境中会被使用,因为在那些环境中,大多数的系统并不会设置这个变量,因此它最可能被make 使用。 在MS-DOS中,如果对SHELL的设置对make 不合适,你可以设置变量 MAKESHELL,告诉make 用哪个shell; 如果使用了这个变量,会优先于SHELL值。

    后文待续

  • 相关阅读:
    JAVA_基础集合List接口与Set接口(二)
    JAVA_基础集合Collection接口与Iterator迭代器(一)
    JAVA_基础注解的概念
    JAVA_基础多线程的生命周期、线程安全、线程锁、线程通信与创建线程(二)
    JAVA_基础多线程(一)
    JAVA_基础异常概述与异常体系的结构
    JAVA_基础内部类
    JAVA_基础面向对象:接口
    Golang 学习资源
    go语言-异常处理机制-panic和recover的使用和原理
  • 原文地址:https://www.cnblogs.com/gaojian/p/2707235.html
Copyright © 2020-2023  润新知