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 bySis done on each word ofTEXINPUTS. Luckily, we can useQto quote each space and turnTEXINPUTSinto a single word: