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

📄 make-07.html

📁 unix make 文档
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>第七章 : Makefile的条件执行</title>
<style>
<!--
h1
	{margin-top:12.0pt;
	margin-right:0pt;
	margin-bottom:12.0pt;
	margin-left:21.6pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-21.6pt;
	page-break-after:avoid;
	tab-stops:list 21.6pt;
	text-autospace:none;
	font-size:16.0pt;
	font-family:Arial;
	}
 p.MsoNormal
	{mso-style-parent:"";
	margin-bottom:.0001pt;
	text-autospace:none;
	font-size:10.0pt;
	font-family:"Times New Roman";
	margin-left:0pt; margin-right:0pt; margin-top:0pt}
h2
	{margin-top:12.0pt;
	margin-right:0pt;
	margin-bottom:12.0pt;
	margin-left:28.8pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-28.8pt;
	page-break-after:avoid;
	tab-stops:list 28.8pt;
	text-autospace:none;
	font-size:12.0pt;
	font-family:Arial;
	font-weight:normal}
h3
	{margin-top:12.0pt;
	margin-right:0pt;
	margin-bottom:12.0pt;
	margin-left:36.0pt;
	text-align:justify;
	text-justify:inter-ideograph;
	text-indent:-36.0pt;
	page-break-after:avoid;
	tab-stops:list 36.0pt;
	text-autospace:none;
	font-size:12.0pt;
	font-family:Arial;
	font-weight:normal}
-->
</style>
</head>

<body>

<h1 align="center" style="text-align: center; text-indent: 0pt; margin-left: 9.9pt">
<a name="chapter_07"><span style="font-size: 18.0pt; font-family: 楷体_GB2312">
第七章:</span><span lang="EN-US" style="font-size: 18.0pt">Makefile</span><span style="font-size: 18.0pt; font-family: 楷体_GB2312">的条件执行</span></a></h1>

	<span lang="EN-US" style="font-size: 12.0pt; line-height: 150%; color: #222222">
	<hr size="1" width="100%" align="center"></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 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><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">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">中使用条件控制可以做到处理的灵活性和高效性。</span></p>
<h2><a name="_gnu_make_7.1"><span style="font-size: 14pt" lang="en-us"><b>7</b></span><b><span lang="EN-US" style="font-size: 14.0pt">.1<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;
</span></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; 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">CC</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">gcc</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">libgnu.so</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">libgnu.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">Makefile</span><span style="font-size: 12.0pt; line-height: 150%; font-family: 楷体_GB2312; color: black">中的条件判断部分如下:</span></p>
<p class="MsoNormal" style="text-indent: 13.85pt; margin-left: 29.95pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">……</span></i></b></p>
<p class="MsoNormal" style="text-indent: 13.85pt; margin-left: 29.95pt"><b><i>
<span lang="EN-US" style="font-size: 12.0pt; font-family: Arial">libs_for_gcc = 
-lgnu</span></i></b></p>

⌨️ 快捷键说明

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