DOC = opdenacker-embedded-linux-45minutes-riscv.tex

INKSCAPE_IS_NEW = $(shell inkscape --version | grep -q "^Inkscape 1.0" && echo YES)

ifeq ($(INKSCAPE_IS_NEW),YES)
INKSCAPE_PDF_OPT = -o
else
INKSCAPE_PDF_OPT = -A
endif

PICTURES = \
	common/logo-penguins.pdf \
	common/logo-square.pdf \
	common/bootlin-logo.pdf \
	graphics/logo-cc.pdf \
	graphics/elixir.pdf \
	graphics/RISC-V-logo.pdf \
	graphics/host-and-target.pdf \
	graphics/cross-toolchain.pdf \
	graphics/Linux_kernel_System_Call_Interface_and_uClibc.pdf \
	graphics/kernel-building-overview.pdf \
	graphics/privilege-modes.pdf \
	graphics/title-roman.pdf \

all: $(PICTURES)
	$(PDFLATEX_ENV) xelatex -shell-escape $(DOC)

%.pdf: %.svg
	inkscape -D $(INKSCAPE_PDF_OPT) $@ $<

%.pdf: %.eps
	epstopdf --outfile=$@ $^

%.eps: %.dia
	dia -e $@ -t eps $^

clean:
	$(RM) -r common/*.pdf *.pdf *.pyg *.snm *.toc *.vrb *.aux *.nav *.out *.dia~ *.log _minted* $(PICTURES)
