以下 make 片段的含义 INSTALLSOURCE=$(subst /,\,$(DEST))

Meaning of the following make snippet INSTALLSOURCE=$(subst /,\,$(DEST))

我试图理解 makefile 中的一些代码,我看到了下面的代码片段 --

export INSTALLSOURCE=$(subst /,\,$(DEST))

我读到 subst 用于替换某些值,但上面的代码片段实际上做了什么,如果有人能用例子解释会很好

这是用 $(DEST) 中的 / 替换 /。即在contentDEST变量中。那么这一切都赋值给了INSTALLSOURCE.

如需进一步阅读,请参阅 doco on subst

借用 GNU doco 的例子:

$(subst ee,EE,feet on the street)

变化:

FROM: "feet on the street"
TO:   "fEEt on the strEEt"

但在你的情况下,如果 DEST 是:

/path/to/file.txt

变成:

\path\to\file.txt