LINUXQQ

三月 23, 2009

makefile

Filed under: 乱7八糟 — 标签: — admin @ 12:28 下午

    
    首先明确:Makefile 基本上就是『目标』(target), 『关连』(dependencies) 和『动作』三者所组成的一连串规则。而 make 就会根据 Makefile 的规则来决定怎么编译 (compile) 和连结 (link) 程式。

    由于编写Makefile的复杂性,创造出了autotools这个软件,他的基本原理:程式设计师只需写一些预先定义好的巨集 (macro),交给 Automake 处理後会产生一个可供 Autoconf 使用的 Makefile.in 档,再配合利用Autoconf 产生的自动设定档 configure 即可产生一份符合 GNU Makefile惯例的 Makeifle 了。
简而言之就是自己只要写好简单的Makefile.am,autoconf(自动的configure)会产生一个规范的设置文件,自己写的+自动生成的规范=Makefile文件。
   
    主要错误:利用automake生成Makefile.in时,应该使用命令:automake –add -missing,自己没有加参数,导致一直调不通,书上也没有说更有参数,幸亏在网上看到了。
     
    基本步骤:
    1.autoscan
    2.vi 编辑 configure.scan
      记得要增加: AM_INIT_AUTOMAKE(hello,1.0)
    3.用mv 改名为configure.in
    4.aclocal
    5.autoconf
    6.autoheader
    7.vi编辑 Makefile.am
    8.automake –add -missing
    9../configure
    10.make
    11../hello
    12.make install
    13.hello            

评论暂缺 »

还没有任何评论。

这篇文章上的评论的 RSS feed TrackBack URL

留下评论

要发表评论,您必须先登录

Powered by LINUXQQ   ICP 10203065