1、用vi编辑器写一个hello.c程序
[maximus@maximus src]# vim hello.c
#include <stdio.h>
int main(void)
{
printf("Hello, Auto!\n");
return 0;
}
2、使用autoscan产生一个configure.in的原型,执行之后会产生configure.scan,可以用作configure.in的文件蓝本。
[maximus@maximus src]# autoscan
[maximus@maximus src]# ls
autoscan.log configure.scan hello.c
[maximus@maximus src]# mv configure.scan configure.in
[maximus@maximus src]# ls
autoscan.log configure.in hello.c
3、编辑configure.in
原内容:
-*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([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_OUTPUT
修改之后内容:
-*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT(hello,0.1,williamcl1984@163.com)AM_INIT_AUTOMAKE(hello,0.1)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([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_OUTPUT(Makefile)
4、执行aclocal和autoconf,分别产生aclocal.m4和configure
[maximus@maximus src]# aclocal
aclocal.m4 autom4te.cache autoscan.log configure.in hello.c
[maximus@maximus src]# autoconf
[maximus@maximus src]# ls
aclocal.m4 autom4te.cache autoscan.log configure configure.in hello.c
5、编辑Makefile.am
[maximus@maximus src]# vi Makefile.am
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.c
6、执行autoheader
[maximus@maximus src]# autoheader
[maximus@maximus src]# ls
aclocal.m4 autoscan.log configure hello.c autom4te.cache config.h.in configure.in Makefile.am
7、执行automake –a
[maximus@maximus src]$ automake -a
configure.in:6: installing `./install-sh'
configure.in:6: installing `./missing'
Makefile.am: installing `./depcomp'
[maximus@maximus src]$ ls
aclocal.m4 config.h.in depcomp Makefile.am
autom4te.cache configure hello.c Makefile.in
autoscan.log configure.in install-sh missing
8、执行./configure
[maximus@maximus src]$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
[maximus@maximus src]$ ls
aclocal.m4 config.h.in configure.in Makefile stamp-h1
autom4te.cache config.log depcomp Makefile.am
autoscan.log config.status hello.c Makefile.in
config.h configure install-sh missing
9、执行make
[maximus@maximus src]$ make
make all-am
make[1]: Entering directory `/home/maximus/source/sample/src'
gcc -DHAVE_CONFIG_H -I. -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.c
mv -f .deps/hello.Tpo .deps/hello.Po
gcc -g -O2 -o hello hello.o
make[1]: Leaving directory `/home/maximus/source/sample/src'
[maximus@maximus src]$ ls
aclocal.m4 config.h.in configure.in hello.o Makefile.in
autom4te.cache config.log depcomp install-sh missing
autoscan.log config.status hello Makefile stamp-h1
config.h configure hello.c Makefile.am
10、执行程序
[maximus@maximus src]$ ./hello
Hello,Auto!
这样一个简单的automake autoconf的过程就完成了,复杂的应用以后再学习
相关推荐
一个完整的automake,autoconf运用例子,非hello,world之类的,一个大型项目产生makefile的完整的学习用例子,包括构建库,M4宏等
automake的一个完整例子。 研究automake的例子。当然也包括autoconf。
详细的介绍autoconf,automake,生成Makefile,本文的出彩之处在于它不是以单文件的helloworld的例子,而是实战中的多文件,多目录的例子。
网上给的例子,都是针对一个文件来生成makefile. 但在实际工程中不可能只有一个文件,所以我给出一个3个文件的例子.Myfirst.cpp 主程序,Hello.h,Hello.cpp类的实现. 功能:利用现有工具,生成makefile,生成执行...
还觉得写Makefile是难事吗?autoconf-图文详解-附带详细解释 作者亲自写的例子: MyFirst.cpp Hello.h Hello.cpp configure.in Makefile.am autoconf总结.docx 手把手教你玩转 autoconf automake
文献资料 安装您可以通过以下命令安装frugalos : $ cargo install frugalos 注意:当前的安装过程需要automake , autoconf和libtool在内部构建 。 如果尚未安装它们,请安装它们。 (另请参见) 您还可以从页面...
我们就拿里面的一个具有代表性的例子编绎吧 functional_sample 在编绎之前,你必须重起你的机器,因为刚才我们修改了 autoexec.bat 而设置此时需要生效才行。(当然也有其它办法不必重起就生效,说来话长了) 好,...
是一个框架,旨在确保基于 CRIU 项目的两个 IaaS(VM、云、数据中心)之间的网络服务实例的无缝服务迁移。 米拉! 提供几个模块来保证所请求的迁移服务的成功和完整性。 它主要设计用于支持超低延迟类型的服务。 #...
sudo apt-get install autoconf libtool automake build-essential 用法 const jq = require('streamjq') const transformedStream = jq([READABLE_STREAM], [JQ_FILTER]) transformedStream.pipe(WRITABLE_STREAM...
制作(autoconf,automake) $ ./bootstrap.sh$ ./configure$ make$ make install例子Swift的$ ./npt* (format t "Hello~%")HelloNIL* ^D$命令行$ ./npt --quit --eval '(format t "Hello~%")'Hello$编译FreeBSD的$ ...