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

📄 make-13.html

📁 unix make 文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<a style="color: blue; text-decoration: underline; text-underline: single" href="make-04.html#_gnu_make_4.5">
4.5 <span lang="EN-US" style="font-family: 楷体_GB2312">目录搜索</span></a> </span>
</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">GNU 
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: -21.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 21.0pt">
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Wingdings">
&Oslash;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></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">Unix</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">$*</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">”(参考</span><span style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">
<span lang="EN-US">
<a style="color: blue; text-decoration: underline; text-underline: single" href="make-10.html#_gnu_make_10.5.3">
10.5.3<span lang="EN-US" style="font-family: 楷体_GB2312"> 自动化变量</span></a> </span>
</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">GNU 
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">$*</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">”的含义完全不同。</span><span style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">
</span>
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Wingdings; color: black">
&Oslash;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span>
</p>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; text-indent: -21.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 21.0pt">
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Wingdings; color: black">
&Oslash;<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></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">Unix</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 style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">
</span></p>
<p class="MsoNormal" style="margin-left:58.2pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">foo.o:</span></i></b></p>
<p class="MsoNormal" style="margin-left:58.2pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cc -c 
foo.c</span></i></b></p>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 42.0pt">
<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">foo.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">foo.c</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; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 42.0pt">
<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">GNU 
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: -21.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 21.0pt">
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Wingdings; color: black">
&Oslash;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial; color: black">
GNU make</span><span style="font-size: 12.0pt; font-family: 楷体_GB2312; color: black">不包含任何编译以及预处理</span><span lang="EN-US" style="font-size: 12.0pt; font-family: Arial; color: black">EFL</span><span style="font-size: 12.0pt; font-family: 楷体_GB2312; color: black">程序的内嵌隐含规则。如果其它那种版本的</span><span lang="EN-US" style="font-size: 12.0pt; font-family: Arial; color: black">make</span><span style="font-size: 12.0pt; font-family: 楷体_GB2312; color: black">已经实现了这个特性,我们会很乐意地把它加入到</span><span lang="EN-US" style="font-size: 12.0pt; font-family: Arial; color: black">GNU 
make</span><span style="font-size: 12.0pt; font-family: 楷体_GB2312; color: black">支持的特性中。</span><span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Wingdings; color: black">&Oslash;<span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span></p>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; text-indent: -21.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 21.0pt">
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Wingdings; color: black">
&Oslash;<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></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"> 
SVR4</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="margin-left:58.2pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">.c.a:</span></i></b></p>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 42.0pt">
<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">.c.a</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; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 42.0pt">
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Arial; color: black">
GNU 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">.a</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">.c</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">GNU 
make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">中的实现是:</span></p>
<p class="MsoNormal" style="margin-left:58.2pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">.c.a: ;</span></i></b></p>
<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; text-indent: -21.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other; margin-left: 21.0pt">
<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; font-family: Wingdings; color: black">
&Oslash;<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></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">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">-e</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 
-k</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">0</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">GNU 
make</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">的没有支持这种方式。</span></p>
	<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; color: #222222">
	<hr size="1" width="100%" align="center">

	<span style="font-size: 12.0pt; font-family: Arial; ">
	<p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; text-indent: 24.0pt; line-height: 150%; text-autospace: ideograph-numeric ideograph-other">
	<font face="楷体_GB2312" size="4"><a href="make-14.html">下一章</a>
	<a href="make-12.html">上一章</a> <a href="index.html#content">目录</a></font></p>
	</span>
</body>

</html>

⌨️ 快捷键说明

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