TARGET=slides.pdf SVGS=$(wildcard imgs/*.svg) SVG_PDFTEXS = $(patsubst imgs/%,imgs/pdf_tex/%,$(SVGS:.svg=.pdf_tex)) SVG_PDF = $(patsubst imgs/%,imgs/pdf/%,$(SVGS:.svg=.pdf)) AUTOGEN_SVGS_LIST=mac AUTOGEN_SVGS=$(addprefix imgs/_autogen/,$(AUTOGEN_SVGS_LIST)) all: $(SVG_PDFTEXS) $(SVG_PDF) $(AUTOGEN_SVGS) $(TARGET) %.pdf: %.tex latexmk -pdfxe $< imgs/_autogen/%: imgs/%.svg imgs/split_layers.py "$*.svg" cd "$@" ; inkscape --export-type=pdf *.svg imgs/pdf_tex/%.pdf_tex: imgs/%.svg mkdir -p "imgs/pdf_tex" inkscape "$<" -o "$(@:.pdf_tex=.pdf)" --export-latex 2>/dev/null sed -i 's#\($(patsubst imgs/pdf_tex/%,%,$(@:.pdf_tex=.pdf))\)#imgs/pdf_tex/\1#g' $@ imgs/pdf/%.pdf: imgs/%.svg mkdir -p "imgs/pdf" inkscape "$<" -o "$@" 2>/dev/null .PHONY: clean clean: latexmk -C rm -rf "imgs/pdf_tex" "imgs/pdf" rm -rf imgs/_autogen