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

    继续翻译

    6.14 Other Special Variables
    ============================
    
    GNU `make' supports some variables that have special properties.
    
    `MAKEFILE_LIST'
         Contains the name of each makefile that is parsed by `make', in
         the order in which it was parsed.  The name is appended just
         before `make' begins to parse the makefile.  Thus, if the first
         thing a makefile does is examine the last word in this variable, it
         will be the name of the current makefile.  Once the current
         makefile has used `include', however, the last word will be the
         just-included makefile.
    
         If a makefile named `Makefile' has this content:
    
              name1 := $(lastword $(MAKEFILE_LIST))
    
              include inc.mk
    
              name2 := $(lastword $(MAKEFILE_LIST))
    
              all:
                      @echo name1 = $(name1)
                      @echo name2 = $(name2)
    
         then you would expect to see this output:
    
              name1 = Makefile
              name2 = inc.mk

    6.14 其他的特殊变量
    ============================

    GNU make 支持某些拥有特殊属性的变量

    `MAKEFILE_LIST'

    包含被make 解析的每一个makefile的名字,按照其被解析的顺序来罗列。在make 开始解析makefile之前,makefile的名字被追加近来。因此如果一个makefile所作的第一件事情是检查此变量中的最后一个单词,那么它将是当前的makefile。当当前的makefile使用了 include,那么最后一个单词将会是被包含的makefile的名字。

    如果一个名为`Makefile' 的makefile包含了如下的内容:

    name1 := $(lastword $(MAKEFILE_LIST))

    include inc.mk

    name2 := $(lastword $(MAKEFILE_LIST))

    all:
    @echo name1 = $(name1)
    @echo name2 = $(name2)

    那么,你将要看到如下的输出:

    name1 = Makefile
    name2 = inc.mk

    后文待续

  • 相关阅读:
    UART中RTS、CTS
    Verdi:内存不足
    SV学习之interface
    perl学习之:@_ $_
    perl学习之:package and module
    代码变成可执行程序期间,编译器做了那些事?
    perl学习之:use & require
    perl学习之:use and require
    8位二进制补码表示整数的最小值是什么,最大值是什么
    深入理解计算机系统
  • 原文地址:https://www.cnblogs.com/gaojian/p/2712151.html
Copyright © 2011-2022 走看看