Hello World Library使用autotools

Viv*_*oel 9 automake autoconf autotools

使用autotools创建bin程序非常简单我需要定义两个文件.

`Makefile.am"

bin_PROGRAMS = hello
hello_SOURCES = hello.c
Run Code Online (Sandbox Code Playgroud)

`configure.in'

AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello,1.0)
AC_PROG_CC
AC_PROG_INSTALL
AC_OUTPUT(Makefile)
Run Code Online (Sandbox Code Playgroud)

任何正文可以使用autotools 创建静态库的最小例子吗?

adl*_*adl 16

Makefile.am:

lib_LIBRARIES = libhello.a
libhello_a_SOURCES = hello.c
Run Code Online (Sandbox Code Playgroud)

configure.ac:

AC_INIT([libhello], [1.0], [bug@libhello.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_PROG_RANLIB
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
Run Code Online (Sandbox Code Playgroud)

使用Automake构建库的文档就在这里.