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

📄 linux下makefile的automake生成全攻略__科技时代_新浪网.htm

📁 autoconf automake实例gcc编译java方法.txt
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                    <TR>
                      <TD height=9></TD></TR>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width=360 
                        background=Linux下Makefile的automake生成全攻略__科技时代_新浪网.files/xfrd_02.gif 
                        border=0>
                          <TBODY>
                          <TR>
                            <TD height=45 rowSpan=2><IMG height=45 
                              src="Linux下Makefile的automake生成全攻略__科技时代_新浪网.files/xfrd_01.gif" 
                              width=70 border=0></TD>
                            <TD style="PADDING-LEFT: 5px; PADDING-TOP: 4px" 
                            width=286><!--F70BB90BB6BA--><!--nwy/uc/A-->
                              <SCRIPT language=JavaScript>


ad1= "魔镜教你穿透爱情";
link1= "http://sms.sina.com.cn/docs/c/xlmj.html";
//左上

ad2= "联想笔记本Y200热卖中";
link2= "http://noshow.adsina.allyes.com/main/adfclick?db=sina&bid=4120,19510,19538&cid=0,0,0&sid=19940&advid=56&camid=4340&show=ignore&url=http://www.lenovo2008.com/notebook/y200/?wodoopro=sinaitpiptext";
//右上

ad3= "最大的2G免费邮箱!";
link3= "http://noshow.adsina.allyes.com/main/adfclick?db=sina&bid=3633,17499,17523&cid=0,0,0&sid=17877&advid=1293&camid=3834&show=ignore&url=http://mail.sina.com.cn/freemail/index.html";
//左下

ad4= "不信你的IQ比我高!";
link4= "http://mms.sina.com.cn/mzjc/index.html";
//右下


//浏览器类型变量
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

//ie内容
function IEad(){
	adCode = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="280" HEIGHT="40" id="ad_note" ALIGN=""><PARAM NAME=movie VALUE="http://image2.sina.com.cn/dy/zwyhzh/ad_note.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=transparent> <PARAM NAME=bgcolor VALUE=#FFFFFF> <param name="swLiveConnect" value="true"> '
	+' <EMBED src="http://image2.sina.com.cn/dy/zwyhzh/ad_note.swf" quality=high wmode=transparent bgcolor=#FFFFFF  WIDTH="280" HEIGHT="40" NAME="ad_note" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" swLiveConnect="true"></EMBED></OBJECT>'

	document.write(adCode);
	
	document.getElementById('ad_note').SetVariable("ad1", ad1);
	document.getElementById('ad_note').SetVariable("ad2", ad2);
	document.getElementById('ad_note').SetVariable("ad3", ad3);
	document.getElementById('ad_note').SetVariable("ad4", ad4);
	
	document.getElementById('ad_note').SetVariable("link1", link1);
	document.getElementById('ad_note').SetVariable("link2", link2);
	document.getElementById('ad_note').SetVariable("link3", link3);
	document.getElementById('ad_note').SetVariable("link4", link4);

}
//ns内容
function NSad(){

adCode = '<table width=286 border=0 cellpadding=0 cellspacing=0>'
	+'<tr height=20><td width=143 style="padding-top:5px;padding-left:5px"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
	+'<a href='+ link1 +' class=a01 target=_blank>'+ ad1 +'</a>'
	+'</td><td width=143 style="padding-top:5px;"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
	+'<a href='+ link2 +' class=a01 target=_blank>'+ ad2 +'</a>'
	+'</td></tr>'
	+'<tr height=20><td style="padding-left:5px"> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
	+'<a href='+ link3 +' class=a01 target=_blank>'+ ad3 +'</a>'
	+'</td><td> <img src=http://image2.sina.com.cn/dy/images/xfrd_04.gif width=7 height=7> '
	+'<a href='+ link4 +' class=a01 target=_blank><SPAN ID="oSpan" UNSELECTABLE="on" >'+ ad4 +'</span></a></td></tr></table>'

document.write(adCode);
}

