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

    后文待续

  • 相关阅读:
    JavaScript Array 属性 构造器 将数组值转为大写
    Eslint 配置及规则说明
    Vue基于vue-quill-editor富文本编辑器使用心得
    css display:flex 属性
    HTML5本地存储之localStorage、sessionStorage
    图片充满div
    微信小程序 Input框提交后清空
    前端简历怎么写
    响应式与自适应的区别
    JS点击子元素不触发父元素点击事件
  • 原文地址:https://www.cnblogs.com/gaojian/p/2690129.html
Copyright © 2011-2022 走看看