继续翻译

4.7 Rules without Recipes or Prerequisites
==========================================If a rule has no prerequisites or recipe, and the target of the rule is
a nonexistent file, then `make' imagines this target to have been
updated whenever its rule is run.  This implies that all targets
depending on this one will always have their recipe run.An example will illustrate this:clean: FORCErm $(objects)FORCE:Here the target `FORCE' satisfies the special conditions, so the
target `clean' that depends on it is forced to run its recipe.  There
is nothing special about the name `FORCE', but that is one name
commonly used this way.As you can see, using `FORCE' this way has the same results as using
`.PHONY: clean'.
Using `.PHONY' is more explicit and more efficient.  However, other
versions of `make' do not support `.PHONY'; thus `FORCE' appears in
many makefiles.  *Note Phony Targets::.

4.7 没有片段或前提条件的规则
==========================================

如果一个规则没有前提条件或者片段,并且此规则的目的是一个尚未存在的文件,那么 make 将认为此目的在任何一次make 运行时都已经被更新。这暗示着每个依赖于此的目的都总是运行其片段。

例子是这样的:

clean: FORCE
rm $(objects)
FORCE:

这里,目的 FORCE 满足前面所述的特定的条件,于是依赖此 目的的 目的 clean 被强制执行。这里的名字 FORCE 没有任何特殊之处,但是是一个通常被使用的名字。

如你所见,采用这种方法用 FORCE 和用 .PHONY: clean 是一样的效果。

使用 .PHONY 更佳的明确和更有效率,但是其他版本的 make ,有的不支持 .PHONY 语法;因此你会在某些 makefile里面看到 FORCE 出现。 *Note Phony Targets::

后文待续

转载于:https://www.cnblogs.com/gaojian/archive/2012/09/20/2695334.html

GNU make manual 翻译( 一百零四)相关推荐

  1. GNU make manual 翻译( 一百零九)

    继续翻译 `.LOW_RESOLUTION_TIME' If you specify prerequisites for `.LOW_RESOLUTION_TIME', `make' assumes ...

  2. GNU make manual 翻译( 一百二十四)

    继续翻译 Note that such a prerequisite constitutes mentioning `main.o' in a makefile, so it can never be ...

  3. GNU make manual 翻译( 一百五十四)

    继续翻译 6.1 Basics of Variable References =================================To substitute a variable's v ...

  4. GNU make manual 翻译( 一百六十四)

    继续翻译 When you add to a variable's value with `+=', `make' acts essentially as if you had included th ...

  5. GNU make manual 翻译( 一百五十五)

    继续翻译 6.2 The Two Flavors of Variables ================================There are two ways that a vari ...

  6. GNU make manual 翻译( 一百八十一)

    继续翻译 The syntax of the CONDITIONAL-DIRECTIVE is the same whether the conditional is simple or comple ...

  7. GNU make manual 翻译( 一百二十一)

    继续翻译 4.13 Double-Colon Rules =======================Double-colon rules are explicit rules written wi ...

  8. GNU make manual 翻译( 一百八十三)

    继续翻译 `ifndef VARIABLE-NAME' If the variable VARIABLE-NAME has an empty value, the TEXT-IF-TRUEis eff ...

  9. GNU make manual 翻译( 一百五十九)

    继续翻译 A computed variable name need not consist entirely of a single variable reference. It can conta ...

最新文章

  1. 工信部:2017工业物联网白皮书
  2. C 语言 *** glibc detected *** free(): invalid next size (fast): 0x0000000000be1010 ***
  3. 人人都是架构师: 约束和原则
  4. Java版本多用户B2B2C商城源码-(八)消息总线(Spring Cloud Bus)
  5. boost::random模块使用多精度类型测试所有与整数相关的生成器和分布的测试程序
  6. wp自定义帖子没标签_拼多多搜索智能推广和自定义推广区别在哪里?
  7. CentOS7 如何关闭防火墙
  8. 上海市职业介绍中心长宁分中心武夷路513-517号(021)62400032-229
  9. BlockChain:区块链入门课程 -- 区块链应用于能源 POWER LEDGER案例
  10. 1052. 卖个萌 (20)-PAT乙级真题
  11. 15.凤凰架构:构建可靠的大型分布式系统 --- 服务网格
  12. UINO优锘:竞速“元宇宙”,中国能凭借数字孪生技术突围吗?
  13. 516. Longest Palindromic Subsequence
  14. Class not found so assuming code is running on a pre-Java 9 JVM
  15. [Markdown编辑器推荐] - 这个MarkText有点东西啊
  16. 第一章 复数 1-2 复数的几何表示
  17. Java第三章-数组
  18. Linux环境搭建基础(二)
  19. 5.31 综合案例2.0 - 在线音乐盒
  20. GAF安装部署-微服务架构下的云原生部署

热门文章

  1. 数据结构-线性表之顺序表
  2. leetcode刷题 153.寻找旋转排序数组中的最小值
  3. 一位强人写的电子工程师起码技术要求
  4. C语言高级编程:深入理解const
  5. 你会因为贫富差距远离曾经的好友吗?
  6. Scroll Dialog
  7. core webapi缩略图_netcore 图片缩略图
  8. python3远程连接_Python3 SSH远程连接服务器的方法示例
  9. python vtk mousemove_VTK的视点研究之三维空间漫游(转载)
  10. java 验证码_java学习之web基础(6):使用Response的输出流在页面输出验证码