Comment 18 for bug 1417470

Affects me in Manjaro with inkscape 0.91 from the official Arch repos, and affected me in Quirky compiled from source. For a while I resorted to 0.48 patched for compatibility with recent cairo and poppler, but now I'm using Hobbyblobby's solution with some adjustments:

##MAKEFILE##
FIG_DIR=data/figures
SVG2PDFTEX_SVG_FILES := $(wildcard $(FIG_DIR)/svg2pdftex_in/*.svg)
SVG2PDFTEX_PDF_FILES=$(patsubst $(FIG_DIR)/svg2pdftex_in/%.svg,$(FIG_DIR)/svg2pdftex_out/%.pdf,$(SVG2PDFTEX_SVG_FILES))
SVG2PDFTEX_TEX_FILES=$(patsubst $(FIG_DIR)/svg2pdftex_in/%.svg,$(FIG_DIR)/svg2pdftex_out/%.pdf_tex,$(SVG2PDFTEX_SVG_FILES))

main.pdf: main.tex $(SVG2PDFTEX_PDF_FILES) $(SVG2PDFTEX_TEX_FILES)
 # call your favourite build tool

$(FIG_DIR)/svg2pdftex_out/%.pdf $(FIG_DIR)/svg2pdftex_out/%.pdf_tex: $(FIG_DIR)/svg2pdftex_in/%.svg
 inkscape -z -f $< --export-latex -A "$$(dirname $@)/$$(basename $< .svg).pdf" -C ; \
 PAGES=$$(pdfinfo "$$(dirname $@)/$$(basename $< .svg).pdf" | grep Pages | cut -d" " -f11) ; \
 for j in $$(egrep "includegraphics.*page=" "$$(dirname $@)/$$(basename $< .svg).pdf_tex") ; do \
  CHECKPAGE="$$(echo $$j | sed 's/^.*page=\([0-9]*\).*$$/\1/g')" ; \
  if [ $$CHECKPAGE -gt $$PAGES ] ; then \
   sed -i 's/^.*includegraphics.*page='$$CHECKPAGE'.*$$//g' "$$(dirname $@)/$$(basename $< .svg).pdf_tex" ; \
  fi ; \
 done
##MAKEFILE(END)##

wherein I use a multitarget pattern rule to allow make to decide when a figure needs to be reprocessed, and some automatic variables to get the target name and directory; see http://www.gnu.org/software/make/manual/make.html#Pattern-Examples

The main difference is that the target is a file instead of .PHONY and the rule only generates the target (and its pdf or pdf_tex complement) rather than running through the whole svg directory. Make should recreate %.pdf and %.pdf_tex when at least one is missing or older than %.svg, for each %.svg in SVG2PDFTEX_SVG_FILES, but otherwise won't waste its time. One could specify the required figures manually per project instead of the wildcard and patsubst method, or maybe automatically when building with latexmk; I think I recall that it would attempt "make (file)" if pdflatex reported (file) were missing.