照着例子试了一下automake

官网说得很详细了,一开始没照着做,出现的问题是:
[shidongxue@centossvr hello]$ automake
configure.ac:8: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
configure.ac:8: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.ac:8: error: required file ‘./install-sh’ not found
configure.ac:8: ‘automake –add-missing’ can install ‘install-sh’
configure.ac:8: error: required file ‘./missing’ not found
configure.ac:8: ‘automake –add-missing’ can install ‘missing’
Makefile.am: error: required file ‘./INSTALL’ not found
Makefile.am: ‘automake –add-missing’ can install ‘INSTALL’
Makefile.am: error: required file ‘./NEWS’ not found
Makefile.am: error: required file ‘./README’ not found
Makefile.am: error: required file ‘./AUTHORS’ not found
Makefile.am: error: required file ‘./ChangeLog’ not found
Makefile.am: error: required file ‘./COPYING’ not found
Makefile.am: ‘automake –add-missing’ can install ‘COPYING’
Makefile.am: error: required file ‘./depcomp’ not found
Makefile.am: ‘automake –add-missing’ can install ‘depcomp’

好,现在照着例子重新做一遍:
1、目录结构是
hello/hello.c
仅一个文件
2、运行autoscan生成一个模板configure.in
3、重命名这个模板为configure.ac
4、修改这个文件为:
cat configure.ac

-- Autoconf --

Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT(hello,1.0,billyshi@126.com)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT

一定要保证AM_INIT_AUTOMAKE([-Wall -Werror foreign])
和AC_CONFIG_FILES([
Makefile
])
添加进来,默认是没的。

5、准备一个Makefile.am
cat Makefile.am
bin_PROGRAMS=hello
hello_SOURCES=hello.c

6、OK,现在,有了这3个文件,hello.c configure.ac Makefile.am
7、autoreconf执行,带–install
[shidongxue@centossvr hello]$ autoreconf –install
configure.ac:8: installing ‘./install-sh’
configure.ac:8: installing ‘./missing’
Makefile.am: installing ‘./depcomp’

8、现在,软件包完成

9、以后就可以执行./configure和make了
./configure
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /usr/bin/mkdir -p
checking for gawk… gawk
checking whether make sets (MAKE)yescheckingwhethermakesupportsnestedvariablesyescheckingforgccgcccheckingwhethertheCcompilerworksyescheckingforCcompilerdefaultoutputfilenamea.outcheckingforsuffixofexecutablescheckingwhetherwearecrosscompilingnocheckingforsuffixofobjectfilesocheckingwhetherweareusingtheGNUCcompileryescheckingwhethergccacceptsgyescheckingforgccoptiontoacceptISOC89noneneededcheckingforstyleofincludeusedbymakeGNUcheckingdependencystyleofgccgcc3checkingthatgeneratedfilesarenewerthanconfiguredoneconfigure:creating./config.statusconfig.status:creatingMakefileconfig.status:creatingconfig.hconfig.status:executingdepfilescommands[shidongxue@centossvrhello] make
(CDPATH=”{ZSH_VERSION+.}:” && cd . && /bin/sh /home/shidongxue/work/router/hello/missing autoheader)  
rm -f stamp-h1  
touch config.h.in  
cd . && /bin/sh ./config.status config.h  
config.status: creating config.h  
config.status: config.h is unchanged  
make  all-am  
make[1]: 进入目录“/home/shidongxue/work/router/hello”  
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.c  
mv -f .deps/hello.Tpo .deps/hello.Po  
gcc  -g -O2   -o hello hello.o  
make[1]: 离开目录“/home/shidongxue/work/router/hello”  
[shidongxue@centossvr hello]
./hello
hello,world![shidongxue@centossvr hello]$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值