I put all my images needed for the document in an images/ folder below the main document folder. Using recusrive make, the document Makefile has this line at its top
DIRS = images include common.mk ...
Then the Makefile in the images/ file looks like this
DIRS = include common.mk FILES := $(shell ls -1 *.pdf) #$(info $$FILES is [${FILES}]) TARGET = $(basename $(FILES)) #$(info $$TARGET is [${TARGET}]) all:: ${TARGET:=.svg} @echo "Finished building [$?]" %.svg : %.pdf prep $< .PHONY: clean clean :: -rm -f ${TARGET:=.svg}
Where prep is my script I use to crop the images and generate SVG image from each.
Here it is
>cat `which prep` #!/bin/bash set -u set -e set -o pipefail for file in $1; do filename=${file%.*} pdfcrop --margins 10 --clip "$filename.pdf" "$filename.pdf" pdf2svg "$filename.pdf" "$filename.svg" # pdftops -f 1 -l 1 -level3 -eps "$filename.pdf" done my_courses>
I use pdf file for the source of all the images. The above setup takes care of updating the images if one of them changes when compiling the latex file.