POSIX 可以从程序输出中设置变量吗?

unh*_*mer 2 posix makefile

在 GNU make 中,可以做一些事情,比如X:=$(shell command -v foo)将 X 设置为该 shell 命令的输出。有没有办法用纯 POSIX make 实现同样的事情?

Mad*_*ist 5

There is no way in POSIX yet. There is a proposal which is probably going to be accepted at some point which allows for a != assignment which is similar to using $(shell ...). Newer versions of GNU make already support this syntax, as does BSD make.

X != command -v foo
Run Code Online (Sandbox Code Playgroud)