From f83e8b39df08ea9e9ca130a4578c749d48d55844 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Sat, 10 Aug 2019 20:36:56 +0200 Subject: First commit --- model_3/Makefile | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 model_3/Makefile (limited to 'model_3/Makefile') diff --git a/model_3/Makefile b/model_3/Makefile new file mode 100755 index 0000000..c078875 --- /dev/null +++ b/model_3/Makefile @@ -0,0 +1,48 @@ +TEX=xelatex + +SRC =$(wildcard *.rst) +SVG =$(wildcard content/*.svg) + +PDFS = $(SRC:.rst=.pdf) +INCLUDED_PDF = $(SVG:.svg=.pdf) + +all: $(PDFS) + +BIBS =$(wildcard *.bib) + +SOURCES = $(sort $(wildcard resources/*.tex)) + +null := +space := $(null) # +comma := , +TEX_STYLE := $(subst $(space),$(comma),$(strip $(SOURCES))) +TEX_BIBS := $(subst $(space),$(comma),$(strip $(BIBS))) + +PACK = $(shell sed -e 's/\#.*$$//' -e '/^$$/d' resources/modules) +PACKAGES := $(subst $(space),$(comma),$(strip $(PACK))) + +tmp: + mkdir tmp + +# Image generation +content/%.pdf: content/%.svg + inkscape -D -z --export-pdf=$@ $< + +# Generate the latex file from rst +tmp/%.tex: %.rst $(INCLUDED_PDF) $(SOURCES)| tmp + $$(command -v rst2latex rst2latex.py | head -n 1) --no-section-subtitles --table-style=borderless --use-latex-citations --use-latex-docinfo --documentclass=article --documentoption=12pt,A4,table --syntax-highlight=short --stylesheet=$(PACKAGES),$(TEX_STYLE) $< $@ + sed -i -e 's/continued on next page/suite sur la page suivante/;s|^%$$||' $@ + sed -i -e 's/admonition-/admonition/g' $@ + +# Generate each pdf with latex +tmp/%.pdf: tmp/%.tex $(BIBS) | tmp + $(TEX) -output-directory tmp $< + #bibtex tmp/$*.aux && $(TEX) -output-directory tmp $< || echo "no bib" + while grep 'Rerun to get ' tmp/$*.log ; do $(TEX) -output-directory tmp $< ; done + +# Put the pdf in the right place +%.pdf: tmp/%.pdf | tmp + cp $< $@ + +clean: + rm -r tmp -- cgit v1.2.3