在构建开源项目时,我遇到了以下错误:
make subdir=manual -C manual ..=../ subdir_lib
Makefile:235: *** mixed implicit and normal rules. Stop.
Run Code Online (Sandbox Code Playgroud)
Makefile第235行的代码如下:
235: $(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
236: $(make-target-directory)
237: touch $@
Run Code Online (Sandbox Code Playgroud)
Eri*_*ski 16
当你有一个类似于模式规则输出(包含a %)的东西以及在规则声明%的左侧看起来像正常输出(no )的东西时,GNU make会打印该错误消息:.例如:
%.pat normal:
@echo $@
Run Code Online (Sandbox Code Playgroud)
因此,在Makefile的第235行,您已经设法将构成的"看起来像"的东西组合在一起.要避免错误,请修复该声明,最有可能将其拆分为两个:
%.pat:
@echo $@
normal:
@echo $@
Run Code Online (Sandbox Code Playgroud)
如果没有看到产生此错误的完整makefile,我们可以给你的建议不多.
在我的情况下,错误是由于愚蠢地放置一个无关的:在依赖行的末尾:
%.o: %.cpp:
g++ -c -o %@ $<
Run Code Online (Sandbox Code Playgroud)
我自己刚刚有了这个,这是由于变量定义中“/”之后的隐藏空间,即
#accidental/invisible space left after the final "/" i.e...
DESTDIR=path/to/the/destination/directory/
# ...just here ^
#rule to make copies of text files...
$(DESTDIR)%.txt:$(SRCDIR)%.txt
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20081 次 |
| 最近记录: |