GNU make manual 翻译(二十三)
发布日期:2021-09-03 20:14:06
浏览次数:2
分类:技术文章
本文共 1076 字,大约阅读时间需要 3 分钟。
继续翻译
复制代码
2.5 Letting `make' Deduce the Recipes
=====================================
It is not necessary to spell out the recipes for compiling the
individual C source files, because `make' can figure them out: it has an
implicit rule for updating a `.o' file from a correspondingly named
`.c' file using a `cc -c' command. For example, it will use the recipe
`cc -c main.c -o main.o' to compile `main.c' into `main.o'. We can
therefore omit the recipes from the rules for the object files. *Note
Using Implicit Rules: Implicit Rules.
When a `.c' file is used automatically in this way, it is also
automatically added to the list of prerequisites. We can therefore omit
the `.c' files from the prerequisites, provided we omit the recipe.
复制代码
让 make 减少 片段数量
为了编译单独的 C 源文件,没有必要写出单独的片段。
因为 make 可以把他们识别出来:
这里有一个隐含的规则:需要改变一个.o文件的时候,要用 cc -c 命令来处理 .c 文件。
例如,make 将用 cc -c main.c -o main.o 来编译 main.c 为 main.o。
我们因此可以省略 这些为 目标文件而定的片段。
*Note Using Implicit Rules: Implicit Rules
后文待续
本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2012/09/13/2683516.html,如需转载请自行联系原作者
转载地址:https://blog.csdn.net/weixin_34194702/article/details/90122628 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月05日 09时58分42秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
“中文编程”知乎专栏两岁了——山雨欲来风满楼
2021-06-29
大疆机甲大师Python API之七:做个闹钟
2021-06-29
【意外走向】大疆机甲大师Python API之八:计时——为性能测试展开1000次循环
2021-06-29
”为什么有这么多人执着于中文编程?”回答两千赞留念及回应
2021-06-29
【家务】盘点小孩玩具零件缺失情况
2021-06-29
开发中文 API 的一些策略
2021-06-29
从日本编程书籍《我的第一本编程书》中译版看中文例程如何扬长避短——标识符(一)
2021-06-29
中文命名标识符如何区分类型和变量
2021-06-29
编程术语成系统中文化的意义
2021-06-29
草蟒 Python 中文 API 与 IDE 支持尝鲜
2021-06-29
一种改进中文 API 可读性的方法:参数不限于在末尾
2021-06-29
中文编程开发工具的生存模式探讨
2021-06-29
写给木兰编程语言研发团队的公开信
2021-06-29
为什么要急着为「木兰」编程语言贴上“造假”的标签?
2021-06-29
编程语言国产化的关键一战——对肆意污名化“木兰”编程语言说“不”
2021-06-29
各大媒体对「木兰」编程语言的不当言论盘点
2021-06-29
戳破针对「木兰」编程语言的拙劣谣言
2021-06-29
为「木兰」编程语言添加对中文命名标识符的支持
2021-06-29