The following mwe does produce an invalid makefile when used with latexmk
's -output-directory
option. (The example is from the pgfplots
manual)
latexmk mwe.tex -output-directory=build
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize[mode=list and make]
\begin{document}
\input{tikz/figure.tikz}
\end{document}
and a file under tikz/figure.tikz
\begin{figure}
\begin{tikzpicture}
\begin{axis}
\addplot {x^2};
\end{axis}
\end{tikzpicture}
\caption{Our first external graphics example}
\end{figure}
with the makefile beeing at build/mwe.makefile
ALL_FIGURE_NAMES=$(shell cat mwe.figlist)
ALL_FIGURES=$(ALL_FIGURE_NAMES:%=%.pdf)
allimages: $(ALL_FIGURES)
@echo All images exist now. Use make -B to re-generate them.
FORCEREMAKE:
include $(ALL_FIGURE_NAMES:%=%.dep)
%.dep:
mkdir -p "$(dir $@)"
touch "$@" # will be filled later.
mwe-figure0.pdf:
pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "mwe-figure0" "\def\tikzexternalrealjob{mwe}\input{mwe}"
mwe-figure0.pdf: mwe-figure0.md5
as the mwe.tex
file is not in the build
directory, running the make
command from the build
directory will not work;
also running it from the projcts "root" directory will not work, as there is no mwe.figlist
there.