从命令行到环境的Makefile变量

pyt*_*hor 5 makefile

有没有办法检测是否已从环境设置变量而不是命令行?

我希望有人援引以作区分make LIB=mylibmake与被定义$ LIB.

Mic*_*yan 5

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

ifneq (,$(findstring environment,$(origin LIB)))
    # LIB was defined by the environment
else
    # LIB was defined some other way
endif