?? 196570.html
字號:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>[轉貼]Makefile解讀</title>
<meta name="keywords" content="[轉貼]Makefile解讀,[轉貼]Makefile解讀">
<meta name="generator" content="CipCMS! 1.0.0 with Templates 1.0.0">
<meta name="Author" content="[轉貼]Makefile解讀,[轉貼]Makefile解讀,chinaitpower">
<meta name="description" content="[轉貼]Makefile解讀,[轉貼]Makefile解讀"><link rel="stylesheet" href="196570_files/style.css"></head><body topmargin="5" bgcolor="#f4f4e8">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr>
<td width="186">中國IT動力,最新最全的IT技術教程</td>
<td valign="bottom" width="574"><table border="0" cellpadding="0" cellspacing="0" width="574">
<tbody><tr>
<td width="29"><img src="196570_files/bar_bg_l.gif" height="24" width="29"></td>
<td align="center" background="196570_files/bar_bg.gif">
<a href="http://www.chinaitpower.com/new100.asp" class="bar">最新100篇</a>
| <a href="http://www.chinaitpower.com/commend100.asp" class="bar">推薦100篇</a>
| <a href="http://www.chinaitpower.com/subject/index.asp" class="bar">專題100篇</a>
| <a href="http://www.chinaitpower.com/paihang.asp" class="bar">排行榜</a>
| <a href="http://www.chinaitpower.com/Search.asp" class="bar"><font color="green"><b>搜索</b></font></a>
| <a href="http://online.chinaitpower.com/" class="bar">在線API文檔</a>
</td>
<td width="4"><img src="196570_files/bar_bg_r.gif" height="24" width="4"></td>
</tr>
</tbody></table></td>
</tr>
</tbody></table>
<table align="center" bgcolor="#8b7e66" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr>
<td class="white" align="center" height="32" width="4"><img src="196570_files/bar_l.htm" height="32" width="4"></td>
<td class="white" align="center" width="756">
<a href="http://www.chinaitpower.com/" class="white1">首 頁</a> | <a href="http://www.chinaitpower.com/Dev/index.html" class="white1">程序開發</a> | <a href="http://www.chinaitpower.com/System/index.html" class="white1">操作系統</a> | <a href="http://www.chinaitpower.com/Soft/index.html" class="white1">軟件應用</a> | <a href="http://www.chinaitpower.com/Design/index.html" class="white1">圖形圖象</a> | <a href="http://www.chinaitpower.com/Net/index.html" class="white1">網絡應用</a> | <a href="http://www.chinaitpower.com/Good/index.html" class="white1">精文薈萃</a> | <a href="http://www.chinaitpower.com/RenZ/index.html" class="white1">教育認證</a> | <a href="http://www.chinaitpower.com/hardwarerepair/index.html" class="white1">硬件維護</a> | <a href="http://www.chinaitpower.com/Temps/index.html" class="white1">未整理篇</a> | <a href="http://www.chinaitpower.com/zhanzhang/index.html" class="white1">站長教程</a>
</td>
</tr>
</tbody></table>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr>
<td bgcolor="white" height="1"></td>
</tr>
<tr>
<td bgcolor="#8b7e66" height="4"></td>
</tr>
</tbody></table>
<table class="border2" align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr>
<td bgcolor="#f4f4e8">
<table width="100%"><tbody><tr>
<td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Web/Asp/index.html" target="_blank">ASP</a> <a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Web/JavaScripts/index.html" target="_blank">JS</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Web/PHP/Other/index.html" target="_blank">PHP</a><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Softproject/index.html" target="_blank">工程</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Web/NET/ASPNET/index.html" target="_blank">ASP.NET</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Web/site/index.html" target="_blank">網站建設</a> <a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Softproject/UML/index.html" target="_blank">UML</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/Java/index.html" target="_blank">J2EE</a><a href="http://www.chinaitpower.com/2005September/2005-09-13/Sun/index.html" target="_blank">SUN</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/Net/index.html" target="_blank">.NET</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/VC/index.html" target="_blank"><b>VC</b></a> <a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/VB/index.html" target="_blank"><b>VB</b></a> <a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/VFP/index.html" target="_blank"><b>VFP</b></a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Net/Net/index.html" target="_blank">網絡維護</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/DataBase/Databse/index.html" target="_blank">數據庫</a> <a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/DataBase/DB2/index.html" target="_blank">DB2</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/DataBase/MsSql/index.html" target="_blank">SQL2000</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/DataBase/Oracle/index.html" target="_blank">Oracle</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/DataBase/Mysql/index.html" target="_blank">Mysql</a>
</td></tr><tr>
<td><a href="http://www.chinaitpower.com/2005September/2005-09-13/System/Server/index.html" target="_blank">服務器</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/System/Win2000/index.html" target="_blank">Win2000</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Soft/Office/index.html" target="_blank">Office</a> <a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/CC/index.html" target="_blank"><b>C</b></a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Design/Web/DreamWeaver/index.html" target="_blank">DreamWeaver</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Design/Web/FireWorks/index.html" target="_blank">FireWorks</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Design/Web/Flash/index.html" target="_blank">Flash</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Design/Image/PhotoShop/index.html" target="_blank">PhotoShop</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Net/GotoNet/index.html" target="_blank"><font color="red"><b>上網寶典</b></font></a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Design/Image/CorelDraw/index.html" target="_blank">CorelDraw</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Net/xieyi/index.html" target="_blank">協議大全</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/Net/Safe/index.html" target="_blank">網絡安全</a>
</td><td><a href="http://www.chinaitpower.com/2005September/2005-09-13/RenZ/MicroSoft/index.html" target="_blank">微軟認證</a>
</td></tr><tr>
<td colspan="12"><b>硬件維護</b>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/cpu/index.html" target="_blank">CPU</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/mainboard/index.html" target="_blank">主板</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/harddisk/index.html" target="_blank">硬盤</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/memory/index.html" target="_blank">內存</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/displaycard/index.html" target="_blank">顯卡</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/display/index.html" target="_blank">顯示器</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/mousekeyboard/index.html" target="_blank">鍵盤鼠標</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/sound/index.html" target="_blank">聲卡音箱</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/print/index.html" target="_blank">打印機</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/power/index.html" target="_blank">機箱電源</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/BIOS/index.html" target="_blank">BIOS</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/hardwarerepair/netcard/index.html" target="_blank">網卡</a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/Net/CCCC/index.html" target="_blank"><font color="red"><b>C#</b></font></a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/Java/index.html" target="_blank"><font color="blue"><b>Java</b></font></a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/Delphi/index.html" target="_blank"><font color="green"><b>Delphi</b></font></a>
<a href="http://www.chinaitpower.com/2005September/2005-09-13/Dev/Programme/VS/index.html" target="_blank"><font color="green"><b>vs.net2005</b></font></a>
</td></tr></tbody></table>
</td>
</tr>
<tr>
<td bgcolor="#8b7e66" height="4"></td>
</tr>
</tbody></table>
<table class="border2" align="center" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr><td bgcolor="#ffffff" height="25"> 當前位置:> <a class="nowplace" href="http://www.chinaitpower.com/System/index.html">操作系統</a> > <a class="nowplace" href="http://www.chinaitpower.com/System/unix/index.html">Unix高級技術</a> </td></tr>
<tr><td height="10"></td></tr><tr>
<td align="center"><b>[轉貼]Makefile解讀</b>
</td>
</tr>
<tr><td bgcolor="#d6d6d6" height="1"></td></tr>
<tr><td align="center" bgcolor="#f1f1f1" height="25">
作者:<font color="#0e3e92">未知</font>
時間:<font color="#0e3e92">2005-09-13 18:55</font>
出處:<font color="#0e3e92">ChinaUnix.net</font>
責編:<font color="#0e3e92">chinaitpower</font>
</td></tr><tr><td bgcolor="#d6d6d6" height="1"></td></tr>
<tr><td bgcolor="#ffffff" height="25"> 摘要:[轉貼]Makefile解讀</td></tr>
<tr><td bgcolor="#d6d6d6" height="1"></td></tr>
</tbody></table>
<table class="border2" align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="760">
<tbody><tr><td align="center" height="25">
<table width="95%">
<tbody><tr><td colspan="9" align="center"><script language="JavaScript" src="196570_files/headad.js"></script></td></tr>
<tr><td bgcolor="#d6d6d6" height="1"></td></tr>
<tr>
<td><table align="left" border="0">
<tbody><tr>
<td>
<iframe src="196570_files/ad.htm" border="0" framespacing="0" marginheight="1" marginwidth="1" noresize="" vspace="0" frameborder="0" height="280" scrolling="no" width="336"></iframe>
</td>
</tr>
</tbody></table><br>
原文出自:http://www.linuxforum.net
<br>作者:jkl
<br>
<br>==========================================
<br>Makefile 初探
<br>==========================================
<br>Linux的內核配置文件有兩個,一個是隱含的.config文件,嵌入到主Makefile中;另一個是
include/linux/autoconf.h,嵌入到各個c源文件中,它們由make config、make
menuconfig、make xconfig這些過程創建。幾乎所有的源文件都會通過linux/config.h而嵌入
autoconf.h,如果按照通常方法建立文件依賴關系(.depend),只要更新過autoconf.h,就會造成所有源代碼的重新編繹。
<br>
<br>為了優化make過程,減少不必要的重新編繹,Linux開發了專用的mkdep工具,用它來取代gcc來生成.depend文件。mkdep在
處理源文件時,忽略linux/config.h這樣的頭文件,識別源文件宏指令中具有"CONFIG_"特征的行。例如,如果有
"#ifdef CONFIG_SMP"這樣的行,它就會在.depend文件中輸出$(wildcard
/usr/src/linux/include/config/smp.h)。
<br>
<br>include/config/下的文件是另一個工具split-include從autoconf.h中生成,它利用autoconf.h中的
CONFIG_標記,生成與mkdep相對應的文件。例如,如果autoconf.h中有"#undef CONFIG_SMP"這一行,它就
生成include/config/smp.h文件,內容為"#undef CONFIG_SMP"。這些文件名只在.depend文件中出
現,內核源文件是不會嵌入它們的。每配置一次內核,運行split-include一次。split-include會檢查舊的子文件的內容,確定是不是
要更新它們。這樣,不管autoconf.h修改日期如何,只要其配置不變,make就不會重新編繹內核。
<br>
<br>如果系統的編繹選項發生了變化,Linux也能進行增量編繹。為了做到這一點,make每編繹一個源文件時生成一個flags文件。例如編繹
sched.c時,會在相同的目錄下生成隱含的.sched.o.flags文件。它是Makefile的一個片斷,當make進入某個子目錄編繹時,會
搜索其中的flags文件,將它們嵌入到Makefile中。這些flags代碼測試當前的編繹選項與原來的是不是相同,如果相同,就將自已對應的目標文
件加入FILES_FLAGS_UP_TO_DATE列表,然后,系統從編繹對象表中刪除它們,得到FILES_FLAGS_CHANGED列表,最后,
將它們設為目標進行更新。
<br>
<br>下一步準備逐步深入的剖析Makefile代碼。
<br>
<br>==========================================
<br>Makefile解讀之二: sub-make
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -