aboutsummaryrefslogtreecommitdiff
path: root/model_6/Makefile
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2022-01-04 14:27:05 +0100
committerSébastien Dailly <sebastien@dailly.me>2022-01-04 14:27:05 +0100
commit57850b2a7d50ee37b7b623921081b9060dd778eb (patch)
treefccb39c8b6eb4289fd5f5b03547b8576a193305d /model_6/Makefile
parentbb2a0cec678b80b1ffad675d5f2bdf1982d603d6 (diff)
New template
Diffstat (limited to 'model_6/Makefile')
-rwxr-xr-xmodel_6/Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/model_6/Makefile b/model_6/Makefile
new file mode 100755
index 0000000..170dd32
--- /dev/null
+++ b/model_6/Makefile
@@ -0,0 +1,40 @@
+TEX=xelatex
+SOURCE=.
+
+SRC =$(wildcard *.rst)
+
+PDFS = $(SRC:.rst=.pdf)
+
+all: $(PDFS)
+
+DIR = $(sort $(shell find $(SOURCE) -name '*.rst' -print))
+SOURCES = $(sort $(wildcard resources/*.tex) )
+
+null :=
+space := $(null) #
+comma := ,
+TEX_STYLE := $(subst $(space),$(comma),$(strip $(SOURCES)))
+
+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 $(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 | tmp
+ $(TEX) -output-directory tmp $<
+ 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