automake
时间:2009-06-08 来源:djstava
以hello world为例,在ubuntu 9.04下进行
//hello.c
#include <stdio.h>
int main(int argc,char *argv[argc1])
{
printf("Hello World!\n");
return 0;
}
sudo apt-get install automake
会产生如下8个命令,我们会用到automake和autoscan
autoconf autoheader automake autopoint autoscan
autodep autom4te automake-1.10 autoreconf autoupdate
1、autoscan
运行这个命令会产生autoscan.log和configure.scan这两个文件,后面会用到第2个文件
2、mv configure.scan configure.in
3、vi 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
4、修改configure.in文件,需要根据具体的项目进行修改
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT(hello, 1.0, [email protected])
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(hello,1.0)
# 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)
5、aclocal
产生aclocal.m4
6、autoconf
产生configure文件
7、touch Makefile.am,automake会根据你写的Makefile.am来自动生成Makefile.in
8、vi Makefile.am
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.c
9、automake --add-missing
需要的话可以添加NEWS、README、AUTHORS、ChangeLog等文件
10、./configure
产生Makefile
11、make
生成hello
12、./hello
Hello World!
//hello.c
#include <stdio.h>
int main(int argc,char *argv[argc1])
{
printf("Hello World!\n");
return 0;
}
sudo apt-get install automake
会产生如下8个命令,我们会用到automake和autoscan
autoconf autoheader automake autopoint autoscan
autodep autom4te automake-1.10 autoreconf autoupdate
1、autoscan
运行这个命令会产生autoscan.log和configure.scan这两个文件,后面会用到第2个文件
2、mv configure.scan configure.in
3、vi 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
4、修改configure.in文件,需要根据具体的项目进行修改
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.63])
AC_INIT(hello, 1.0, [email protected])
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(hello,1.0)
# 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)
5、aclocal
产生aclocal.m4
6、autoconf
产生configure文件
7、touch Makefile.am,automake会根据你写的Makefile.am来自动生成Makefile.in
8、vi Makefile.am
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.c
9、automake --add-missing
需要的话可以添加NEWS、README、AUTHORS、ChangeLog等文件
10、./configure
产生Makefile
11、make
生成hello
12、./hello
Hello World!
相关阅读 更多 +