使用automake时,怎样在Makefile.am中应用通配符?

编译打包和其他
回复
func
帖子: 74
注册时间: 2007-09-13 22:47

使用automake时,怎样在Makefile.am中应用通配符?

#1

帖子 func » 2008-11-28 17:51

帖子没有怎么编辑,影响阅读的话,请看http://bbs.chinaunix.net/thread-1322242-1-1.html

例子工程目录如下:
-- test
|-- include
| `-- func.h
`-- src
|-- func.c
`-- main.c


各文件如下:
// test/include/func.h

#ifndef FUNC_H
#define FUNC_H
void print();
#endif


// test/src/func.c

#include "../include/func.h"
#include <stdio.h>
void print() {
printf("Hi!\n");
}


// test/src/main.c

#include "../include/func.h"
int main() {
print();
return 0;
}


这是configure.in:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(test, 1.0, test@test.com)
AC_CONFIG_SRCDIR([include/func.h])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE(test, 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)


这是我写的Makefile.am:
AUTOMAKE_OPTIONS = foreign

bin_PROGRAMS = test
test_SOURCES = $(shell ls include/*.h) $(shell ls src/*.c)


“automake -a”和“./configure”时都没问题,但是make时报错。看了一下,大概是o文件没生成造成的:
make all-am
make[1]: 正在进入目录 `/home/func/test'
gcc -g -O2 -o test
gcc: 没有输入文件
make[1]: *** [test] 错误 1
make[1]:正在离开目录 `/home/func/test'
make: *** [all] 错误 2


请问怎样才能写出没问题的支持通配符的Makefile.am?
实际项目中,目录结构与例子类似但更复杂,我不想在底层目录中再布置Makefile.am,希望一个Makefile.am就搞定整个工程。
而且由于文件众多,如果不把Makefile.am写得通用点,一个个文件写进去的话,有些麻烦。所以需要应用通配符。

该怎么做呢?

谢谢!
jklm177
帖子: 5
注册时间: 2008-11-21 16:27
联系:

Dunk SB

#2

帖子 jklm177 » 2008-11-28 19:11

china wholesale Nike Dunk SB Air Dunk,cheap Dunk SB shoes,Dunk High tops,dunks sb,nike sb,Nike Air Dunk.Air Dunk Low Mid High Nike shoes wholesale,dunks sb,nike sb,dunk sb
func
帖子: 74
注册时间: 2007-09-13 22:47

Re: 使用automake时,怎样在Makefile.am中应用通配符?

#3

帖子 func » 2008-11-28 23:45

Automake不支持通配符……
http://www.gnu.org/software/automake/ma ... cards.html

不过没关系,写个脚本生成Makefile.am好了
回复