只显示与前一篇文章(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
其余的部分相同