GNU Make 忽略 windows 上的环境变量

GNU Make ignores environment variables on windows

所以,在 powershell 中,我输入

$ Set-Variable FOO

然后,在我的 makefile 中,我有

.PHONY: show-foo
show-foo:
    @echo ${FOO}

它输出一个空行。

我试过使用像 $profile 这样的系统变量,none 的环境变量似乎被传递到 makefile 中。

有人能告诉我我做错了什么吗?

在 windows 10 上,使用 make 4.2.1

Set-Variable 设置一个 shell 变量,但不修改环境(就像 sh 中的 var="val" 不导出一样)。而是使用

$env:FOO="VALUE"

操纵环境。