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

    继续翻译

    4 Writing Rules                        
    ***************                        
                            
    A "rule" appears in the makefile and says when and how to remake certain files, called the rule's "targets" (most often only one per rule).  It lists the other files that are the "prerequisites" of the target, and the "recipe" to use to create or update the target.                        
                            
       The order of rules is not significant, except for determining the default goal: the target for `make' to consider, if you do not otherwise specify one.  The default goal is the target of the first rule in the first makefile.  If the first rule has multiple targets, only the first target is taken as the default.  There are two exceptions: a target starting with a period is not a default unless it contains one or more slashes, `/', as well; and, a target that defines a pattern rule has no effect on the default goal.  (*Note Defining and Redefining Pattern Rules: Pattern Rules.)                        
                            
       Therefore, we usually write the makefile so that the first rule is the one for compiling the entire program or all the programs described by the makefile (often with a target called `all').  *Note Arguments to Specify the Goals: Goals. 

    一个规则出现在makefile中,表明何时以及如何重新建立特定的文件--此规则的目的(大多数情况下,每个规则一个文件)。它也列出作为此目的的前提条件的文件列表,还有用来创建和更改目的的片段。

    规则的顺序并不重要,除了决定缺省的终点: make 所考虑的目的。如果你不指定一个,那么make就会使用缺省的终点。

    缺省的终点就是第一个makefile中的第一个规则的目的。

    如果第一个规则有多个目的,那么只有第一个目的被认为是缺省的。

    但是有两个例外:以句号开始的目的不是缺省的,除非它还包含一个或多个 /。

    在缺省终点,定义模式规则的目的是无效的。(*Note Defining and Redefining Pattern Rules:Pattern Rules)

    因此,我们通常写makefile的时候,第一个规则是一个编译整个程序或者所有程序的。

    (此目的经常命名为 all)。*Note Arguments to Specify the Goals: Goals

    后文待续

  • 相关阅读:
    C#中抽象类和接口的区别
    人机交互复习
    信息安全复习2关于网络安全
    多读书
    致大学:我的最后几次坚持
    腾讯CMEM平台简介
    面向对象中组合和继承的关系
    软件测试笔记
    一个人的独白(两年生活的自省)
    学习之路二十四:2012年我从工作中学会了哪些?
  • 原文地址:https://www.cnblogs.com/gaojian/p/2690129.html
Copyright © 2011-2022 走看看