Makefile自动生成(autotools工具的使用)
来源:互联网 发布:数据总线宽度 编辑:程序博客网 时间:2024/04/30 10:50
aclocal
autoscan
autoconf
autoheader
automake
---------------------------------------------------------------------------------
安装方法:
lin@lenovo:~$ sudo apt-get install autoconf
装完后,用which 命令查看
如下:
lin@lenovo:~$ which aclocal
/usr/bin/aclocal
lin@lenovo:~$ which autoscan
/usr/bin/autoscan
lin@lenovo:~$ which autoconf
/usr/bin/autoconf
lin@lenovo:~$ which auto header
lin@lenovo:~$ automake
automake: `configure.ac' or `configure.in' is required
lin@lenovo:~$ which automake
/usr/bin/automake
------------------------------------------------------------------------------
下面开始来生成一个Makefile:
建立以下代码文件:
hello.cxx hello.h
以下直接贴出我的操作过程:
weijl@weijl-virtual-machine:~/work/test$ autoscan
weijl@weijl-virtual-machine:~/work/test$ ls
autoscan.log configure.scan hello.cxx hello.h
weijl@weijl-virtual-machine:~/work/test$ mv configure.scan configure.ac
weijl@weijl-virtual-machine:~/work/test$ ls
autoscan.log configure.ac hello.cxx hello.h
weijl@weijl-virtual-machine:~/work/test$ gedit configure.ac
weijl@weijl-virtual-machine:~/work/test$ aclocal
weijl@weijl-virtual-machine:~/work/test$ ls
aclocal.m4 autoscan.log configure.ac~ hello.h
autom4te.cache configure.ac hello.cxx
weijl@weijl-virtual-machine:~/work/test$ autoconf
weijl@weijl-virtual-machine:~/work/test$ ls
aclocal.m4 autoscan.log configure.ac hello.cxx
autom4te.cache configure configure.ac~ hello.h
weijl@weijl-virtual-machine:~/work/test$ autoheader
weijl@weijl-virtual-machine:~/work/test$ ls
aclocal.m4 autoscan.log configure configure.ac~ hello.h
autom4te.cache config.h.in configure.ac hello.cxx
weijl@weijl-virtual-machine:~/work/test$ touch makefile.am
weijl@weijl-virtual-machine:~/work/test$ gedit makefile.am
weijl@weijl-virtual-machine:~/work/test$ automake -a
configure.ac:6: installing `./install-sh'
configure.ac:6: installing `./missing'
makefile.am: installing `./depcomp'
weijl@weijl-virtual-machine:~/work/test$ ls
aclocal.m4 config.h.in configure.ac~ hello.h makefile.am~
autom4te.cache configure depcomp install-sh makefile.in
autoscan.log configure.ac hello.cxx makefile.am missing
weijl@weijl-virtual-machine:~/work/test$ ./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... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
configure: creating ./config.status
config.status: creating makefile
config.status: creating config.h
config.status: executing depfiles commands
weijl@weijl-virtual-machine:~/work/test$ make hello
g++ -DHAVE_CONFIG_H -I. -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.cxx
mv -f .deps/hello.Tpo .deps/hello.Po
g++ -g -O2 -o hello hello.o
weijl@weijl-virtual-machine:~/work/test$
其中:
weijl@weijl-virtual-machine:~/work/test$ gedit configure.ac编辑configure.ac内容为
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
AC_INIT(hello,1.0)
AM_INIT_AUTOMAKE(hello,1.0)
AC_CONFIG_SRCDIR([hello.cxx])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([makefile])
AC_OUTPUT
weijl@weijl-virtual-machine:~/work/test$ gedit makefile.am编辑makefile.am的内容为:
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.cxx
最后的执行.configure我们得到了makefile文件,使用make命令就输出了可执行文件hello
- Makefile自动生成工具-----autotools的使用
- Makefile自动生成(autotools工具的使用)
- 使用autotools工具自动生成makefile文件
- Makefile自动生成工具-----autotools的使用(详细)
- Makefile自动生成工具-----autotools的使用(详细)
- Makefile自动生成工具-----autotools的使用(详细)
- Makefile自动生成工具-----autotools的使用(详细)
- linux 商业项目 makefile 自动生成工具Autotools的使用
- autotools工具自动生成Makefile
- 自动生成Makefile----autotools的使用
- autotools使用(自动生成Makefile)
- 使用autotools自动生成makefile
- autotools系列工具—-自动生成Makefile
- autotools系列工具—-自动生成Makefile
- autotools系列工具—自动生成Makefile
- ubuntu12.04使用autotools自动生成makefile
- autotools使用(自动生成makefile)
- 10.使用autotools自动生成Makefile
- 在Asp.net MVC 4.0中使用IHttpHandler
- libusb-win32学习笔记(二)
- sdf
- 在Struts 2中实现文件上传
- 重复3次的蒙特卡罗算法
- Makefile自动生成(autotools工具的使用)
- json数据处理技巧(字段带空格、增加字段)
- 10-0. 说反话 (20)
- 再看TCP/IP第一卷>关于链路层的知识细节及相关协议
- 在Android源码树中添加userspace I2C读写工具(i2c-util)
- 数据泄露防护- BadUSB 制作 模拟
- XCode快捷键
- LXC(Linux Container)
- ECMASCRIPT——Js中的数据类型、运算符、流程控制、函数作用域链、预解析、匿名函数自执行、怪异的几个地方