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

    继续翻译

       `%' characters in pattern rules 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 or has a stem substituted into it.
    Backslashes that are not in danger of quoting `%' characters go
    unmolested.  For example, the pattern `the\%weird\\%pattern\\' has
    `the%weird\' preceding the operative `%' character, and `pattern\\'
    following it.  The final two backslashes are left alone because they
    cannot affect any `%' character.
    
       Here is an example, which compiles each of `foo.o' and `bar.o' from
    the corresponding `.c' file:
    
         objects = foo.o bar.o
    
         all: $(objects)
    
         $(objects): %.o: %.c
                 $(CC) -c $(CFLAGS) $< -o $@
    
    Here `$<' is the automatic variable that holds the name of the
    prerequisite and `$@' is the automatic variable that holds the name of
    the target; see *note Automatic Variables::.

    在模式规则中的%符号可以通过反斜线被引用。反斜线也可以通过反斜线被引用。在开始比较文件名或者由一个枝干用于替换前,引用%符号的反斜线或者引用反斜线的反斜线会被模式移出。和引用 % 符号无关的反斜线被忽略。例如,模式 'the\%weird\\%pattern\\' 在 操作性的%符号前有一个前置的 'the%weird\', 后面有一个 'pattern\\', 最后的两个反斜线就留在那里,因为它们对 %符号没有影响。 

    Here is an example, which compiles each of `foo.o' and `bar.o' from
    the corresponding `.c' file:

    这里有一个例子,从相应的.c 文件中,编译每一个 foo.o 和 bar.o 文件。

    objects = foo.o bar.o

    all: $(objects)

    $(objects): %.o: %.c
    $(CC) -c $(CFLAGS) $< -o $@

    这里,$< 是自动变量,其保存着前提条件的名字,$@是自动变量,其保留着目的的名字。

    参见 *note Automatic Variables::

    后文待续

  • 相关阅读:
    POJ 1426 Find The Multiple(数论——中国同余定理)
    POJ 2253 Frogger(Dijkstra变形——最短路径最大权值)
    POJ 3790 最短路径问题(Dijkstra变形——最短路径双重最小权值)
    POJ 3278 Catch That Cow(模板——BFS)
    HDU 1071 The area
    HDU 1213 How Many Tables(模板——并查集)
    POJ 1611 The Suspects
    light oj 1214 Large Division
    POJ 1258 Agri-Net(Prim算法求解MST)
    POJ 2387 Til the Cows Come Home(模板——Dijkstra算法)
  • 原文地址:https://www.cnblogs.com/gaojian/p/2703353.html
Copyright © 2011-2022 走看看