我正在通过 makefile 为 Webots(机器人模拟器)编译 C++ 代码,并且我正在使用通用的 makefile Makefile.include
Webots 提供来简化该过程。
我通过自己的 makefile 构建,设置了一堆必需的变量,然后调用那个为编译设置所有必要规则的 makefile。无论如何,它应该是这样工作的。
我收到以下错误:
make[1]: *** No rule to make target 'USER_PREBUILD'. Stop.
/usr/share/webots/resources/Makefile.include:503: recipe for target 'pre-build' failed
make: *** [pre-build] Error 2
并查看相关行(来自Makefile.include
):
$(SUPPORTED_TARGETS): post-build
USER_PREBUILD:
USER_POSTBUILD:
pre-build:
@$(MAKE) --silent USER_PREBUILD
post-build: main-build
@$(MAKE) --silent USER_POSTBUILD
$(TARGETS): pre-build
main-build: $(TARGETS)
我不确定在调用 and 时是否没有语法错误make
,pre-build
或者post-build
如果USER_PREBUILD
andUSER_POSTBUILD
应该是具体文件,但即使将它们替换为$(USER_PREBUILD)
I get *** No targets specified and no makefile found
。所以我假设我需要在调用外部makefile之前设置这些变量,但是如果我在构建之前没有任何事情要做,那么语法到底是什么?
奇怪的是,即使有这些错误,程序仍然编译(我得到了文件夹中的 *.o、*.d 和二进制build
文件),但它从不将二进制文件复制到目标文件夹。