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

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

继续翻译

Choosing a Shell in DOS and Windows...................................Choosing a shell in MS-DOS and MS-Windows is much more complex than onother systems.   On MS-DOS, if `SHELL' is not set, the value of the variable`COMSPEC' (which is always set) is used instead.   The processing of lines that set the variable `SHELL' in Makefilesis different on MS-DOS.  The stock shell, `command.com', isridiculously limited in its functionality and many users of `make' tendto install a replacement shell.  Therefore, on MS-DOS, `make' examinesthe value of `SHELL', and changes its behavior based on whether itpoints to a Unix-style or DOS-style shell.  This allows reasonablefunctionality even if `SHELL' points to `command.com'.   If `SHELL' points to a Unix-style shell, `make' on MS-DOSadditionally checks whether that shell can indeed be found; if not, itignores the line that sets `SHELL'.  In MS-DOS, GNU `make' searches forthe shell in the following places:  1. In the precise place pointed to by the value of `SHELL'.  For     example, if the makefile specifies `SHELL = /bin/sh', `make' will     look in the directory `/bin' on the current drive.  2. In the current directory.  3. In each of the directories in the `PATH' variable, in order.   In every directory it examines, `make' will first look for thespecific file (`sh' in the example above).  If this is not found, itwill also look in that directory for that file with one of the knownextensions which identify executable files.  For example `.exe',`.com', `.bat', `.btm', `.sh', and some others.   If any of these attempts is successful, the value of `SHELL' will beset to the full pathname of the shell as found.  However, if none ofthese is found, the value of `SHELL' will not be changed, and thus theline that sets it will be effectively ignored.  This is so `make' willonly support features specific to a Unix-style shell if such a shell isactually installed on the system where `make' runs.   Note that this extended search for the shell is limited to the caseswhere `SHELL' is set from the Makefile; if it is set in the environmentor command line, you are expected to set it to the full pathname of theshell, exactly as things are on Unix.   The effect of the above DOS-specific processing is that a Makefilethat contains `SHELL = /bin/sh' (as many Unix makefiles do), will workon MS-DOS unaltered if you have e.g. `sh.exe' installed in somedirectory along your `PATH'.

在DOS 或者 Windows中选择shell

...................................

Choosing a shell in MS-DOS and MS-Windows is much more complex than on

other systems.

在 MS-DOS 或者 MS-Windows 上选择一个shell, 比在其他系统上复杂多了。

在 MS-DOS , 如果 SHELL 没有设定,那么变量 COMSPEC 会被使用。

在 makefile里面的,对SHELL 的设定方式, 在 MS-DOS 上的表现,也有所不同。

陈旧的shell--command.com',被荒谬地限制在自己的功能里,很多make用户想要安装一个替代性的shell。

因此,在 MS-DOS, make 检查 SHELL 的值,根据它指向Unix 类型的shell 还是 DOS 类型的shell, 来决定自身的行为。

这可以保证合理的功能,甚至在 SHELL 指向了 command.com 时也是如此。

如果 SHELL 指向了一个 Unix 类型的shell, 那么在 MS-DOS 系统上的 make 要检查是否此shell 真的存在;如果没有,它就忽略那些使用SHELL 的行。在MS-DOS中, GNU make 搜索如下的地方:

1. 在SHELL 的值所精确指定的位置,例如,如果makefile 指定了 SHELL=/bin/sh,make 会搜索 当前驱动器的/bin目录。

2. 在当前目录。

3. 按照顺序搜索PATH 变量中指定的路径。

在每一个它所检查的目录,make 会先看看特定的文件(上述例子中的sh), 如果没有找到,它也会看看那些可知兴文锦,如.exe, .com,.bat,.btm,.sh 之类。

如果以上任何一个努力得到了成功,SHELL 的值回被设定为所找到的SHELL的全路径名。但是,如果没有找到,SHELL的值不会改变,设置它的行就会被无视。这也是 如果确实存在一个shell在此系统中存在,make 会仅仅支持 UNIX 类型的特定功能的原因。

请注意这个对shell的扩展搜索仅限于SHELL 被Makefile设置的场合;如果它被在环境变量或者命令行设置,你需要设置其完整路径名,就像那些在Unix中的一样。

上述DOS特定的处理效果是,一个包含 SHELL=/bin/sh 的makefile,如果你有诸如sh.exe 文件在你的PATH中,将要在MS-DOS 上正常无损地工作。

后文待续

本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/09/29/2707602.html,如需转载请自行联系原作者

你可能感兴趣的文章
搭建lnmp+tomcat+jdk环境 与安装zrblog
查看>>
redis 主从同步失败
查看>>
Linux Crontab 定时任务命令详解
查看>>
关于git,100MB大文件上传限制的问题,这里MARK一下
查看>>
分析SELinux日志,排除SELinux疑难
查看>>
PostgreSQL的递归查询(with recursive)
查看>>
iOS 改变字体行间距与字间距
查看>>
美丽说2012校招笔试面试全过程
查看>>
图像处理基础(七)图像的PCA(主成分分析)降维
查看>>
Math-Model(三)高斯羽烟模型计算气体扩散浓度
查看>>
ActionContext和ServletActionContext小结
查看>>
expect脚本语言编写
查看>>
Apache优化:修改最大并发连接数
查看>>
求职充电 | 这些实战干货你get了吗?
查看>>
KeyMob移动聚合广告平台:APP开发者怎样将广告收益最大化
查看>>
redis-cluster研究和使用
查看>>
关于驰骋工作流引擎ccbpm 在工业自动化环境下的应用演示实例
查看>>
【序言】 高效高可靠消息服务器构建
查看>>
每天一个linux命令(6):rmdir 命令
查看>>
第六周作业
查看>>