您的位置:首页 > 其它

使用autotool生成多文件的Makefile

2011-01-27 14:37 471 查看
只显示与前一篇文章(automake入门之使用automake生成hello.c的Makefile)的不同

1 编辑文件a.h
#define PI 3.14

2 编辑文件a.c
#include <stdio.h>
#include "a.h"
int main(void){
printf("PI is :%f/n", PI);
return 0;
}

3与上面的命令有两处需要修改:

1 configure.in的内容如下:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(a, 1.0, aaa@126.com)
AC_CONFIG_SRCDIR([a.h])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE(a, 1.0)
# 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(Makefile)

2 Makefile.am 的内容如下:
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=a
a_SOURCES=a.c a.h

其余的部分相同
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: