⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 make-03.html

📁 unix make 文档
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<p class="MsoBodyTextFirstIndent" style="text-indent: -21.0pt; margin-left: 39.0pt">
<b><span lang="EN-US">3.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span style="font-family: 楷体_GB2312">如果直接使用命令“</span><span lang="EN-US">make</span><span style="font-family: 楷体_GB2312">”时,得到的提示信息如下:</span></b></p>
<p class="MsoBodyTextFirstIndent" style="text-indent: 63.25pt; margin-left: 18.0pt">
<b><span lang="EN-US">make: *** No targets specified and no makefile found. Stop</span></b><span lang="EN-US">.</span></p>
<div style="mso-element:para-border-div;border:none;border-top:solid black 1.0pt;
mso-border-top-alt:solid black .5pt;padding:1.0pt 0cm 0cm 0cm">
	<p class="a">
	<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%">&nbsp;</span></div>
<h2><a name="_gnu_make_3.3"><b><span lang="EN-US" style="font-size: 14.0pt">3.3 </span></b><span style="font-size: 14.0pt; font-family: 楷体_GB2312">
包含其它</span><b><span lang="EN-US" style="font-size: 14.0pt">makefile</span></b><span style="font-size: 14.0pt; font-family: 楷体_GB2312">文件</span></a></h2>
<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">
本节我们讨论如何在一个</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">中包含其它的</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">文件。</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">中包含其它文件所需要使用的关键字是“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”,和</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">c</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">语言对头文件的包含方式一致。</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">“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”指示符告诉</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">暂停读取当前的</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">,而转去读取“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”指定的一个或者多个文件,完成以后再继续当前</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">的读取。</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">中指示符“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”书写在独立的一行,其形式如下:</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">
&nbsp;</span></p>
<p class="MsoNormal" style="text-indent: 48.2pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">include 
FILENAMES...</span></i></b></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">
&nbsp;</span></p>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; text-indent: 24.1pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other">
<b><i>
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">
FILENAMES</span></i></b><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">是</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">shell</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">所支持的文件名(可以使用通配符)。</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">指示符“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”所在的行可以一个或者多个空格(</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">程序在处理时将忽略这些空格)开始,切忌不能以</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">[Tab]</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">字符开始(如果一行以</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">[Tab]</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">字符开始</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">程序将此行作为一个命令行来处理)。指示符“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”和文件名之间、多个文件之间使用空格或者</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">[Tab]</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">键隔开。行尾的空白字符在处理时被忽略。使用指示符包含进来的</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">中,如果存在变量或者函数的引用。它们将会在包含它们的</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">中被展开(详细可参考</span><span style="font-size: 12.0pt; line-height: 150%; font-family: Arial">
<span lang="EN-US">
<a style="color: blue; text-decoration: underline; text-underline: single" href="#_第五章:Makefile中的变量">
<span lang="EN-US" style="font-family: 楷体_GB2312">第六章</span> Makefile<span lang="EN-US" style="font-family: 楷体_GB2312">中的变量</span></a></span></span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">)。</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">
来看一个例子,存在三个</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">.mk</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">文件</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">a.mk</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">、</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">b.mk</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">、</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">c.mk</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">,“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">$(bar)</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”被扩展为“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">bish 
bash</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”。则</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">
&nbsp;</span></p>
<p class="MsoNormal" style="text-indent: 48.2pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">include foo 
*.mk $(bar)</span></i></b></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">
&nbsp;</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">等价于</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">
&nbsp;</span></p>
<p class="MsoNormal" style="text-indent: 48.2pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">include foo 
a.mk b.mk c.mk bish bash</span></i></b></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">
&nbsp;</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">
之前已经提到过</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">程序在处理指示符</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">时,将暂停对当前使用指示符“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”的</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">文件的读取,而转去依此读取由“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”指示符指定的文件列表。直到完成所有这些文件以后再回过头继续读取指示符“</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">include</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">”所在的</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial">makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312">文件。</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">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -