博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
照着例子试了一下automake
阅读量:4116 次
发布时间:2019-05-25

本文共 3341 字,大约阅读时间需要 11 分钟。

官网说得很详细了,一开始没照着做,出现的问题是:

[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:
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]$

转载地址:http://loypi.baihongyu.com/

你可能感兴趣的文章
25个构建Web项目的HTML建议,你需要了解一下!
查看>>
【web素材】02-10款大气的购物商城网站模板
查看>>
6种方式实现JavaScript数组扁平化(flat)方法的总结
查看>>
如何实现a===1 && a===2 && a===3返回true?
查看>>
49个在工作中常用且容易遗忘的CSS样式清单整理
查看>>
20种在学习编程的同时也可以在线赚钱的方法
查看>>
隐藏搜索框:CSS 动画正反向序列
查看>>
12 个JavaScript 特性技巧你可能从未使用过
查看>>
127个超级实用的JavaScript 代码片段,你千万要收藏好(上)
查看>>
【视频教程】Javascript ES6 教程27—ES6 构建一个Promise
查看>>
【5分钟代码练习】01—导航栏鼠标悬停效果的实现
查看>>
127个超级实用的JavaScript 代码片段,你千万要收藏好(中)
查看>>
8种ES6中扩展运算符的用法
查看>>
【视频教程】Javascript ES6 教程28—ES6 Promise 实例应用
查看>>
127个超级实用的JavaScript 代码片段,你千万要收藏好(下)
查看>>
【web素材】03-24款后台管理系统网站模板
查看>>
【5分钟代码练习】02—用CSS Grid实现响应式图片布局的效果
查看>>
Flex 布局教程:语法篇
查看>>
【AngularJS教程】快速入门篇之 双向绑定
查看>>
2019年哪些外快收入可达到2万以上?
查看>>