C/C++ makefile自动生成工具(comake2,autotools,linux),希望能为开源做点微薄的贡献!
[jack@localhost ~]$ wget https://github.com/chuanshanjia/ccpp/blob/master/frame.sh
[jack@localhost ccpp]$ ls
frame.sh
[jack@localhost ccpp]$ pwd
/home/jack/tool/ccpp
[jack@localhost ccpp]$ sh frame.sh autotools
configure.ac:6: installing `./install-sh'
configure.ac:6: installing `./missing'
...
[jack@localhost ccpp]$ ls
aclocal.m4 autom4te.cache ChangeLog config.h.in config.status configure.ac depcomp include install-sh Makefile.am missing README stamp-h1
AUTHORS autoscan.log config.h config.log configure COPYING frame.sh INSTALL Makefile Makefile.in NEWS src
[jack@localhost ccpp]$ sh frame.sh clear
[jack@localhost ccpp]$ ls
frame.sh
[jack@localhost ccpp]$
愉快的操作吧^_^
头文件位置:
[jack@localhost ccpp]$ ls
aclocal.m4 autom4te.cache ChangeLog config.h.in config.status configure.ac depcomp include install-sh Makefile.am missing README stamp-h1
AUTHORS autoscan.log config.h config.log configure COPYING frame.sh INSTALL Makefile Makefile.in NEWS src
[jack@localhost ccpp]$ vim include/demo.h
main文件位置:
[jack@localhost ccpp]$ vim src/demo.cpp
编译运行:
[jack@localhost ccpp]$ make
make all-am
make[1]: Entering directory `/home/jack/tool/ccpp'
g++ -DHAVE_CONFIG_H -I. -I/home/jack/tool/ccpp/include -I/home/jack/tool/ccpp/src/include -g -O2 -MT demo.o -MD -MP -MF .deps/demo.Tpo -c -o demo.o `test -f 'src/demo.cpp' || echo './'`src/demo.cpp
mv -f .deps/demo.Tpo .deps/demo.Po
g++ -g -O2 -o demo demo.o
make[1]: Leaving directory `/home/jack/tool/ccpp'
[jack@localhost ccpp]$ ./demo
hello,demo
[jack@localhost ccpp]$
以下内容可作为参考学习,帮助理解工具产生的过程,如非必要,可不进行阅读。网上有很多类似内容,可以在百度搜索“autotools"就能看到整个过程。

准备Makefile.am文件
INCLUDES=-I./include -I./src/include
UTOMAKE_OPTIONS=foreign
bin_PROGRAMS=test
test_SOURCES=src/test.cpp
autoscan
当我们利用autoscan工具生成confiugre.scan文件时,我们需要将confiugre.scan重命名为confiugre.ac文件。confiugre.in调用一系列autoconf宏来测试程序需要的或用到的特性是否存在,以及这些特性的功能。
具体使用如下:
[jack@localhost tool]$ autoscan
[jack@localhost tool]$ ls
autoscan.log configure.scan include src
[jack@localhost tool]$ mv configure.scan configure.ac
[jack@localhost tool]$ ls
autoscan.log configure.in include src
[jack@localhost tool]$ vim configure.ac
修改点:

一气呵成
aclocal
autoconf
autoheader
automake --add-missing
automake --add-missing
touch NEWS README AUTHORS ChangeLog
automake --add-missing
./configure
AC_INIT
测试程序
测试函数库
测试头文件
测试类型定义
测试结构
测试编译器特性
测试库函数
测试系统调用
AC_OUTPUT
表 1Makefile.am一般格式

表 2 Makefile.am中可用的全局变量

在Makefile.am中尽量使用相对路径,系统预定义了两个基本路径:
表 3Makefile.am中可用的路径变量


C/C++ makefile自动生成工具(comake2,autotools,linux),希望能为开源做点微薄的贡献!的更多相关文章
- Makefile自动生成工具-----autotools的使用(详细)
相信每个学习Linux的人都知道Makefile,这是一个很有用的东西,但是编写它是比较复杂,今天介绍一个它的自动生成工具,autotools的使用.很多GNULinux的的软件都是用它生成Makef ...
- Asp.net mvc 5 CRUD代码自动生成工具- vs.net 2013 Saffolding功能扩展
Asp.net mvc 5 CRUD代码自动生成工具 -Visual Studio.net2013 Saffolding功能扩展 上次做过一个<Asp.net webform scaffoldi ...
- h5自动生成工具
一.前言 写了很多h5之后,对于写手写html和css已经麻木的我决定动手写个工具自动生成h5结构和样式.其实这个想法由来已久,但总是觉得自己技术不够,所以一直没实行.直到某天我真的写够了,我决定动手 ...
- 代码自动生成工具MyGeneration之一(程序员必备工具)
代码自动生成工具MyGeneration之一(程序员必备工具) 转 分类: C#2008-08-06 18:12 16064人阅读 评论(12) 收藏 举报 工具数据库相关数据库stringbrows ...
- Makefile自动生成头文件依赖
前言 Makefile自动生成头文件依赖是很常用的功能,本文的目的是想尽量详细说明其中的原理和过程. Makefile模板 首先给出一个本人在小项目中常用的Makefile模板,支持自动生成头文件依赖 ...
- Linux Makefile自动生成--config.h
Linux Makefile自动生成--config.h http://blog.csdn.net/spch2008/article/details/12510805
- springboot成神之——swagger文档自动生成工具
本文讲解如何在spring-boot中使用swagger文档自动生成工具 目录结构 说明 依赖 SwaggerConfig 开启api界面 JSR 303注释信息 Swagger核心注释 User T ...
- 基于数据库的代码自动生成工具,生成JavaBean、生成数据库文档、生成前后端代码等(v6.0.0版)
TableGo v6.0.0 版震撼发布,此次版本更新如下: 1.UI界面大改版,组件大调整,提升界面功能的可扩展性. 2.新增BeautyEye主题,界面更加清新美观,也可以通过配置切换到原生Jav ...
- C# 代码自动生成工具
开源:C# 代码自动生成工具,支持站点前后台 前言 写这个项目有很长一段时间了,期间也修修改改,写到最后,自己也没咋用(研究方向变化了). 正文 具体项目开源了:https://github.co ...
随机推荐
- 2 Unique Binary Search Trees II_Leetcode
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For e ...
- 获取 windows 商店内的 aapx 安装包 并 安装(旁加载)
这是一篇教程,写在 win10 版<量子破碎>发售近期. 主要原因:windows 商城的应用下载实在难以忍受...... #######2016-4-9更新####### 4-6号通过旁 ...
- 【Hibernate框架】关联映射(一对一关联映射)
一.整理思路: 之前,小编总结过Mybatis的关联映射,接下来,再来总结一下hibernate的相关的关联映射,直接上图: 这张图,就是小编整理总结整个Hibernate的关联映射的一个大致思路. ...
- webform简单、复合控件
简单控件: 1.Label 会被编译成span标签 属性: Text:文本内容 CssClass:CSS样式 Enlabled:是否可用 Visible:是否可见 2.Literal 空的,C#会把里 ...
- 安装Kudu
1.默认安装好yum2.需以root身份安装3.安装ntp yum install ntp -y4.启动ntp /etc/init.d/ntpd start|stop|restart5.添加安装包yu ...
- UVALive 2453 Wall (凸包)
题意:给你一个多边形的城堡(多个点),使用最短周长的城墙将这个城堡围起来并保证城墙的每个点到城堡上的每个点的距离都不小于l 题解:因为两点间的直线一定比折线短,所以这样做 先使用所有点求得一个凸包,接 ...
- Eclipse '/RemoteSystemsTempFiles'错误
错误代码 Could not write metadata for '/RemoteSystemsTempFiles'.D:\workspace4.5\.metadata\.plugins\org.e ...
- 单独编译使用WebRTC的音频处理模块
块,每块个点,(12*64=768采样)即AEC-PC仅能处理48ms的单声道16kHz延迟的数据,而 - 加载编译好的NS模块动态库 接下来只需要按照 此文 的描述在 android 的JAVA代码 ...
- Sublime Text 3 快捷键
选择类Ctrl+D 选中光标所占的文本,继续操作则会选中下一个相同的文本.Alt+F3 选中文本按下快捷键,即可一次性选择全部的相同文本进行同时编辑.举个栗子:快速选中并更改所有相同的变量名.函数名等 ...
- 一些VS2013的使用技巧
作者:h46incon的Blog 1. Peek View 可以在不新建TAB的情况下快速查看.编辑一个函数的代码. 用法:在光标移至某个函数下,按下alt+F12. 然后在Peek窗口里可以继续按a ...