日期:2014-05-16  浏览次数:20722 次

刚学的automake,高手指教下
这是简单的helloworld的内容
#include<stdio.h>

int main(void)
{
  printf("Hello,Linux World!\n");
  return 0;
}
   

这是configure.in文件的内容
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_SRCDIR([helloworld.c])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE(helloworld,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.am的内容

AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=helloworld
helloworld_SOURCES=hellloworld.c

操作过程是这样的
[wsh@localhost helloworld]$ vi configure.in
[wsh@localhost helloworld]$ vi Makefile.IN
[wsh@localhost helloworld]$ vi Makefile.in
[wsh@localhost helloworld]$ vi Makefile.am
[wsh@localhost helloworld]$ aclocal
[wsh@localhost helloworld]$ autoconf
[wsh@localhost helloworld]$ autoheader
[wsh@localhost helloworld]$ automake -a
[wsh@localhost helloworld]$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
[wsh@localhost helloworld]$ make
cd . && /bin/sh /home/wsh/test/helloworld/missing --run autoheader
rm -f stamp-h1
touch config.h.in
cd . && /bin/sh ./config.status config.h
config.status: creating config.h
config.status: config.h is unchanged
make all-am
make[1]: Entering directory `/home/wsh/test/helloworld'
make[1]: *** 没有规则可以创建“helloworld”需要的目标“hellloworld.o”。 停止。
make[1]: Leaving directory `/home/wsh/test/helloworld'
make: *** [all] 错误 2


请高手指教下把。
   
 

------解决方案--------------------
http://www.blogjava.net/sunzhong/articles/297469.html

一步一步照着做,保证成功。