只顯示與前一篇文章(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, [email protected])
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
其餘的部分相同