makefile中?=
时间: 2023-09-25 16:15:05 浏览: 103
在Makefile中,"?="是一种赋值运算符,它的作用是给变量赋值,但是只有当该变量未定义时才会进行赋值。如果变量已经定义了,那么"?="运算符将不会对该变量进行赋值操作。因此,"?="可以用来设置变量的默认值,以防止重复定义变量导致的错误。在你提到的例子中,KERNELDIR ?= /lib/modules/是给变量KERNELDIR赋值,如果该变量已经定义了,那么就不会进行赋值操作,否则将其设置为/lib/modules/。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Makefile 中:= ?= += =的区别 和条件执行](https://blog.csdn.net/u011029104/article/details/103405697)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [Makefile中4种赋值运算符(=、:=、?=、+=)](https://blog.csdn.net/weixin_42031299/article/details/119720236)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文