什么是Makefile中的?= [英] What is ?= in Makefile

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

问题描述

KDIR ?= $(shell uname -r)

?=是什么意思?

我已经从Stack Overflow中提供的另一个线程中了解了:=+==之间的区别,但是找不到?=的解释.

I have understood the difference between :=, += and = from another thread available in Stack Overflow, but unable to find the explanation for ?=.

推荐答案

?=表示仅在未设置/没有值的情况下设置KDIR变量.

?= indicates to set the KDIR variable only if it's not set/doesn't have a value.

例如:

KDIR ?= "foo"
KDIR ?= "bar"

test:
    echo $(KDIR)

会打印"foo"

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

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