//主过程
if(InternetExplorer == true){
	IEad();
}else{
	NSad();
}
</SCRIPT>
                            </TD>
                            <TD width=4 rowSpan=2><IMG height=45 
                              src="Linux下Makefile的automake生成全攻略__科技时代_新浪网.files/xfrd_03.gif" 
                              width=4></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><!--NEWSZW_HZH_END-->autoconf和automake两个工具来帮助我们自动地生成符合自由软件惯例的Makefile,这样就可以象常见的GNU程序一样,只要使用“./configure”,“make”,“make 
            instal”就可以把程序安装到Linux系统中去了。这将特别适合想做开放源代码软件的程序开发人员,又或如果你只是自己写些小的Toy程序,那么这个文章对你也会有很大的帮助。<BR><BR>  <STRONG>一、Makefile介绍</STRONG><BR><BR>  Makefile是用于自动编译和链接的,一个工程有很多文件组成,每一个文件的改变都会导致工程的重新链接,但是不是所有的文件都需要重新编译,Makefile中纪录有文件的信息,在make时会决定在链接的时候需要重新编译哪些文件。<BR><BR>  Makefile的宗旨就是:让编译器知道要编译一个文件需要依赖其他的哪些文件。当那些依赖文件有了改变,编译器会自动的发现最终的生成文件已经过时,而重新编译相应的模块。<BR><BR>  Makefile的基本结构不是很复杂,但当一个程序开发人员开始写Makefile时,经常会怀疑自己写的是否符合惯例,而且自己写的Makefile经常和自己的开发环境相关联,当系统环境变量或路径发生了变化后,Makefile可能还要跟着修改。这样就造成了手工书写Makefile的诸多问题,automake恰好能很好地帮助我们解决这些问题。<BR><BR>  使用automake,程序开发人员只需要写一些简单的含有预定义宏的文件,由autoconf根据一个宏文件生成configure,由automake根据另一个宏文件生成Makefile.in,再使用configure依据Makefile.in来生成一个符合惯例的Makefile。下面我们将详细介绍Makefile的automake生成方法。<BR><BR>  <STRONG>二、使用的环境<BR></STRONG><BR>  本文所提到的程序是基于Linux发行版本:Fedora 
            Core release 
            1,它包含了我们要用到的autoconf,automake。<BR><BR>  <STRONG>三、从helloworld入手</STRONG><BR><BR>  我们从大家最常使用的例子程序helloworld开始。<BR><BR>  下面的过程如果简单地说来就是:<BR><BR>  新建三个文件:<BR><BR>   helloworld.c<BR>   configure.in<BR>   Makefile.am<BR><BR>  然后执行:<BR><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd 
            border=1>
              <TBODY>
              <TR>
                <TD>aclocal; autoconf; automake --add-missing; ./configure; 
                  make; 
            ./helloworld</TD></TR></TBODY></TABLE><BR>  就可以看到Makefile被产生出来,而且可以将helloworld.c编译通过。<BR><BR>  很简单吧,几条命令就可以做出一个符合惯例的Makefile,感觉如何呀。<BR><BR>  现在开始介绍详细的过程:<BR><BR>  1、建目录<BR><BR>  在你的工作目录下建一个helloworld目录,我们用它来存放helloworld程序及相关文件,如在/home/my/build下:<BR><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd 
            border=1>
              <TBODY>
              <TR>
                <TD>$ mkdir helloword<BR>$ cd 
            helloworld</TD></TR></TBODY></TABLE><BR>  2、 
            helloworld.c<BR><BR>  然后用你自己最喜欢的编辑器写一个hellowrold.c文件,如命令:vi 
            helloworld.c。使用下面的代码作为helloworld.c的内容。<BR><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd 
            border=1>
              <TBODY>
              <TR>
                <TD>int main(int argc, char** argv)<BR>{<BR>printf("Hello, 
                  Linux World!\n");<BR>return 
            0;<BR>}</TD></TR></TBODY></TABLE><BR>  完成后保存退出。<BR><BR>  现在在helloworld目录下就应该有一个你自己写的helloworld.c了。<BR><BR>  3、生成configure<BR><BR>  我们使用autoscan命令来帮助我们根据目录下的源代码生成一个configure.in的模板文件。<BR><BR>  命令:<BR><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd 
            border=1>
              <TBODY>
              <TR>
                <TD>$ autoscan<BR>$ ls<BR>configure.scan 
              helloworld.c</TD></TR></TBODY></TABLE><BR>  执行后在hellowrold目录下会生成一个文件:configure.scan,我们可以拿它作为configure.in的蓝本。<BR><BR>  现在将configure.scan改名为configure.in,并且编辑它,按下面的内容修改,去掉无关的语句:<BR><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd 
            border=1>
              <TBODY>
              <TR>
                <TD>============================configure.in内容开始=========================================<BR># 
                  -*- Autoconf -*-<BR># Process this file with autoconf to 
                  produce a configure 
                  script.<BR><BR>AC_INIT(helloworld.c)<BR>AM_INIT_AUTOMAKE(helloworld, 
                  1.0)<BR><BR># Checks for programs.<BR>AC_PROG_CC<BR><BR># 
                  Checks for libraries.<BR><BR># Checks for header 
                  files.<BR><BR># Checks for typedefs, structures, and compiler 
                  characteristics.<BR><BR># Checks for library 
                  functions.<BR>AC_OUTPUT(Makefile)<BR>============================configure.in内容结束=========================================</TD></TR></TBODY></TABLE><BR>  然后执行命令aclocal和autoconf,分别会产生aclocal.m4及configure两个文件:<BR><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd 
            border=1>
              <TBODY>
              <TR>
                <TD>$ aclocal <BR>$ls <BR>aclocal.m4 configure.in helloworld.c 
                  <BR>$ autoconf <BR>$ ls <BR>aclocal.m4 autom4te.cache 
                  configure configure.in helloworld.c</TD></TR></TBODY></TABLE>
            <P><BR>  大家可以看到configure.in内容是一些宏定义,这些宏经autoconf处理后会变成检查系统特性、环境变量、软件必须的参数的shell脚本。<BR><BR>  autoconf 
            是用来生成自动配置软件源代码脚本(configure)的工具。configure脚本能独立于autoconf运行,且在运行的过程中,不需要用户的干预。<BR><BR>  要生成configure文件,你必须告诉autoconf如何找到你所用的宏。方式是使用aclocal程序来生成你的aclocal.m4。<BR><BR>  aclocal根据configure.in文件的内容,自动生成aclocal.m4文件。aclocal是一个perl 
            脚本程序,它的定义是:“aclocal - create aclocal.m4 by scanning 
            configure.ac”。<BR><BR>  autoconf从configure.in这个列举编译软件时所需要各种参数的模板文件中创建configure。<BR><BR>  autoconf需要GNU 
            m4宏处理器来处理aclocal.m4,生成configure脚本。<BR><BR>  m4是一个宏处理器。将输入拷贝到输出,同时将宏展开。宏可以是内嵌的,也可以是用户定义的。除了可以展开宏,m4还有一些内建的函数,用来引用文件,执行命令,整数运算,文本操作,循环等。m4既可以作为编译器的前端,也可以单独作为一个宏处理器。<BR></P>
            <P><SPAN class=f14>
            <P align=right>&nbsp;&nbsp;[1]&nbsp;&nbsp;<A 
            href="http://tech.sina.com.cn/s/2004-10-19/1115443046.shtml">[2]</A>&nbsp;&nbsp;<A 
            href="http://tech.sina.com.cn/s/2004-10-19/1115443047.shtml">[3]</A>&nbsp;&nbsp;<A 
            style="FONT-SIZE: 14px" 
            href="http://tech.sina.com.cn/s/2004-10-19/1115443046.shtml">[下一页]</A></P>
            <TABLE width="90%" align=center border=0>
              <TBODY>
              <TR></TR></TBODY></TABLE><BR clear=all>
            <TABLE cellSpacing=0 cellPadding=0 width=565 border=0>
              <TBODY>
              <TR>
                <TD class=f14 vAlign=top height=30>  点击此处查询<A 
                  href="http://sinanews.chinasearch.com.cn/sinanews.exe?word=Linux" 
                  target=_blank>全部<FONT color=red>Linux</FONT>新闻</A> 
              </TD></TR></TBODY></TABLE></SPAN></SPAN></FONT></TD></TR></TBODY></TABLE></DIV><BR>
      <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
        <TBODY>
        <TR>
          <TD>
            <TABLE cellSpacing=0 cellPadding=0 width=565 border=0>
              <TBODY>
              <TR>
                <TD>
                  <FORM name=from_ 
                  action=http://mms.sina.com.cn/xmlmms/xmlmmsQue.php method=post 
                  target=_blank><INPUT type=hidden 
                  value=http://rss.sina.com.cn/mms/tech/6/62/94/2-1-443045.xml 
                  name=xmlCfg> <INPUT type=hidden value=100001 name=sourceFrom> 
                  <INPUT type=hidden value=442 name=from> <INPUT style="WIDTH: 120px" type=submit value=发送本新闻到手机 name=submit_> 
                  </FORM></TD>
                <TD align=right>【<A 
                  href="http://comment.news.sina.com.cn/cgi-bin/comment/comment.cgi?channel=kj&amp;newsid=443045">评论</A>】【<A 
                  href="http://forum.tech.sina.com.cn/cgi-bin/tree.cgi?gid=23&amp;fid=288">应用软件论坛</A>】【<A 
                  href="http://stat.sina.com.cn/cgi-bin/sms/edit_sms.cgi?title=Linux%CF%C2Makefile%B5%C4automake%C9%FA%B3%C9%C8%AB%B9%A5%C2%D4&amp;url=tech.sina.com.cn/s/2004-10-19/1115443045.shtml">推荐</A>】【<A 
                  href="javascript:doZoom(16)">大</A> <A 
                  href="javascript:doZoom(14)">中</A> <A 
                  href="javascript:doZoom(12)">小</A>】【<A 
                  href="javascript:doPrint()">打印</A>】【<A 
                  href="http://www.sina.com.cn/ddt/" target=_blank>下载点点通</A>】【<A 
                  href="javascript:window.close()">关闭</A>】</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>&nbsp;<BR>
      <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
        <TBODY>
        <TR>
          <TD><!-- 正文底部小通栏 -->
            <TABLE cellSpacing=0 cellPadding=0 width=585 align=center 
              border=0><TBODY>
              <TR>
                <TD><!--科技频道内页底部小通栏开始--><!--A88883414426-->
                  <OBJECT 
                  codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0 
                  height=50 width=585 
                  classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="movie" VALUE="http://ad4.sina.com.cn/200411/10/4732_jindi-tech585tl-11.swf"><PARAM NAME="quality" VALUE="high"><PARAM NAME="wmode" VALUE="opaque">
                     <EMBED 
                  src="http://ad4.sina.com.cn/200411/10/4732_jindi-tech585tl-11.swf" 
                  quality=high WIDTH="585" HEIGHT="50" 
                  TYPE="application/x-shockwave-flash" 
                  PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
                  </OBJECT><!--yuxia/2004-11-15/B--><!--科技频道内页底部小通栏结束--></TD></TR>
              <TR>
                <TD height=5></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>
      <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
        <TBODY>
        <TR>
          <TD>
            <DIV id=PublicRelation1 style="DISPLAY: none" name="PublicRelation">
            <TABLE>
              <TBODY>
              <TR>
                <TD>&nbsp;&nbsp;&nbsp;&nbsp;</TD>
                <TD class=f14>
                  <P><!--要求文字在17字以内!--><A 
                  href="http://sms.sina.com.cn/docs/c/xlmj.html" 
                  target=_blank>握住情运脉搏看魔镜指点!</A><!--nwy/sina-sms/A-->&nbsp;&nbsp;<A 
                  href="http://sms.sina.com.cn/docs/c/xlmj.html" 
                  target=_blank>魔镜教你穿透爱情的迷雾!</A><!--nwy/sina-sms/A--> 
              </P></TD></TR></TBODY></TABLE></DIV>
            <SCRIPT>	 
//<!--广告发布-->
<!--
	if (checkPubTime(getPubTime()))
	{
		PublicRelation1.style.display="";
	}
-->

⌨️ 快捷键说明

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