1.新建项目autocpp,目录结构如下:
2.$aclocal
生成了aclocal.m4 autom4te.cache
3.libtoolize --copy --force
结果:
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
4.运行autoconf
结果:生成configure文件
5.运行autoheader
结果:生成config.h.in文件
6:automake --add-missing --copy
结果:
[shengjl25@/home/shengjl25/testautomake/autocpp]$automake --add-missing --copy
configure.ac:14: installing `./config.guess'
configure.ac:14: installing `./config.sub'
configure.ac:6: installing `./install-sh'
configure.ac:6: installing `./missing'
src/bar/Makefile.am: installing `./depcomp'
Makefile.am: installing `./INSTALL'
Makefile.am: required file `./NEWS' not found
Makefile.am: required file `./README' not found
Makefile.am: required file `./AUTHORS' not found
Makefile.am: required file `./ChangeLog' not found
Makefile.am: installing `./COPYING' using GNU General Public License v3 file
Makefile.am: Consider adding the COPYING file to the version control system
Makefile.am: for your code, to avoid questions about which license your project uses.
创建not found的四个文件再重新运行automake --add-missing
生成Makefile.in文件
7.configure --prefix=$HOME
结果:生成Makefile文件
8.运行make all 生成hello文件
运行./src/main/hello
输出结果:
main +
foo +-
bar +-
main -