I am trying to understand some code in the makefile and I came across the below snippet --
export INSTALLSOURCE=$(subst /,\,$(DEST))
I read that subst is used to substitute certain values but what does the above snippet actually do, will be good if someone can explain with an example
It's substituting /
with \
in $(DEST)
. That is, in the content of the DEST
variable. Then all of this is assigned to INSTALLSOURCE
.
For further reading, please refer to the doco on subst.
Borrowing the example from the GNU doco:
$(subst ee,EE,feet on the street)
Changes:
FROM: "feet on the street"
TO: "fEEt on the strEEt"
But in your case, if DEST
was:
/path/to/file.txt
It becomes:
\path\to\file.txt