GNU 制作一种双冒号
我在理解 gmake 语法时遇到了一些问题:
OBJ = foo.o bar.o
$(OBJ): %.o: %.cpp
$(CC) -c -MMD -MP $(INCLUDES) $(CFLAGS) $< -o $@
@sed (...create empty targets in file...)
我不确定 $(...): %.o: %.cpp 的作用是什么!?
我认为它可能会将“%.o: %.cpp”翻译为正确的 %.cpp 依赖项 - 是吗?谷歌在这里并没有多大帮助——它只找到了通常的双冒号(目标::),这是不同的!
有什么建议吗?谢谢!
I've got a little problem understanding following gmake syntax:
OBJ = foo.o bar.o
$(OBJ): %.o: %.cpp
$(CC) -c -MMD -MP $(INCLUDES) $(CFLAGS) lt; -o $@
@sed (...create empty targets in file...)
I'm not sure what $(...): %.o: %.cpp does!?
I think it might translate the "%.o: %.cpp" in correct %.cpp dependencies - does it? Google is not much of a help here - it finds just the usual double colon (target::) which is something different!
Any advice? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个静态模式规则。
$(OBJ)
是目标列表。%.o : %.cpp
表示“对于列表中与%.o
匹配的每个目标,它依赖于%.cpp
" (其中%
被相应替换)。This is a static pattern rule.
$(OBJ)
is a list of targets. The%.o : %.cpp
means "for each target in the list that matches%.o
, it is dependent on%.cpp
" (where the%
is substituted accordingly).