Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 Makefile 中有一行是这样的:
prog /something/f.{one,two,three}
但是运行我从 prog 获得的 make 文件
/something/f.{one,two,three}不存在。这让我相信 make 并没有扩大全球范围。通常这在 Bash 中对我有用,但我现在正在运行 zshell,所以我认为这就是问题所在。任何人都知道如何可移植地指定该模式?
/something/f.{one,two,three}
是否必须进行外壳扩展?Make 可以为您做类似的事情。这只是一种方法:
EXPANDED_POSTFIX := one two three BASE_FILE := f. PROG_FILE_LIST := $(foreach post,${EXPANDED_POSTFIX},${BASE_FILE}${post}) exec_prog: prog ${PROG_FILE_LIST}
ThePosey建议的替代方法是使用addprefix:
addprefix
FILE_SUFFIXES := one two three FILE_BASE := /something/f FILES := $(addprefix $(FILE_BASE).,$(FILE_SUFFIXES)) my_rule: prog $(FILES)