I would like to have a makefile which compiles all my .svg files, one variable into command line at a time. What if have tried so far is:
FIGS_SVG= \
fault_region.svg \
fault_region2.svg
all:
inkscape -z -D --file=$(FIGS_SVG) --export-pdf=$(FIGS_SVG:.svg=.pdf) --export-latex
When this is run the variable is set into the command one after the other as so:
inkscape -z -D --file=fault_region.svg fault_region2.svg --export-pdf=fault_region.pdf fault_region2.pdf --export-latex
Usually with Make, you give a rule for turning one kind of file into another, then tell it the files you want it to build, and Make takes care of it for you:
FIGS_SVG = \
fault_region.svg \
fault_region2.svg
all: $(FIGS_SVG:.svg=.pdf)
%.pdf %.pdf_tex: %.svg
inkscape -z -D --file=$< --export-pdf=$@ --export-latex
The special variables $@
and $<
are documented in the Automatic Variables section of the manual.
This will run the two commands
inkscape -z -D --file=fault_region.svg --export-pdf=fault_region.pdf --export-latex
inkscape -z -D --file=fault_region2.svg --export-pdf=fault_region2.pdf --export-latex
but only if the .pdf file is nonexistent or has an older file modification time than the corresponding .svg file.
Note that Make has been told that a tex
file is created too, so that if you delete one of those, Make will know how to regenerate it.