GNU Make Manual

GNU Make

A Program for Directing Recompilation

GNU make Version 3.82

July 2010

by Richard M. Stallman, Roland McGrath, Paul D. Smith

 

This file documents the GNU make utility, which determines automatically which pieces of

a large program need to be recompiled, and issues the commands to recompile them.

This is Edition 0.71, last updated 19 July 2010, of The GNU Make Manual, for GNU make

version 3.82.
Published by the Free Software Foundation

 

官方链接地址有两个,一个是: http://www.gnu.org/software/make/manual/make.pdf

                            另外一个是: http://www.gnu.org/s/make/manual/make.pdf

共有192页,循序渐进,非常详细。

或者在google.com英文版中搜索关键词  GNU Make Manual

GUN make 中文手册 译者:徐海兵 2004-09-11 3.5.6 库文件和搜索目录 .................................................................................................... 36 3.6 Makefile伪目标.............................................................................................................. 37 3.7 强制目标(没有命令或依赖的规则) ............................................................................. 40 3.8 空目标文件..................................................................................................................... 41 3.9 Makefile的特殊目标....................................................................................................... 41 3.10 多目标............................................................................................................................ 44 3.11 多规则目标..................................................................................................................... 44 3.12 静态模式 ........................................................................................................................ 45 3.12.1 静态模式规则的语法 ....................................................................................... 45 3.12.2 静态模式和隐含规则 ....................................................................................... 47 3.13 双冒号规则..................................................................................................................... 48 3.14 自动产生依赖 ................................................................................................................. 49 第四章:规则的命令 .................................................................................................................. 51 4 规则中书写命令 ................................................................................................................... 51 4.1 命令回显 ........................................................................................................................ 51 4.2 命令的执行..................................................................................................................... 52 4.3 并发执行命令 ................................................................................................................. 53 4.4 命令执行的错误.............................................................................................................. 54 4.5 中断make的执行............................................................................................................ 56 4.6 make的递归执行............................................................................................................ 56 4.6.1 变量MAKE ............................................................................................................... 57 4.6.2 变量和递归 ............................................................................................................... 58 4.6.3 命令行选项和递归 .................................................................................................... 61 4.6.4 -w选项...................................................................................................................... 63 4.7 定义命令包..................................................................................................................... 63 4.8 空命令............................................................................................................................ 65 第五章:Makefile中的变量......................................................................................................... 65 5 使用变量 .............................................................................................................................. 65 5.1 变量的引用..................................................................................................................... 66 5.2 两种变量定义(赋值)................................................................................................... 68 5.2.1 递归展开式变量........................................................................................................ 68 5.2.2 直接展开式变量........................................................................................................ 69 5.2.3 如何定义一个空格 .................................................................................................... 70 5.2.4 “?=”操作符 ............................................................................................................. 71 5.3 变量的高级用法.............................................................................................................. 71 5.3.1 变量的替换引用........................................................................................................ 72 5.3.2 变量的套嵌引用........................................................................................................ 72 5.4 变量取值 ........................................................................................................................ 76 5.5 如何设置变量 ................................................................................................................. 76 5.6 追加变量值..................................................................................................................... 77 5.7 override 指示符 ............................................................................................................. 79 5.8 多行定义 ........................................................................................................................ 80 5.9 系统环境变量 ................................................................................................................. 81 5.10 目标指定变量 ................................................................................................................. 83 5.11 模式指定变量 ................................................................................................................. 84 第六章:Makefile的条件执行 ..................................................................................................... 85 6 Makefile的条件判断 ............................................................................................................. 85 6.1 一个例子 ........................................................................................................................ 85 6.2 条件判断的基本语法 ...................................................................................................... 86 2004年9月11日 3GUN make 中文手册 6.3 标记测试的条件语句 ...................................................................................................... 89 第七章:make的内嵌函数.......................................................................................................... 89 7 make的函数 ......................................................................................................................... 89 7.1 函数的调用语法.............................................................................................................. 90 7.2 文本处理函数 ................................................................................................................. 91 7.2.1 $(subst FROM,TO,TEXT) ....................................................................................... 91 7.2.2 $(patsubst PATTERN,REPLACEMENT,TEXT) ..................................................... 91 7.2.3 $(strip STRINT)....................................................................................................... 92 7.2.4 $(findstring FIND,IN) .............................................................................................. 92 7.2.5 $(filter PATTERN...,TEXT) ..................................................................................... 93 7.2.6 $(filter-out PATTERN...,TEXT) ............................................................................... 93 7.2.7 $(sort LIST) ............................................................................................................. 94 7.2.8 $(word N,TEXT) ...................................................................................................... 94 7.2.9 $(wordlist S,E,TEXT).............................................................................................. 94 7.2.10 $(words TEXT) .............................................................................................. 94 7.2.11 $(firstword NAMES...) .................................................................................. 95 7.3 文件名处理函数.............................................................................................................. 95 7.3.1 $(dir NAMES...) ...................................................................................................... 95 7.3.2 $(notdir NAMES...)................................................................................................. 96 7.3.3 $(suffix NAMES...) ................................................................................................. 96 7.3.4 $(basename NAMES...) ......................................................................................... 96 7.3.5 $(addsuffix SUFFIX,NAMES...) ............................................................................. 97 7.3.6 $(addprefix PREFIX,NAMES...) ............................................................................. 97 7.3.7 $(join LIST1,LIST2)................................................................................................. 98 7.3.8 $(wildcard PATTERN) ............................................................................................ 98 7.4 foreach 函数................................................................................................................. 98 7.5 if 函数 ......................................................................................................................... 100 7.6 call函数 ....................................................................................................................... 100 7.7 value函数 .................................................................................................................... 102 7.8 eval函数 ...................................................................................................................... 103 7.9 origin函数 ................................................................................................................... 104 7.10 shell函数 ..................................................................................................................... 106 7.11 make的控制函数.......................................................................................................... 106 7.11.1 $(error TEXT...) ........................................................................................... 107 7.11.2 $(warning TEXT...)...................................................................................... 107 第八章:执行make .................................................................................................................. 108 8 执行make .......................................................................................................................... 108 8.1 指定makefile文件 ........................................................................................................ 108 8.2 指定终极目标 ............................................................................................................... 109 8.3 替代命令的执行............................................................................................................ 111 8.4 防止特定文件重建 ........................................................................................................ 112 8.5 替换变量定义 ............................................................................................................... 113 8.6 使用make进行编译测试............................................................................................... 114 8.7 make的命令行选项 ...................................................................................................... 115 第九章:make的隐含规则........................................................................................................ 119 9 使用隐含规则 ..................................................................................................................... 119 9.1 隐含规则的使用............................................................................................................ 119 9.2 make的隐含规则一览 .................................................................................................. 121 9.3 隐含变量 ...................................................................................................................... 124 9.3.1 代表命令的变量...................................................................................................... 124 9.3.2 命令参数的变量...................................................................................................... 125 9.4 make隐含规则链.......................................................................................................... 126 2004年9月11日 4GUN make 中文手册 9.5 模式规则 ...................................................................................................................... 128 9.5.1 模式规则介绍 ......................................................................................................... 128 9.5.2 模式规则示例 ......................................................................................................... 129 9.5.3 自动化变量 ............................................................................................................. 130 9.5.4 模式的匹配 ............................................................................................................. 133 9.5.5 万用规则 ................................................................................................................ 133 9.5.6 重建内嵌隐含规则 .................................................................................................. 134 9.6 缺省规则 ...................................................................................................................... 135 9.7 后缀规则 ...................................................................................................................... 135 9.8 隐含规则搜索算法 ........................................................................................................ 137 第十章:使用make更新静态库文件 ......................................................................................... 138 10 更新静态库文件............................................................................................................ 138 10.1 库成员作为目标............................................................................................................ 138 ARCHIVE(MEMBER) .............................................................................................................. 138 10.2 静态库的更新 ............................................................................................................... 139 10.2.1 更新静态库的符号索引表 .............................................................................. 140 10.3 make静态库的注意事项............................................................................................... 141 10.4 静态库的后缀规则 ........................................................................................................ 141 第十一章 : GNU make的特点............................................................................................... 142 11 GNU make的一些特点 ................................................................................................. 142 11.1 源自System v的特点 ................................................................................................... 142 11.2 源自其他版本的特点 .................................................................................................... 143 11.3 GNU make自身的特点 ................................................................................................. 143 第十二章 和其它版本的兼容 .................................................................................................... 144 12 不兼容性 ...................................................................................................................... 144 第十三章 Makefile的约定 ........................................................................................................ 146 13 书写约定 ...................................................................................................................... 146 13.1 基本的约定................................................................................................................... 146 13.2 规则命令行的约定 ........................................................................................................ 147 13.3 代表命令变量 ............................................................................................................... 149 13.4 安装目录变量 ............................................................................................................... 150 13.5 Makefile的标准目标名 ................................................................................................. 154 13.6 安装命令分类 ............................................................................................................... 159 第十四章 make的常见错误信息............................................................................................... 161 14 make产生的错误信息 .......................................................................................................... 161 附录1:关键字索引................................................................................................................. 163 GNU make可识别的指示符:.............................................................................................. 163 GNU make函数: ............................................................................................................... 164 GNU make的自动化变量..................................................................................................... 165 GNU make环境变量 ............................................................................................................ 166 后序 ......................................................................................................................................... 166
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值