[問題] 使用automake時,怎樣在Makefile.am中應用通配符?

看板LinuxDev作者 (函數人)時間16年前 (2008/11/28 19:39), 編輯推噓0(003)
留言3則, 1人參與, 最新討論串1/1
例程目錄如下: -- 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寫得通用點,一個個檔案名寫進去的話, 有些麻煩。 所以需要應用通配符。 該怎麼做呢? 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.112.22.18

11/28 21:32, , 1F
原來automake根本不支持通配符……
11/28 21:32, 1F

11/28 21:34, , 3F
dcards.html
11/28 21:34, 3F
文章代碼(AID): #19BzX-0u (LinuxDev)
文章代碼(AID): #19BzX-0u (LinuxDev)