gpt4 book ai didi

来自命令行与环境的 Makefile 变量

转载 作者:行者123 更新时间:2023-12-04 19:23:40 24 4
gpt4 key购买 nike

有没有办法检测是否从环境和命令行设置了变量?

我想区分使用 make LIB=mylib 调用 make 的人对比 make和 $LIB 被定义。

最佳答案

是的。您可以使用 origin函数来确定变量的定义位置。

ifneq (,$(findstring environment,$(origin LIB)))
# LIB 是由环境定义的
别的
# LIB 是以其他方式定义的
万一

关于来自命令行与环境的 Makefile 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1602972/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com