Chinaunix首页 | 论坛 | 博客
  • 博客访问: 51161
  • 博文数量: 11
  • 博客积分: 460
  • 博客等级: 下士
  • 技术积分: 140
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-23 18:13
文章分类

全部博文(11)

文章存档

2011年(3)

2009年(8)

分类: LINUX

2009-04-13 14:58:29

假设我们要为hello.c文件生成 Makefile
步骤:
 1. autoscan -> 生成 configure.scan等文件
    修改configure.scan
   
#               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)
#AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_INIT(hello,1.0)
AM_INIT_AUTOMAKE(hello,1.0)
AC_CONFIG_SRCDIR([hello.c])
AM_CONFIG_HEADER([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_CONFIG_FILES(Makefile)
AC_OUTPUT(Makefile)
 
2. aclocal
3. autoconf
4. autoheader
5. vi Makefile.am
 内容如下: 
  AUTOMAKE_OPTIONS=   foreign
  bin_PROGRAMS=   hello
  hello_SOURCES=  hello.c
 
6.automake --add-missing
7.  ./configure
经过上面的步骤之后,最终将生成Makefile文件
 
最后可以运行 make ,make all,make clena,make dist等命令
  
  
阅读(474) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~