在automake中使用通配符
Using wildcards in automake
我有以下makefile.am:
AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = prog
DEFS =
CFLAGS =
prog_SOURCES := $(wildcard src/GUI_dialogs.cpp) src/GUI_main_win.cpp
$(info **$(prog_SOURCES)**)
如果我生成生成生成文件(autoreconf && ./configure
),然后运行make
我得到以下输出:
**src/GUI_dialogs.cpp src/GUI_main_win.cpp**
g++ -I. -g -O2 -MT GUI_main_win.o -MD -MP -MF .deps/GUI_main_win.Tpo -c -o GUI_main_win.o `test -f 'src/GUI_main_win.cpp' || echo './'`src/GUI_main_win.cpp
src/GUI_main_win.cpp:1:24: fatal error: ...Header not found as expected...
第一行显示prog_SOURCES
变量设置正确,但它没有首先编译GUI_dialogs对象。
如果我将prog_SOURCES更改为:
prog_SOURCES := src/GUI_dialogs.cpp src/GUI_main_win.cpp
然后,GUI_dialogs对象按照预期首先编译。
我知道订单可能没有定义。但如果我只有通配符:
prog_SOURCES := $(wildcard src/GUI_dialogs.cpp)
然后我得到:
**src/GUI_dialogs.cpp**
gcc -o prog
gcc: fatal error: no input files
compilation terminated.
为什么它只是跳过通配符文件?即使它清楚地在变量中?
遇到了类似的问题,从文档来看,这不是一个好主意。
https://www.gnu.org/software/automake/manual/html_node/Wildcards.html
"即使你不关心可移植性,并且因为你只针对GNU Make而很想使用'$(通配符…)',你也应该知道Automake在很多地方需要确切地知道应该处理哪些文件。由于Automake不知道如何扩展'$(wildcard…],你不能在这些地方使用它。'$(wildcard…)就Automake而言,"是一个与AC_SUBSTed变量相当的黑框。
您可以使用-Wportability标志获得有关"$(通配符…")构造的警告。"
相关文章:
- 表示"accepting anything for this template argument" C++概念的通配符
- 当使用通配符和null指针调用函数时,对输出的说明
- C++17 文件系统::remove_all 带有通配符路径
- 如何允许通配符模板参数
- 使用通配符的跨平台文件列表
- 如何检索由带通配符的字符串索引的对象
- 有效地查找通配符条目
- 具有不同输入和输出名称的生成文件通配符
- MinGW GCC通配符编译所有文件(Windows)
- Windows 上带有通配符的目录中的文件
- 查找第一个文件W通配符匹配
- 在某些情况下,通配符模式匹配失败
- 实现通配符后没有输入文件错误
- 如何为文件对话框过滤器设置通配符
- 使用通配符搜索QTableWidget时出现问题
- 为什么 std::experimental::filesystem::p ath 不接受像 "*" 这样的通配符?
- 在三元搜索树中搜索(NOT with)通配符
- SQLite如何在列上使用LIKE并添加通配符
- 带有通配符的 ifstream
- 在automake中使用通配符