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

    继续翻译

    4.5.1 `VPATH': Search Path for All Prerequisites                        
    ------------------------------------------------                        
                            
    The value of the `make' variable `VPATH' specifies a list of directories that `make' should search.  Most often, the directories are expected to contain prerequisite files that are not in the current directory; however, `make' uses `VPATH' as a search list for both  prerequisites and targets of rules.                        
                            
       Thus, if a file that is listed as a target or prerequisite does not exist in the current directory, `make' searches the directories listed in `VPATH' for a file with that name.  If a file is found in one of them, that file may become the prerequisite (see below).  Rules may then specify the names of files in the prerequisite list as if they all existed in the current directory.  *Note Writing Recipes with Directory Search: Recipes/Search.                        
                            
       In the `VPATH' variable, directory names are separated by colons or blanks.  The order in which directories are listed is the order followed by `make' in its search.  (On MS-DOS and MS-Windows, semi-colons are used as separators of directory names in `VPATH', since the colon can be used in the pathname itself, after the drive letter.)                        
                            
       For example,                         
         VPATH = src:../headers                        
                            
    specifies a path containing two directories, `src' and `../headers', which `make' searches in that order. With this value of `VPATH', the following rule,  
                            
         foo.o : foo.c                        
                            
    is interpreted as if it were written like this:
         foo.o : src/foo.c                        
                            
    assuming the file `foo.c' does not exist in the current directory but is found in the directory `src'.                        

    4.5.1 `VPATH': 所有前提条件的搜索路径 
    ------------------------------------------------

    make 变量 VPATH 指定了一个make 可以搜索的目录列表。经常性的,这些目录被期待包含了不在当前目录下的前提条件;然后,make 使用 VPATH 来作为 规则的前提条件 和 目的的搜索列表。

    因此,如果个列为目的或者前提条件列表之一的文件如果不在当前目录中,make 会去搜索列在 VPATH 中的文件名。如果在此列表所指目录之一找到了这个文件,那么此文件就可以成为前提条件(参看下面)。

    规则可以就好像此文件存在于当前目录中一样,把此文件名作为前提条件之一。*Note Writing Recipes with Directory Search: Recipes/Search.
    在 VPATH 变量中,目录名用 冒号或者空格分隔。 列表中的目录顺序就是make 搜索的顺序。(在 MS-DOS 和 MS-Windows 系统,分隔目录名用分号,因为冒号被用作路径名本身,紧随驱动器名之后)

    例如:

    VPATH = src:../headers
    指定了一个包含两个目录的路径,src 和 ../headers,make将按照这个顺序搜索。

    根据上述VPATH 的值,下列规则,

    foo.o : foo.c

    被翻译为如下的样子:
    foo.o : src/foo.c

    (在foo.c 不在当前目录并且在 src目录下被找到的情况下。)

    后文待续

  • 相关阅读:
    poj2096(概率dp)
    bzoj4318/洛谷P1654OSU!(期望dp,立方版本)
    hdu1027(逆康托展开)
    hdu3734(数位dp,相减抵消影响)
    hdu2089(数位dp模版)
    hdu2856(倍增lca模版题)
    COI2007 Patrik 音乐会的等待 洛谷P1823
    校门外的树2 contest 树状数组练习 T4
    数星星 contest 树状数组练习 T2
    A simple problem with integer 树状数组区间查询模板题 contest 树状数组练习 T1
  • 原文地址:https://www.cnblogs.com/gaojian/p/2693761.html
Copyright © 2011-2022 走看看