GNU make manual 翻译(九十一)

继续翻译

   `%' characters in a `vpath' directive's pattern can be quoted with preceding backslashes (`\').  Backslashes that would otherwise quote `%' characters can be quoted with more backslashes.  Backslashes that quote `%' characters or other backslashes are removed from the pattern before it is compared to file names.  Backslashes that are not in danger of quoting `%' characters go unmolested. 
   When a prerequisite fails to exist in the current directory, if the PATTERN in a `vpath' directive matches the name of the prerequisite file, then the DIRECTORIES in that directive are searched just like(and before) the directories in the `VPATH' variable.                        
                        
   For example,         
     vpath %.h ../headers                        
                        
tells `make' to look for any prerequisite whose name ends in `.h' in the directory `../headers' if the file is not found in the current directory. 

在一个 vpath 指令模式中的 % 符号可以被反斜线引用起来。反斜线也可以被反斜线所引用。

在进行文件名比较的时候,起到引用作用的反斜线将被从模式中移走。不起引用作用的反斜线会被忽略。

一个前提条件不在当前目录,如果 vpath 指令中的模式匹配了前提条件文件,那么此指令中的 DIRECTORIES 就会被搜索,就像在 VPATH 变量中一样。

例如,
vpath %.h ../headers
告诉 make 去在 ../headers 目录下寻找任何名字为 .h 的文件,如果此文件在当前目录中没有的话。

后文待续

原文地址:https://www.cnblogs.com/gaojian/p/2693904.html