继续翻译

   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: %.elemacs -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.ggenerate 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。

后文待续

本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/09/26/2703356.html,如需转载请自行联系原作者

GNU make manual 翻译( 一百一十九)相关推荐

  1. GNU make manual 翻译( 一百四十九)

    继续翻译 5.7.4 The `--print-directory' Option ------------------------------------If you use several lev ...

  2. GNU make manual 翻译( 一百一十)

    继续翻译 `.SILENT' If you specify prerequisites for `.SILENT', then `make' will not print the recipe use ...

  3. GNU make manual 翻译( 一百一十四)

    继续翻译 4.10 Multiple Targets in a Rule ===============================A rule with multiple targets is ...

  4. GNU make manual 翻译( 一百五十九)

    继续翻译 A computed variable name need not consist entirely of a single variable reference. It can conta ...

  5. GNU make manual 翻译( 一百一十三)

    继续翻译 `.ONESHELL' If `.ONESHELL' is mentioned as a target, then when a target is built all lines of t ...

  6. GNU make manual 翻译( 一百五十五)

    继续翻译 6.2 The Two Flavors of Variables ================================There are two ways that a vari ...

  7. GNU make manual 翻译( 一百二十四)

    继续翻译 Note that such a prerequisite constitutes mentioning `main.o' in a makefile, so it can never be ...

  8. GNU make manual 翻译( 一百五十四)

    继续翻译 6.1 Basics of Variable References =================================To substitute a variable's v ...

  9. GNU make manual 翻译( 一百七十五)

    继续翻译 `.DEFAULT_GOAL' Sets the default goal to be used if no targets were specified onthe command lin ...

最新文章

  1. Android app动态加载
  2. [ -~] 所有的可打印字符
  3. 中国风力发电设备市场需求容量与投资战略研究报告2022版
  4. 三星S5 电信版(G9009D)Android 5.0系统,root教程【亲测可行】
  5. Linux设备驱动开发-linux驱动中的阻塞访问方式
  6. Calendar Game POJ - 1082(关于日历的博弈问题)
  7. oom 如何避免 高并发_【高并发】高并发环境下如何防止Tomcat内存溢出?看完我懂了!!...
  8. python实例31[自动挂载虚拟盘]
  9. linux 查看所有存在的线程
  10. html5页面关闭的回调函数,js回调函数例子 js 回调函数问题的执行结果想作为返回值...
  11. 学计算机为什么伤眼,电脑族用眼过度最伤眼!专家教你如何缓解视疲劳
  12. dedecms使用AB模板后台如何静态化tag标签
  13. sim卡中电话本(ADN)的简要格式
  14. python 编码gbk_python 处理中文文件时的编码问题,尤其是utf-8和gbk
  15. 胡说八道设计模式—观察者模式
  16. usb网卡转接口被识别为光盘
  17. HTML标签及效果大全
  18. 【zephyr】 设备驱动和设备模型_apds9660 接近(Proximity)传感器(二)
  19. Linux内核机制总结内存管理之内存耗尽杀手(二十四)
  20. cmd远程打开服务器,CMD下开启远程桌面服务

热门文章

  1. 中端存储趋势:x86、SSD缓存和虚拟化
  2. 读书笔记--MapReduce 适用场景 及 常见应用
  3. LNMP和LAMP的编译安装
  4. 注册表收藏夹任你玩(4招)
  5. 2010年5月21日 下雨了
  6. 用li列表模拟table式的表
  7. HTML4.01复习笔记一
  8. 怎么修改Outlook2010 PST数据文件位置(默认邮件存储目录)
  9. 检索数据表中重复的记录
  10. MPLS学习一些问题(一)