zoukankan      html  css  js  c++  java
  • GNU make manual 翻译(四十七)

    继续翻译

    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 additional
    makefiles 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 environment
    automatically 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.

    后文待续

  • 相关阅读:
    Windows Azure Storage (17) Azure Storage读取访问地域冗余(Read Access – Geo Redundant Storage, RA-GRS)
    SQL Azure (15) SQL Azure 新的规格
    Azure China (5) 管理Azure China Powershell
    Azure China (4) 管理Azure China Storage Account
    Azure China (3) 使用Visual Studio 2013证书发布Cloud Service至Azure China
    Azure China (2) Azure China管理界面初探
    Azure China (1) Azure公有云落地中国
    SQL Azure (14) 将云端SQL Azure中的数据库备份到本地SQL Server
    [New Portal]Windows Azure Virtual Machine (23) 使用Storage Space,提高Virtual Machine磁盘的IOPS
    Android数据库升级、降级、创建(onCreate() onUpgrade() onDowngrade())的注意点
  • 原文地址:https://www.cnblogs.com/gaojian/p/2684802.html
Copyright © 2011-2022 走看看