使用automake生成静态库
2015-12-30 00:04
190 查看
一. 主函数Makefile创建
1. autoscan->生成 configure.scan 和 autoscan.log
2.将configure.scan 修改为 configure.in:
并修改configure.in内容如下
# Process this file with autoconf to produce a configure script.
AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello, 1.0)
# Checks for programs.
AC_PROG_CC
# Checks for library functions.
AC_OUTPUT(Makefile)
3. aclocal
->生成 aclocal.m4 和 autom4te.cache (生成aclocal.m4的过程中涉及到configure.in)
4. autoconf
->生成 configure (根据 configure.in, 和 aclocal.m4)
5. autoheader
->生成 config.h.in 宏定义
6. 编写Makefile.am
AUTOMAKE_OPTIONS=foreign
INCLUDES=-I../include
bin_PROGRAMS=hello
hello_SOURCES=hello.c
hello_LDADD=../lib/libhello.a
7. touch NEWS AUTHORS README ChangeLog
8. automake --add-missing
->生成 Makefile.in, depcomp, install-sh, 和 missing (根据 Makefile.am, 和 aclocal.m4)
9. ./configure
->生成 Makefile, config.log, 和 config.status
10. make
二. 静态库Makefile创建
1. configure.in创建
# configure.in
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(libhello.a,1.1,[])
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
AC_PROG_RANLIB//需要加入的内容,因为使用了静态库
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT([Makefile])
AC_INIT(FILE)
#Makefile.am
AUTOMAKE_OPTIONS=foreign
noinst_LIBRARIES=libhello.a
libhello_a_SOURCES=test.c
1. autoscan->生成 configure.scan 和 autoscan.log
2.将configure.scan 修改为 configure.in:
并修改configure.in内容如下
# Process this file with autoconf to produce a configure script.
AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello, 1.0)
# Checks for programs.
AC_PROG_CC
# Checks for library functions.
AC_OUTPUT(Makefile)
3. aclocal
->生成 aclocal.m4 和 autom4te.cache (生成aclocal.m4的过程中涉及到configure.in)
4. autoconf
->生成 configure (根据 configure.in, 和 aclocal.m4)
5. autoheader
->生成 config.h.in 宏定义
6. 编写Makefile.am
AUTOMAKE_OPTIONS=foreign
INCLUDES=-I../include
bin_PROGRAMS=hello
hello_SOURCES=hello.c
hello_LDADD=../lib/libhello.a
7. touch NEWS AUTHORS README ChangeLog
8. automake --add-missing
->生成 Makefile.in, depcomp, install-sh, 和 missing (根据 Makefile.am, 和 aclocal.m4)
9. ./configure
->生成 Makefile, config.log, 和 config.status
10. make
二. 静态库Makefile创建
1. configure.in创建
# configure.in
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(libhello.a,1.1,[])
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
AC_PROG_RANLIB//需要加入的内容,因为使用了静态库
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT([Makefile])
AC_INIT(FILE)
#Makefile.am
AUTOMAKE_OPTIONS=foreign
noinst_LIBRARIES=libhello.a
libhello_a_SOURCES=test.c
相关文章推荐
- JavaScript正则表达式解析URL的技巧
- 详解ASP.NET页面生命周期
- Python 功能和特点(新手必学)
- 看看下边的问题你能够回答出来多少?
- 使用PHP如何实现高效安全的ftp服务器(二)
- PHP汉字转换拼音的函数代码
- 如何写php守护进程(Daemon)
- 分享PHP守护进程类
- PHP使用strtotime获取上个月、下个月、本月的日期
- thinkPHP导出csv文件及用表格输出excel的方法
- 树链剖分
- 详解PHP中的null合并运算符
- thinkphp命名空间用法实例详解
- thinkphp多层MVC用法分析
- javascript实现禁止复制网页内容汇总
- Jsonp 关键字详解及json和jsonp的区别,ajax和jsonp的区别
- Underscore源码分析
- jQuery给元素添加样式的方法详解
- jQuery拖动元素并对元素进行重新排序
- JavaScript小技巧整理