diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2020-12-01 21:32:20 +0100 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2020-12-03 17:33:35 +0100 |
commit | b6bebdc03066e513efbbb5ff9424681bbcceff0c (patch) | |
tree | ad58ccc072efbfdeabe4d9b4b20b79acc8fd19b3 /model_5/Makefile | |
parent | 02b663b21099cdb62cef7b363cae46a56d7aae5f (diff) |
Added a new model, and did some factorisation
Diffstat (limited to 'model_5/Makefile')
-rwxr-xr-x | model_5/Makefile | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/model_5/Makefile b/model_5/Makefile new file mode 100755 index 0000000..c02fab5 --- /dev/null +++ b/model_5/Makefile @@ -0,0 +1,46 @@ +TEX=xelatex +SOURCE=. + +SRC =$(wildcard *.rst) +SVG =$(wildcard content/*.svg) + +PDFS = $(SRC:.rst=.pdf) +INCLUDED_PDF = $(SVG:.svg=.pdf) + +all: $(PDFS) + +BIBS =$(wildcard *.bib) + +DIR = $(sort $(shell find $(SOURCE) -name '*.rst' -print)) +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 + +# 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=extarticle --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 |