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

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

📁 autoconf automake实例gcc编译java方法.txt
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                      <TD height=9></TD></TR>
                    <TR>
                      <TD>
                        <TABLE cellSpacing=0 cellPadding=0 width=360 
                        background=Linux下Makefile的automake生成全攻略(3)__科技时代_新浪网.files/xfrd_02.gif 
                        border=0>
                          <TBODY>
                          <TR>
                            <TD height=45 rowSpan=2><IMG height=45 
                              src="Linux下Makefile的automake生成全攻略(3)__科技时代_新浪网.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生成全攻略(3)__科技时代_新浪网.files/xfrd_03.gif" 
                              width=4></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><!--NEWSZW_HZH_END-->系统配置的基本选项,里面都是一些宏定义。我们需要将它改名为configure.in<BR><BR>  3、 
            aclocal<BR><BR>  aclocal是一个perl 
            脚本程序。aclocal根据configure.in文件的内容,自动生成aclocal.m4文件。aclocal的定义是:“aclocal 
            - create aclocal.m4 by scanning configure.ac”。<BR><BR>  4、 
            autoconf<BR><BR>  autoconf是用来产生configure文件的。configure是一个脚本,它能设置源程序来适应各种不同的操作系统平台,并且根据不同的系统来产生合适的Makefile,从而可以使你的源代码能在不同的操作系统平台上被编译出来。<BR><BR>  configure.in文件的内容是一些宏,这些宏经过autoconf 
            处理后会变成检查系统特性、环境变量、软件必须的参数的shell脚本。configure.in文件中的宏的顺序并没有规定,但是你必须在所有宏的最前面和最后面分别加上AC_INIT宏和AC_OUTPUT宏。<BR><BR>  在configure.ini中:<BR><BR>  #号表示注释,这个宏后面的内容将被忽略。<BR><BR>  AC_INIT(FILE) 
            <BR><BR>  这个宏用来检查源代码所在的路径。<BR><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd 
            border=1>
              <TBODY>
              <TR>
                <TD>AM_INIT_AUTOMAKE(PACKAGE, VERSION) 
            </TD></TR></TBODY></TABLE><BR>   
            这个宏是必须的,它描述了我们将要生成的软件包的名字及其版本号:PACKAGE是软件包的名字,VERSION是版本号。当你使用make 
            dist命令时,它会给你生成一个类似helloworld-1.0.tar.gz的软件发行包,其中就有对应的软件包的名字和版本号。<BR><BR>AC_PROG_CC<BR><BR>  这个宏将检查系统所用的C编译器。 
            <BR><BR>AC_OUTPUT(FILE)<BR><BR>  这个宏是我们要输出的Makefile的名字。<BR><BR>  我们在使用automake时,实际上还需要用到其他的一些宏,但我们可以用aclocal 
            来帮我们自动产生。执行aclocal后我们会得到aclocal.m4文件。<BR><BR>  产生了configure.in和aclocal.m4 
            两个宏文件后,我们就可以使用autoconf来产生configure文件了。<BR><BR>  5、 
            Makefile.am<BR><BR>  Makefile.am是用来生成Makefile.in的,需要你手工书写。Makefile.am中定义了一些内容:<BR><BR>AUTOMAKE_OPTIONS 
            <BR><BR>  这个是automake的选项。在执行automake时,它会检查目录下是否存在标准GNU软件包中应具备的各种文件,例如AUTHORS、ChangeLog、NEWS等文件。我们将其设置成foreign时,automake会改用一般软件包的标准来检查。<BR><BR>bin_PROGRAMS<BR><BR>  这个是指定我们所要产生的可执行文件的文件名。如果你要产生多个可执行文件,那么在各个名字间用空格隔开。 
            <BR><BR>helloworld_SOURCES 
            <BR><BR>  这个是指定产生“helloworld”时所需要的源代码。如果它用到了多个源文件,那么请使用空格符号将它们隔开。比如需要helloworld.h,helloworld.c那么请写成helloworld_SOURCES= 
            helloworld.h 
            helloworld.c。<BR><BR>  如果你在bin_PROGRAMS定义了多个可执行文件,则对应每个可执行文件都要定义相对的filename_SOURCES。<BR><BR>  6、 
            automake<BR><BR>  我们使用automake 
            --add-missing来产生Makefile.in。<BR><BR>  选项--add-missing的定义是“add 
            missing standard files to 
            package”,它会让automake加入一个标准的软件包所必须的一些文件。<BR><BR>  我们用automake产生出来的Makefile.in文件是符合GNU 
            Makefile惯例的,接下来我们只要执行configure这个shell 脚本就可以产生合适的 Makefile 
            文件了。<BR><BR>  7、 Makefile<BR><BR>  在符合GNU 
            Makefiel惯例的Makefile中,包含了一些基本的预先定义的操作:<BR><BR>make<BR><BR>  根据Makefile编译源代码,连接,生成目标文件,可执行文件。<BR><BR>make 
            clean<BR><BR>  清除上次的make命令所产生的object文件(后缀为“.o”的文件)及可执行文件。<BR><BR>make 
            install<BR><BR>  将编译成功的可执行文件安装到系统目录中,一般为/usr/local/bin目录。<BR><BR>make 
            dist<BR><BR>  产生发布软件包文件(即distribution 
            package)。这个命令将会将可执行文件及相关文件打包成一个tar.gz压缩的文件用来作为发布软件的软件包。<BR><BR>  它会在当前目录下生成一个名字类似“PACKAGE-VERSION.tar.gz”的文件。PACKAGE和VERSION,是我们在configure.in中定义的AM_INIT_AUTOMAKE(PACKAGE, 
            VERSION)。<BR><BR>make 
            distcheck<BR><BR>  生成发布软件包并对其进行测试检查,以确定发布包的正确性。这个操作将自动把压缩包文件解开,然后执行configure命令,并且执行make,来确认编译不出现错误,最后提示你软件包已经准备好,可以发布了。<BR><BR>
            <TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#e6e4dd 
            border=1>
              <TBODY>
              <TR>
                <TD>===============================================<BR>helloworld-1.0.tar.gz 
                  is ready for 
                  distribution<BR>===============================================<BR>make 
                  distclean</TD></TR></TBODY></TABLE><BR>  类似make 
            clean,但同时也将configure生成的文件全部删除掉,包括Makefile。<BR><BR>  <STRONG>五、结束语</STRONG><BR><BR>  通过上面的介绍,你应该可以很容易地生成一个你自己的符合GNU惯例的Makefile文件及对应的项目文件。<BR><BR>  如果你想写出更复杂的且符合惯例的Makefile,你可以参考一些开放代码的项目中的configure.in和Makefile.am文件,比如:嵌入式数据库sqlite,单元测试cppunit。</SPAN> 

            <P></SPAN>
            <P><SPAN class=f14></SPAN> 
            <P></SPAN>
            <P align=right><A style="FONT-SIZE: 14px" 
            href="http://tech.sina.com.cn/s/2004-10-19/1115443046.shtml">[上一页]</A>&nbsp;&nbsp;<A 
            href="http://tech.sina.com.cn/s/2004-10-19/1115443045.shtml">[1]</A>&nbsp;&nbsp;<A 
            href="http://tech.sina.com.cn/s/2004-10-19/1115443046.shtml">[2]</A>&nbsp;&nbsp;[3] 

            <P></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></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/64/75/97/2-1-443047.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=443047">评论</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%283%29&amp;url=tech.sina.com.cn/s/2004-10-19/1115443047.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="";
	}
-->
</SCRIPT>
              </TD></TR></TBODY></TABLE></TD>
    <TD width=1 bgColor=#747474 rowSpan=2></TD>
    <TD vAlign=top width=129></TD></TR></TBODY></TABLE><!-- 右侧功能条 begin -->
<DIV id=toolBar style="DISPLAY: none; POSITION: absolute">
<TABLE cellSpacing=0 cellPadding=0 width=129 border=0>
  <TBODY>
  <TR>
    <TD align=right><!-- 搜索 begin-->
      <SCRIPT language=javascript>
function select_cgi(fn)

⌨️ 快捷键说明

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