【发布时间】:2021-09-23 02:12:35
【问题描述】:
我有以下代码:
all: ./source/Listener.java ./source/ServerThread.java ./source/TestClient.java
javac -d target $(find ./source/* | grep .java)
当我运行 Make 时,我得到了这个输出
javac -d target
error: no source files
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 2
当我在 bash 中运行 javac 命令时,它编译得很好。此外,当我运行“查找”部分时,我会得到一个我想要的文件列表。另外,第 1 行的文件路径都是准确的。
有什么建议吗?
(我必须使用查找功能,因为使用的文件很多,并且随着时间的推移而增加。我将其修剪为3,但仍然存在错误)
【问题讨论】:
-
你想在你的“
all”目标中执行哪个命令? -
将配方中的
$(find ...)替换为$$(find ...)以逃避make 扩展。正如您所写,make 扩展了一个名为find ... .java的 make 变量,该变量显然不存在。 -
@RenaudPacalet 成功了,非常感谢!