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

    继续翻译

       Each target specified must match the target pattern; a warning is
    issued for each target that does not.  If you have a list of files,
    only some of which will match the pattern, you can use the `filter'
    function to remove nonmatching file names (*note Functions for String
    Substitution and Analysis: Text Functions.):
    
         files = foo.elc bar.o lose.o
    
         $(filter %.o,$(files)): %.o: %.c
                 $(CC) -c $(CFLAGS) $< -o $@
         $(filter %.elc,$(files)): %.elc: %.el
                 emacs -f batch-byte-compile $<
    
    In this example the result of `$(filter %.o,$(files))' is `bar.o
    lose.o', and the first static pattern rule causes each of these object
    files to be updated by compiling the corresponding C source file.  The
    result of `$(filter %.elc,$(files))' is `foo.elc', so that file is made
    from `foo.el'.
    
       Another example shows how to use `$*' in static pattern rules: 
    
         bigoutput littleoutput : %output : text.g
                 generate text.g -$* > $@
    
    When the `generate' command is run, `$*' will expand to the stem,
    either `big' or `little'.

    每一个指定的目的必须匹配目的模式;不匹配的目的会生成一个警告。如果你有一列文件,只有一部分将要匹配模式,你可以使用 filter 函数来移出不匹配的文件名(*note Functions for String Substitution and Analysis: Text Functions.):

    files = foo.elc bar.o lose.o

    $(filter %.o,$(files)): %.o: %.c
      $(CC) -c $(CFLAGS) $< -o $@


    $(filter %.elc,$(files)): %.elc: %.el
      emacs -f batch-byte-compile $<

    在这个例子中,$(filter %.o,$(files)) 保留下来的结果是 bar.o 和 lose.o, 第一个静态模式规则使得通过编译相应的C 源文件,生成目标文件。$(filter %.elc,$(files)) 保留下来的结果是foo.elc, 因此此foo.el 文件被生成。

    另外一个例子显示了如何在静态模式规则中适用 $*:

    bigoutput littleoutput : %output : text.g
    generate text.g -$* > $@

    当 generate 命令运行的时候, $* 将会展开为枝干,或者是big 或者是 little。

    后文待续

  • 相关阅读:
    HTML浏览器标题栏如何设置
    阿里团队常用的布局——双飞翼布局
    浏览器兼容性问题——IE不支持却很实用的CSS属性Outline和Child
    css选择器:基本选择器
    编程十年
    解决WX-IOS打开公众号网页出现的底部导航条
    Angular6路由复用与延迟加载的冲突解决——看看有备无患
    Ionic2 + Angular4 + JSSDK开发中的若干问题汇总
    [Linq Expression]练习自己写绑定
    [Linq To Sql]解决join时的Collation冲突
  • 原文地址:https://www.cnblogs.com/gaojian/p/2703356.html
Copyright © 2011-2022 走看看