Autoconf &Automake 自动生成 Makefile步骤
1、执行autoscan: 生成configure.scan
2、修改configure.scan 如下
AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello, 1.0) //生成的应用名&版本号
#AC_CONFIG_HEADER([config.h]) //屏蔽掉(不需要,与autoheader相关)
AC_OUTPUT(Makefile)
之后cp configure.scan configure.in(或configure.am)
3、执行aclocal: 会生成aclocal.m4
4、执行autoconf: 会生成configure
5、编写Makefile.am 文档
AUTOMAKE_OPTIONS= foreign
bin_PROGRAMS= hello
hello_SOURCES= hello.c //添加依赖文件.c .h
6、执行automake --add-missing :
Automake 会根据Makefile.am 档产生Makefile.in 文档(Makefile 输入文
件)
此处如果提示:
required file ‘./NEWS’ not found
required file ‘./README’ not found
required file ‘./AUTHORS’ not found
required file ‘./ChangeLog’ not found
则执行touch NEWS README AUTHORS ChangeLog创建相应目录
7、最后执行./configure 生成Makefile
注:以上以hello.c 为例