GNU做双冒号 [英] GNU make kind-of-double colon

查看:136
本文介绍了GNU做双冒号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对gmake语法的理解有点问题:

I've got a little problem understanding following gmake syntax:

OBJ = foo.o bar.o

$(OBJ): %.o: %.cpp
    $(CC) -c -MMD -MP $(INCLUDES) $(CFLAGS) $< -o $@
    @sed (...create empty targets in file...)

我不知道什么$(...):%.o:%.cpp!

I'm not sure what $(...): %.o: %.cpp does!?

我认为它可能会将%.o:%.cpp翻译成正确的%.cpp依赖项 - 是吗?谷歌在这里不是一个帮助 - 它找到只是通常的双冒号(目标::)这是不同的!

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!

任何建议?感谢!

推荐答案

这是一个static模式规则

$(OBJ) 是目标列表。 %。o:%.cpp 表示对于列表中与%,o 匹配的每个目标,依赖于%。cpp (其中被相应替换)。

$(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).

这篇关于GNU做双冒号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