linux自动编译工具automake说明

1.工具简单介绍

工具名称
用途
输入
输出
 说明
autoscan
扫描目录下文件
-
configure.scan

aclocal
生成aclocal.m4
configure.scan->configure.ac
并编辑configure.ac增加部分内容

configure.ac 一般增加AM_INIT_AUTOMAKE([helloworld],1.0) 为可选
automake
根据Makefile.am生成Makefile.in
Makefile.am(手动创建)
Makefile.in
一般使用增加选项--add-missing
autoconf
生成configure
configure.ac
aclocal.m4
configure


引用张旧图:
  图中configure.in更新为configure.ac

2.编译步骤

step1.手动创建源文件:
helloworld.c
#include <stdio.h>

int main(int argc, char** argv)
{
printf("Hello, Linux World!\n");
return 0;
}

step1.autoscan
自动生成 configure.scan
结果:
autoscan.log  configure.scan  helloworld.c

autoscan.log为空文件:
configure.scan
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([helloworld.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT
step2.手动编辑configure.scan
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
#AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([helloworld.c])
#AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT

step3.执行aclocal
结果:
autom4te.cache  autoscan.log  configure.ac  helloworld.c

step4.手动创建Makefile.am
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS= helloworld
helloworld _SOURCES= helloworld.c

step5.执行automake --add-missing
aclocal.m4  autom4te.cache  autoscan.log  configure.ac  depcomp  helloworld.c  install-sh  Makefile.am  Makefile.in  missing

step6.执行autoconf:
aclocal.m4  autom4te.cache  autoscan.log  configure  configure.ac  depcomp  helloworld.c  install-sh  Makefile.am  Makefile.in  missing

step7.执行./configure
aclocal.m4      autoscan.log  config.status  configure.ac  helloworld.c  Makefile     Makefile.in
autom4te.cache  config.log    configure      depcomp       install-sh    Makefile.am  missing

step8.执行make
aclocal.m4      autoscan.log  config.status  configure.ac  helloworld    helloworld.o  Makefile     Makefile.in
autom4te.cache  config.log    configure      depcomp       helloworld.c  install-sh    Makefile.am  missing

--end--

3.参考:

  • 整体说明:
自动生成 Makefile 的全过程详解  (比较老得,只能参考,了解原理)

  • autoconf-automake说明:

  • 报错解决:

  • 详细说明,涉及各种参数
gnu automake:


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值