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

    继续翻译

       A phony target should not be a prerequisite of a real target file;if it is, its recipe will be run every time `make' goes to update that file.  As long as a phony target is never a prerequisite of a real target, the phony target recipe will be executed only when the phony target is a specified goal (*note Arguments to Specify the Goals:
    Goals.).
    
       Phony targets can have prerequisites.  When one directory contains multiple programs, it is most convenient to describe all of the programs in one makefile `./Makefile'.  Since the target remade bydefault will be the first one in the makefile, it is common to make this a phony target named `all' and give it, as prerequisites, all the individual programs.  For example:
    
         all : prog1 prog2 prog3
         .PHONY : all
    
         prog1 : prog1.o utils.o
                 cc -o prog1 prog1.o utils.o
    
         prog2 : prog2.o
                 cc -o prog2 prog2.o
    
         prog3 : prog3.o sort.o utils.o
                 cc -o prog3 prog3.o sort.o utils.o

    一个伪目的不应当是一个真的目的的前提条件;如果是,它的片段将会在每次运行make 时被执行。正因为伪目的永远不会是一个真正的目的,所以伪目的的片段才能在仅当其为特殊终点时才获得运行。(*note Arguments to Specify the Goals:Goals)

    伪目的自身可以有前提条件。当一个目录包含多个程序,把所有的程序均包含到一个 ./Makefile中是最为方便的。因为缺省的目的重建会针对第一个目的,把此目的命名为伪目的 all ,让它拥有所有其他单独的程序作为前提条件。例如:

    all : prog1 prog2 prog3
    .PHONY : all

    prog1 : prog1.o utils.o
    cc -o prog1 prog1.o utils.o

    prog2 : prog2.o
    cc -o prog2 prog2.o

    prog3 : prog3.o sort.o utils.o
    cc -o prog3 prog3.o sort.o utils.o

     后文待续

  • 相关阅读:
    jquery的get方式发送AJAX请求
    原生JS发送AJAX请求
    正则表达式(二)
    正则表达式(一)
    旅游攻略-北京三日游攻略(已实践)
    边旅游边赚钱的噱头,这是一种传销!
    hdu 1106 排序(水题)
    hdu 1258 Sum It Up(dfs+去重)
    hdu 1455 Sticks(dfs+剪枝)
    解决“LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏”问题
  • 原文地址:https://www.cnblogs.com/gaojian/p/2695203.html
Copyright © 2011-2022 走看看