为什么此MakeFile规则有两个冒号? [英] Why does this MakeFile rule have two colons?

查看:107
本文介绍了为什么此MakeFile规则有两个冒号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(EXEX) : main% : $(OBJS) pp%.o
    gcc $(FLAGS) $^ -o $@

我只是想了解以上内容.据我了解,EXEX中的所有内容都是目标,将使用以下模式构建.

I am just trying to understand the above. As I understand it, everything in EXEX are targets which will be built using the following pattern.

main,OBJS和pp.o是EXEX中执行操作的先决条件.第二行将使用gcc并将$ FLAGS中的所有标志作为目标文件,使用gcc编译$ ^(表示所有先决条件),以便构建$ @,这是EXEX的内容.必须有规则来构建所有这些-o.

main, OBJS and pp.o are prerequisites for things in EXEX. The second line will compile $^(meaning all the prereqs) using gcc with all the flags in FLAGS as object files in order to build $@ which is the contents of EXEX. There need to be rules to build all those -o's.

我的问题是,为什么会有两个冒号?这是两个规则吗?main%表示= main且文件结尾吗?为什么我们需要pp%.o中的%,在这种情况下,这意味着什么?它似乎有很多目的.

My question is why are there two colons? Is this two rules? Does main% mean = main with any file ending? Why do we need the % in pp%.o, what does it mean in this case? It seems to have many many purposes.

推荐答案

这是静态模式规则.请参阅链接的GNU make文档.

This is a static pattern rule. See the linked GNU make documentation.

这篇关于为什么此MakeFile规则有两个冒号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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