STYLES := css/tufte-css/tufte.css \
	css/pandoc.css \
	css/pandoc-solarized.css \
	css/tufte-extra.css

OPTIONS = --toc
OPTIONS += --filter=pandoc-crossref

PDFOPTIONS = --highlight-style kate
PDFOPTIONS += --pdf-engine pdflatex
PDFOPTIONS += --number-sections
PDFOPTIONS += --template=./default.latex


HTMLOPTIONS += -t html5
HTMLOPTIONS += -c css/tufte-css/tufte.css
HTMLOPTIONS += --self-contained
HTMLOPTIONS += --mathjax=MathJax.js

all:  cours.pdf cours.html

# %.tex: %.md
# 	pandoc -s $(OPTIONS) $(PDFOPTIONS) -o $@ $<

cours.pdf: 00_macros.md 01_rappel.md 02_optimisation.md 03_integrales.md 04_edo.md 05_fourier.md 06_probas_stats.md 07_remerciements.md 08_notes.md
	pandoc -s $(OPTIONS) $(PDFOPTIONS) -o $@ $^ --metadata-file metadata.yaml

cours.html: 00_macros.md 01_rappel.md 02_optimisation.md 03_integrales.md 04_edo.md 05_fourier.md 06_probas_stats.md 07_remerciements.md 08_notes.md
	pandoc -s $(OPTIONS) $(HTMLOPTIONS) -o $@ $^ --metadata-file metadata.yaml

deploy: all
	mkdir -p mti
	cp cours.html mti/index.html
	cp cours.pdf mti/cours.pdf
	mkdir -p mti/tpIntegrales
	make -C tpIntegrales
	cp tpIntegrales/*.pdf mti/tpIntegrales/
	cp tpIntegrales/tp_integrales_conv.html mti/tpIntegrales/index.html
	mkdir -p mti/tpEdo
	make -C tpEdo
	cp tpEdo/*.pdf mti/tpEdo/
	cp tpEdo/tpEquadiffs.html mti/tpEdo/index.html

clean:
	rm -rf *.html *.pdf