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

    继续翻译

       Note that such a prerequisite constitutes mentioning `main.o' in a
    makefile, so it can never be considered an intermediate file by implicit
    rule search.  This means that `make' won't ever remove the file after
    using it; *note Chains of Implicit Rules: Chained Rules.
    
       With old `make' programs, it was traditional practice to use this
    compiler feature to generate prerequisites on demand with a command like
    `make depend'.  That command would create a file `depend' containing
    all the automatically-generated prerequisites; then the makefile could
    use `include' to read them in (*note Include::).
    
       In GNU `make', the feature of remaking makefiles makes this practice
    obsolete--you need never tell `make' explicitly to regenerate the
    prerequisites, because it always regenerates any makefile that is out
    of date.  *Note Remaking Makefiles::.
    
       The practice we recommend for automatic prerequisite generation is
    to have one makefile corresponding to each source file.  For each
    source file `NAME.c' there is a makefile `NAME.d' which lists what
    files the object file `NAME.o' depends on.  That way only the source
    files that have changed need to be rescanned to produce the new
    prerequisites.

    要注意对于在 makefile 中,此种前提条件,等同于提及了 main.o 文件,因此它绝不能被隐式规则搜索认为是一个中间文件。这意味着 make在使用此文件后 永不会删除它; *note Chains of Implicit Rules: Chained Rules.

    对旧的 make 程序,使用这种类似于 make depend 的,编译器的命令行功能按需来生成前提条件是一种传统的做法。此命令会生成一个文件 'depend' 包含所有的 自动生成的前提条件;这样 makefile 可用 include 来读取它们 。(*note Include::)

    在 GNU make 中,重新生成 makefile 的功能使得这种实践过时了 --你永远也不需要显式地告诉 make 去重新生成前提条件,因为它总是重新生成所有过期的makefile。*Note Remaking Makefiles:: 

    我们建议的自动前提条件生成是,为每一个源文件安排一个makefile。对每一个名为 NAME.c 的源文件,都有一个名为 NAME.d 的makefile ,列出所有的 NAME.o 文件所依赖的目标文件。用这种方法,只有变更的源文件需要被重新扫描以生成新的前提条件。

    后文待续

  • 相关阅读:
    数据压缩算法---LZ77算法 的分析与实现
    数据压缩算法---霍夫曼编码的分析与实现
    数据压缩的重要组成部分---位操作
    排序算法的C语言实现(上 比较类排序:插入排序、快速排序与归并排序)
    广度优先(bfs)和深度优先搜索(dfs)的应用实例
    数据结构 图的定义和搜索方法(清晰图解)
    数据结构-堆 接口定义与实现分析(详细注释与图解)
    数据结构-堆的定义描述
    数据结构 链式哈希表(Hash Table)的接口定义与实现分析(完整代码)
    SQLServer常用快捷键汇总
  • 原文地址:https://www.cnblogs.com/gaojian/p/2704207.html
Copyright © 2011-2022 走看看