`
chinese.darren
  • 浏览: 98618 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Configure, Makefile.am, Makefile.in, Makefile

阅读更多
automake使用过程如下:

1.建目录
        在工作目录下建一个hello目录,用它来存放hello程序及相关文件。
2.编写程序
        利用gedit编写C程序:实现万年历功能的Hello.h和Hello.c程序及主程序Main.c。
3.生成configure
        执行autoscan命令生成一个名为configure.scan的文件,我们拿它作为configure.in的蓝本。将configure.scan改名为configure.in,然后打开configure.in,将文件修改为一下内容:
#               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
AC_INIT(Main, 1.0, BUG-REPORT-ADDRESS)
AM_INIT_AUTOMAKE(Main, 1.0)
AC_CONFIG_SRCDIR([Hello.h])
AM_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_FUNC_MALLOC
AC_OUTPUT(Makefile)
        然后先执行aclocal命令,生成aclocal.m4文件,再执行autoconf命令,生成configure文件。
4.执行autoheader命令
        执行autoheader命令,生成config.h.in。这一步非常重要,网上很多的automake生成Makefile方法中都没有包含这一步,然而,缺少这一步将会出错。
5.编写Makefile.am
        新建Makefile.am文件,写入如下内容:
        AUTOMAKE_OPTIONS = foreign
        bin_PROGRAMS = Main
        Main_SOURCES = Main.c Hello.c       
6.运行automake
        使用命令"automake --add-missing" automake会根据Makefile.am产生一些文件,包括最重要的Makefile.in文件。
         7. 执行configure生成Makefile
         执行/.configure命令,即可生成Makefile。
         8.生成可执行文件
         在终端上输入:make,即可生成可执行程序Main。
         9.运行Main
         输入./Main,运行Main程序。
分享到:
评论

相关推荐

    configure.和Makefile.之间的关系

    configure.和Makefile.之间的关系

    使用 Automake,Autoconf生成 Makefile

    最全的Automake Autoconf生成Makefile资料。 解析Configure,Makefile.am, Makefile.in, Makefile文件之间关系。

    notify-simple.tar

    解压方式:tar -xvf notify-simple.tar Makefile.am文件的编写 configure.ac文件的编写 Makefile.am与Makefile.in、configure.ac文件的关系 autotools实例讲解 libnotify.so库实例应用

    Twitter API Client(gridtwit) oauth demo C++源代码

    Makefile.am ---- Modified, please cover the original file Makefile.in ---- Modified, please cover the original file oauthbodyhash.c oauthdatapost.c oauthexample.c oauthsign.c oauthtest.c ...

    关于configure配置开源makefile得详细介绍

    详细介绍了configure得各个选项得意思,和使用得方法。同时在config.log里面可以详细看到configure得错误,做对应得修改

    automake-1.14.tar.gz

    Automake是从Makefile.am(定义一系列make变量的文件)自动生成Makefile.in文件的工具。生成的Makefile.in符合GNU Makefile 标准。 因为不同的平台需要修改Makefile,所以编写configure脚本自动修改Makefile,再执行./...

    top2.tar.gz

    Makefile.am Makefile.in missing sched_policy.c sched_policy.h top.c #./top -h Usage: ./top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ] -m num Maximum number of ...

    top3.tar.gz

    Makefile.am Makefile.in missing sched_policy.c sched_policy.h top.c #./top -h Usage: ./top [ -m max_procs ] [ -n iterations ] [ -d delay ] [ -s sort_column ] [ -t ] [ -h ] -m num Maximum number of ...

    ecos-3.0.i386linux.tar.bz2

    实时操作系统ecos的源码包。...acinclude.m4 buildid.txt configure.in examples packages tools aclocal.m4 ChangeLog COPYING Makefile.am README.host acsupport configure doc Makefile.in README.txt

    arm linux mp3 player

    .........\.................\......\makefile.am .........\.................\......\makefile.in .........\.................\parse.c .........\.................\parse.h .........\.................\...

    利用autoconf,automake生成makefile全攻略

    网上给的例子,都是针对一个文件来生成makefile. 但在实际工程中不可能只有一个文件,所以我给出一个3个文件的例子.Myfirst.cpp 主程序,Hello.h,Hello.cpp类的实现. 功能:利用现有工具,生成makefile,生成执行...

    autoconf-图文详解-附带详细解释

    还觉得写Makefile是难事吗?autoconf-图文详解-附带详细解释 作者亲自写的例子: MyFirst.cpp Hello.h Hello.cpp configure.in Makefile.am autoconf总结.docx 手把手教你玩转 autoconf automake

    libX11源码

    libx11纯源码;根据configure.ac 和makefile.am 生成configure和makefile,文件为源码,未做处理;

    libX11-1.8.tar.gz

    libX11的源码,支持交叉编译,支持嵌入式平台上使用;根据configure.ac 和makefile.am 生成configure和makefile,文件为库源码未做任何改动;

    cryptopp-autotools:用于Crypto ++项目的Autotools文件

    它提供configure.ac , makefile.am和libcryptopp.pc.in 。 官方上不支持自动工具,因此使用此工具的风险自负。 Crypto ++ Autotools的目的有三方面: 更好地支持Linux发行版,例如Debain,Fedora和openSUSE 通过对...

    easy-rsa-old-master.zip

    │ ├── Makefile.am │ └── rpm │ ├── easy-rsa.spec.in │ └── Makefile.am ├── doc │ ├── Makefile.am │ ├── README-1.0 │ └── README-2.0 ├── easy-rsa │ ├── 1.0 │...

    vasp.5.4.4&beef-src.tar.xz

    makefile.include需要稍作修改(CPP_OPTIONS里添加-Dlibbeeef,LLIBS里添加-Lpathtolibbeef -lbeef) CPP_OPTIONS= -DMPI -DHOST=\"IFC91_ompi\" -DIFC \ -DCACHE_SIZE=4000 -DPGF90 -Davoidalloc \ -DMPI_...

    跟我一起学写makefile

    Makefile 在 Unix 上写程式的人大概都碰过 Makefile,... 後会产生一个可供 Autoconf 使用的 Makefile.in 档。再配合利用 Autoconf 产生的自动设定档 configure 即可产生一份符合 GNU Makefile 惯例的 Makeifle 了。

    IMBE解码库

    ............\configure ............\COPYRIGHT ............\ecc.c ............\ecc_const.h ............\imbe7100x4400.c ............\imbe7200x4400.c ............\imbe7200x4400_const.h ............

    Qt5.0.2_WinXP_SP3_modified_files.zip

    I didn't find enough ... I therefore had to manually delete Makefile, Makefile.Debug and Makefile.Release (didn't touch Makefiles in the thirdparty folder though). Hope this helps. Comments are welcome.

Global site tag (gtag.js) - Google Analytics