I am preparing a Makefile
for a TeX document and I want to customize the TEXINPUTS
environment variable, as follows:
The Makefile
says
TEXINPUTS= figures
TEXINPUTS+= chapter1
TEXINPUTS+= chatper2
galley.pdf: ${SRCS}
env TEXINPUTS="${TEXINPUTSPATH}" ${TEX} galley.tex
Where TEXINPUTSPATH
should be figures:chapter1:chapter2:
.
How can I compute TEXINPUTSPATH
from TEXINPUTS
with BSD Make?
The naive approach
TEXINPUTSPATH=${TEXINPUTS:S/ /:}
will not work, because the substitution commanded byS
is done on each word ofTEXINPUTS
. Luckily, we can useQ
to quote each space and turnTEXINPUTS
into a single word: