-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.html
22 lines (22 loc) · 1.64 KB
/
Makefile.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<h1 id="makefile">Makefile</h1>
<ul>
<li><p>特殊符号 $@ 输出文件名; @^ 所有依赖; @< 第一个依赖;</p></li>
<li><p>include<br />与c语言include类似, -include不存在等错误</p></li>
<li><p>suffix rule 已经由pattern rule代替,但仍然兼容. 分为两种:single suffix rule(e.g. .c) & double suffix rule(e.g. .c.o) .c .o在默认的suffixes中,.SUFFIXES : .c .o .xo .so 指明.xo .so等suffix 举例如下: .c.o: <span class="math">(<em>C</em><em>C</em>) − <em>c</em></span>(CFLAGS) -o <span class="math">$@ $</span><</p></li>
<li><p>gmake & make gmake特指GNU implemented make, make 指系统默认make。 大多数linux中make默认是gmake, bsd中的是bsd make,其他的商业unix中使用的可能是其他make。</p></li>
<li><p>multiple rule for one target 多个prerequisite合并,多个receipt报错, 典型示例如下: objects = foo.o bar.o foo.o : defs.h bar.o : defs.h test.h $(objects) : config.h</p></li>
<li><p>antirez/redis Makefile 风格 gcc -MM *.c 动生成依赖关系; suffix rule (.c.o) 声明.o依赖的.c; bin: a.o b.o</p></li>
</ul>
<p>优点: 需要手动写的是bin生成的规则 其他的规则自动生成,简单明确</p>
</body>
</html>