GUN automake,autoconf写Makefile(一)
来源:互联网 发布:淘宝商城加盟代理 编辑:程序博客网 时间:2024/05/01 07:08
摘要
网上这方面的文章不少,也有很多错误的,如何去伪存真也不容易,英文好的同学最好还是看官方的介绍,毕竟是原版专业的,最近刚好用到这个工具,写下我自己的认识,抛砖引玉希望能给大家一点参考。
首先还是从helloword一步一步来。
内容
- automake,autoconf安装
- Helloword程序
- automake生成Makefile
一.automake,autoconf 安装
http://www.gnu.org/software/automake/
hello word之旅前需要准备上面几个安装包,都可以在GUN官网上面下。
二.Helloword程序
OK,安装完,我们来写helloword,这个大家熟悉,做IT入门招式,万变不离其宗。新建hello.cpp
#include <iostream>using namespace std;int main(int argc,char *argv[]){ std::cout<<"hello automake"<<endl; return 0;}
三. automake生成Makefile
- autoscan
- 修改configure.scan,重命名configure.in
- 写Makefile.am
- 执行aclocal
- autoconf
- automake --add-missing
- ./configure --prefix=/home/app && make && make install
1. autoscan 生成configure.scan
2. 修改configure.scan
mv configure.scan configure.in
# -*- Autoconf -*-# Process this file with autoconf to produce a configure script.AC_PREREQ([2.69])AC_INIT([hello], [1.1.0], [417356935@qq.com])#AC_CONFIG_SRCDIR([hello.cpp])#AC_CONFIG_HEADERS([config.h])AM_INIT_AUTOMAKE() # Checks for programs.AC_PROG_CXX# Checks for libraries.# Checks for header files.# Checks for typedefs, structures, and compiler characteristics.# Checks for library functions.AC_OUTPUT(Makefile)~
3. 写Makefile.am文件
AUTOMAKE_OPTIONS=foreignbin_PROGRAMS= hellohello_SOURCES= hello.cpp
hello目录下面就有下面几个文件,下面就是几个命令步骤了。
4. 执行aclocal
有如下告警,不做理会,生成aclocal.m4。
<span style="font-family:SimSun;font-size:12px;">[centos@server hello]$aclocalaclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in'</span>
5. 执行autoconf生成configure
6. 运行automake --add-missing,生成Makefile.in文件
7.运行./configure --prefix=/home/app/hello, 生成Makefile
[centos@server hello]$makeg++ -DPACKAGE_NAME=\"hello\" -DPACKAGE_TARNAME=\"hello\" -DPACKAGE_VERSION=\"1.0.1\" -DPACKAGE_STRING=\"hello\ 1.0.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"hello\" -DVERSION=\"1.0.1\" -I. -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.cppmv -f .deps/hello.Tpo .deps/hello.Pog++ -g -O2 -o helloword hello.o
[centos@server hello]$./helloword hello automake
这样helloword的Makefile就写完了。这只是开始,后面动态库,静态库,工程的目录架构后续在介绍。
附件:automake流程图
0 0
- GUN automake,autoconf写Makefile(一)
- GUN automake,autoconf写Makefile(二)
- gun autoconf 和 automake 生成 Makefile
- autoconf/automake 生成 makefile
- 使用Automake,Autoconf生成Makefile
- 使用Automake,Autoconf生成Makefile
- autoconf和automake生成makefile
- 使用Automake,Autoconf生成Makefile
- Autoconf &Automake 自动生成Makefile
- Autoconf和Automake生成Makefile
- autoconf 和 automake 生成 Makefile
- [转载]使用Automake,Autoconf生成Makefile
- 例解 autoconf 和 automake 生成 Makefile 文件
- autoconf 和automake生成Makefile文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 例解 autoconf 和 automake 生成 Makefile 文件
- 短时傅立叶变换、小波变换
- 【算法练习】
- inotify -- Linux 2.6 内核中的文件系统变化通知机制
- 【日志】2014_04_01 ssh 的小结
- 浅谈REDIS数据库的键值设计
- GUN automake,autoconf写Makefile(一)
- System.in.read() IOException RuntimeException
- dmosaic资料
- 堆和栈的区别
- java 反射
- JS正则表达式获取字符串中得特定字符
- 随笔吐槽
- win7(win8)下硬盘安装redhat企业版v6双系统
- 简单的通讯薄