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

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

继续翻译

3.4 The Variable `MAKEFILES'                            ============================                                                        If the environment variable `MAKEFILES' is defined, `make' considers its value as a list of names (separated by whitespace) of additionalmakefiles to be read before the others.  This works much like the `include' directive: various directories are searched for those files  (*note Including Other Makefiles: Include.).  In addition, the default goal is never taken from one of these makefiles (or any makefile included by them) and it is not an error if the files listed in  `MAKEFILES' are not found.                                                           The main use of `MAKEFILES' is in communication between recursive invocations of `make' (*note Recursive Use of `make': Recursion.).  It usually is not desirable to set the environment variable before a top-level invocation of `make', because it is usually better not to mess with a makefile from outside.  However, if you are running `make' without a specific makefile, a makefile in `MAKEFILES' can do useful  things to help the built-in implicit rules work better, such as    defining search paths (*note Directory Search::).                                                           Some users are tempted to set `MAKEFILES' in the environmentautomatically on login, and program makefiles to expect this to be done.This is a very bad idea, because such makefiles will fail to work if run by anyone else.  It is much better to write explicit `include' directives in the makefiles.  *Note Including Other Makefiles: Include.

3.4 变量 MAKEFILES

如果 环境变量 MAKEFILES 被定义了,那么 make 会在读取其他 makefile之前,先读取 MAKEFILES定义的列表中的名字(由空格分隔)。这有点像 include 指令:各目录会被搜索(*note Including Other Makefiles:Include.)。并且,缺省的终点也不会从这些makefile(或被其包含的makefile)中获得,如果找不到相应的 makefile, 也不会报错。

 

'MAKEFILES' 的主要用途是在 递归调用(*note Recursive Use of 'make') make 时进行通信。

通常在顶层调用 make 之前,是不推荐设置 此环境变量的,因为通常最好不要和外面的makefile混淆。

但是如果你运行 make 时,没有指定一个特定的 makefile, 那么 MAKEFILES 中定义的 makefile可以做一些有益的事情来帮助使隐式规则运行得更好,例如定义搜索路径(*note Directory Search)

 

有些用户试图在设置在 登录后自动设置 MAKEFILES 环境变量,并且编排 makefile使得此种设定生效。

这是一个坏主意,因为如此一来,它同时被其他人运行时,就会出错退出。更好的办法是在 makefile中写include 指令。 *Note Including Other Makefiles: Include.

后文待续

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

你可能感兴趣的文章
spring cloud: eureka搭建
查看>>
导弹拦截
查看>>
两个被广泛使用的Model Checking工具
查看>>
BZOJ 4999 This Problem Is Too Simple!
查看>>
[HDU]3555Bomb
查看>>
论语之里仁第四
查看>>
html优化
查看>>
ASP.NET页面通过URL传递参数(一)(转载)
查看>>
svn迁移,备份,重装系统后恢复数据 收藏
查看>>
Windows Phone实用开发技巧(41):解决WebBrowser中显示黑色背景网页闪屏
查看>>
JDBC详解(汇总)
查看>>
POJ - 1995 Raising Modulo Numbers 【快速幂】
查看>>
似然(likelihood)和概率(probability)的区别与联系
查看>>
mysql账户添加远程访问
查看>>
806. Number of Lines To Write String
查看>>
SQL语句语法简介
查看>>
hudson安装
查看>>
[翻译 EF Core in Action] 1.5 关于NoSql
查看>>
集合--Set&&HashSet和TreeSet
查看>>
ANDROID开发实用小工具
查看>>