重要章节1:makefile如何读取的
来源:互联网 发布:万网域名主机记录 编辑:程序博客网 时间:2024/06/04 08:49
3.7 How make Reads a MakefileGNU make does its work in two distinct phases. During the first phase it reads all the makefiles, included makefiles, etc. and internalizes all the variables and their values, implicit and explicit rules, and constructs a dependency graph of all the targets and their prerequisites. During the second phase, make uses these internal structures to determine what targets will need to be rebuilt and to invoke the rules necessary to do so.It's important to understand this two-phase approach because it has a direct impact on how variable and function expansion happens; this is often a source of some confusion when writing makefiles. Here we will present a summary of the phases in which expansion happens for different constructs within the makefile. We say that expansion is immediate if it happens during the first phase: in this case make will expand any variables or functions in that section of a construct as the makefile is parsed. We say that expansion is deferred if expansion is not performed immediately. Expansion of a deferred construct is not performed until either the construct appears later in an immediate context, or until the second phase.You may not be familiar with some of these constructs yet. You can reference this section as you become familiar with them, in later chapters.Variable AssignmentVariable definitions are parsed as follows: immediate = deferred immediate ?= deferred immediate := immediate immediate += deferred or immediate define immediate deferred endef define immediate = deferred endef define immediate ?= deferred endef define immediate := immediate endef define immediate += deferred or immediate endefFor the append operator, ‘+=’, the right-hand side is considered immediate if the variable was previously set as a simple variable (‘:=’), and deferred otherwise.Conditional DirectivesConditional directives are parsed immediately. This means, for example, that automatic variables cannot be used in conditional directives, as automatic variables are not set until the recipe for that rule is invoked. If you need to use automatic variables in a conditional directive you must move the condition into the recipe and use shell conditional syntax instead.Rule DefinitionA rule is always expanded the same way, regardless of the form: immediate : immediate ; deferred deferredThat is, the target and prerequisite sections are expanded immediately, and the recipe used to construct the target is always deferred. This general rule is true for explicit rules, pattern rules, suffix rules, static pattern rules, and simple prerequisite definitions.
阅读全文
0 0
- 重要章节1:makefile如何读取的
- makefile重要的常识
- 重要章节2:关于变量和环境变量的转换关系
- C语言循环章节几个重要的函数总结~
- Makefile中几个重要的函数
- FPGA读取DRAM不成功的重要原因
- 如何调试makefile (1)
- Android开发的重要方面之Makefile分析
- 如何免费得到《程序员羊皮卷》中需要的章节?
- 如何免费得到《程序员羊皮卷》中需要的章节?
- LaTeX下如何改变章节标题编号的样式?
- 章节之外:makefile中的函数定义
- Makefile是如何编写的
- 如何写简单的Makefile
- 如何写简单的makefile
- 如何编写vc++的makefile
- 如何专注于重要的事?
- 如何专注于真正重要的事
- 如何在命令行中使用 ftp 命令上传和下载文件
- 高处看Surface,WIndow,View,SurfaceView
- iOS 关于linker command failed with exit code 1的坑
- mac连手机bug解决
- JDBC Thin连接ORACLE,错误类型ORA-12505
- 重要章节1:makefile如何读取的
- 重要章节2:关于变量和环境变量的转换关系
- Ubuntu 下设置电脑使用固定IP地址
- 内核地址空间的划分
- java数据转json格式两种方式
- CentOS 5.8下filebench安装
- 章节之外:makefile中的函数定义
- 正则表达式语法
- 数据结构之哈希表