📄 make-02.html
字号:
text-autospace:none;
font-size:16.0pt;
font-family:Arial;
font-weight:bold;
}
-->
</style>
</head>
<body>
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; color: #222222">
<h1 align="center" style="text-align: center">
<span class="CharChar"><a name="chapter_01"><font face="楷体_GB2312">第二章</font><span style="font-size: 16pt" lang="en-us"><b><font face="楷体_GB2312">:</font> </b></span>
<span lang="EN-US" style="font-size: 16.0pt"><b>
GNU make</b> </span><span style="font-size: 16.0pt; font-family: 楷体_GB2312">介绍</span></a></span></h1>
</span>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; text-indent: 24.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other">
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">
make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">在执行时,需要一个命名为</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">的文件。这个文件告诉</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">以何种方式编译源代码和链接程序。典型地,可执行文件可由一些</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">.o</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">文件按照一定的顺序生成或者更新。如果在你的工程中已经存在一个活着多个正确的</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">。当对工程中的若干源文件修改以后,需要根据修改来更新可执行文件或者库文件,正如前面提到的你只需要在</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">shell</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">下执行“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">”。</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">会自动根据修改情况完成源文件的对应</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">.o</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">文件的更新、库文件的更新、最终的可执行程序的更新。</span></p>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; text-indent: 24.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other">
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">
make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">通过比较对应文件(规则的目标和依赖,)的最后修改时间,来决定哪些文件需要更新、那些文件不需要更新。对需要更新的文件</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">就执行数据库中所记录的相应命令(在</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">读取</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">以后会建立一个编译过程的描述数据库。此数据库中记录了所有各个文件之间的相互关系,以及它们的关系描述)来重建它,对于不需要重建的文件</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">什么也不做。</span></p>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; text-indent: 24.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other">
<span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">
而且可以通过</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">的命令行选项来指定需要重新编译的文件。</span></p>
<div class="MsoNormal" align="center" style="text-align:center;mso-pagination:widow-orphan;
mso-layout-grid-align:auto;text-autospace:ideograph-numeric ideograph-other">
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial; color: #222222">
<hr size="1" width="100%" align="center"></span></div>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">Problems
and Bugs</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">
=================</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">If you have
problems with GNU `make' or think you've found a bug, please report it to
the developers; we cannot promise to do anything but we might well want to
fix it.</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">Before
reporting a bug, make sure you've actually found a real bug.Carefully reread
the documentation and see if it really says you can do what you're trying to
do. If it's not clear whether you should be able to do something or not,
report that too; it's a bug in the documentation!</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">Before
reporting a bug or trying to fix it yourself, try to isolate it to the
smallest possible makefile that reproduces the problem. Then send us the
makefile and the exact results `make' gave you, including any error or
warning messages. Please don't paraphrase these messages: it's best to cut
and paste them into your report. When generating this small makefile, be
sure to not use any non-free or unusual tools in your commands: you can
almost always emulate what such a tool would do with simple shell commands.
Finally, be sure to explain what you expected to occur; this will help us
decide whether the problem was really in the documentation.</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">Once you
have a precise problem you can report it in one of two ways.Either send
electronic mail to:</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial"> </span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">
bug-make@gnu.org</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial"> </span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">or use our
Web-based project management tool, at:</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial"> </span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
<span lang="EN-US" style="font-size: 10.5pt; font-family: Arial">
http://savannah.gnu.org/projects/make/</span></p>
<p class="MsoNormal" style="text-indent: 17.95pt">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -