Makefile中的:=和=有什么区别? [英] What's the difference between := and = in Makefile?

查看:80
本文介绍了Makefile中的:=和=有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Make中的变量赋值,我看到:=和=运算符.它们之间有什么区别?

For variable assignment in Make, I see := and = operator. What's the difference between them?

推荐答案

这在GNU Make文档的标题为

This is described in the GNU Make documentation, in the section titled 6.2 The Two Flavors of Variables .

简而言之,用:= 定义的变量被扩展一次,但是用 = 定义的变量在每次使用时都被扩展.

In short, variables defined with := are expanded once, but variables defined with = are expanded whenever they are used.

这篇关于Makefile中的:=和=有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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