博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
GNU make manual 翻译( 一百三十六)
阅读量:7115 次
发布时间:2019-06-28

本文共 2247 字,大约阅读时间需要 7 分钟。

继续翻译

5.3.2 Choosing the Shell------------------------The program used as the shell is taken from the variable `SHELL'.  Ifthis variable is not set in your makefile, the program `/bin/sh' isused as the shell.  The argument(s) passed to the shell are taken fromthe 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 theenvironment.  This is because the `SHELL' environment variable is usedto specify your personal choice of shell program for interactive use.It would be very bad for personal choices like this to affect thefunctioning 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, isexported.  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 torecipe lines.   However, on MS-DOS and MS-Windows the value of `SHELL' in theenvironment *is* used, since on those systems most users do not setthis variable, and therefore it is most likely set specifically to beused by `make'.  On MS-DOS, if the setting of `SHELL' is not suitablefor `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 thevalue 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值。

后文待续

转载地址:http://sgghl.baihongyu.com/

你可能感兴趣的文章
zabbix自定义监控3(2.4网页报警,邮件报警)
查看>>
我的友情链接
查看>>
Prime
查看>>
XML的DOM解析
查看>>
Android特效(1)----字幕滚动效果
查看>>
java获取当前类的绝对路径
查看>>
邮件服务器互发
查看>>
USB接口新规范USB3.0功能
查看>>
我的友情链接
查看>>
3Python全栈之路系列之RabbitMQ
查看>>
Cisco设备上设置DHCP实例
查看>>
Exchange Online中未送达报告(DSN)的总结与分析
查看>>
洛谷——P2819 图的m着色问题
查看>>
[转载]分布式数据库拆表拆库的常用策略
查看>>
腾讯微博微分享功能,更趋人性化!
查看>>
个人练习 - 单元测试练习
查看>>
我的友情链接
查看>>
python-selenum3 第三天补充——截图和退出
查看>>
在RHEL/CentOS 5/6下停用按下Ctrl-Alt-Del 重启系统的功能
查看>>
linux下删除或重命名乱码文件
查看>>