PDFOPTIONS = -t beamer
PDFOPTIONS += --highlight-style my_highlight.theme
PDFOPTIONS += --pdf-engine pdflatex
PDFOPTIONS += -V theme:metropolis
PDFOPTIONS += -V themeoptions:numbering=none -V themeoptions:progressbar=foot
PDFOPTIONS += -V fontsize=smaller
PDFOPTIONS += -V urlcolor=blue

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

REVEALOPTIONS = -t revealjs
REVEALOPTIONS += --self-contained
REVEALOPTIONS += -V revealjs-url=./reveal.js
REVEALOPTIONS += -V theme=white

all: base_6.pdf base_5.pdf base_4.pdf base_3.pdf base_2.pdf base_1.pdf intro.pdf command_line.pdf index.html 

all_html: intro.html base_1.html base_2.html base_3.html base_4.html base_5.html base_6.html command_line.html

intro.pdf: intro.md metadata.yaml
	pandoc $(PDFOPTIONS) -o $@ $^

intro.html: intro.md metadata.yaml
	pandoc $(REVEALOPTIONS) -o $@ $^

base_1.pdf: base_1.md metadata.yaml
	pandoc $(PDFOPTIONS) -o $@ $^

base_1.html: base_1.md metadata.yaml
	pandoc $(REVEALOPTIONS) -o $@ $^

base_2.pdf: base_2.md metadata.yaml
	pandoc $(PDFOPTIONS) -o $@ $^

base_2.html: base_2.md metadata.yaml
	pandoc $(REVEALOPTIONS) -o $@ $^

base_3.pdf: base_3.md metadata.yaml
	pandoc $(PDFOPTIONS) -o $@ $^

base_3.html: base_3.md metadata.yaml
	pandoc $(REVEALOPTIONS) -o $@ $^

base_4.pdf: base_4.md metadata.yaml
	pandoc $(PDFOPTIONS) -o $@ $^

base_4.html: base_4.md metadata.yaml
	pandoc $(REVEALOPTIONS) -o $@ $^

base_5.pdf: base_5.md metadata.yaml
	pandoc $(PDFOPTIONS) -o $@ $^

base_5.html: base_5.md metadata.yaml
	pandoc $(REVEALOPTIONS) -o $@ $^

base_6.pdf: base_6.md metadata.yaml
	pandoc $(PDFOPTIONS) -o $@ $^

base_6.html: base_6.md metadata.yaml
	pandoc $(REVEALOPTIONS) -o $@ $^

command_line.pdf: command_line.md metadata.yaml
	pandoc $(PDFOPTIONS) -o $@ $^

command_line.html: command_line.md metadata.yaml
	pandoc $(REVEALOPTIONS) -o $@ $^

index.html: index.md
	pandoc -s $(OPTIONS) $(HTMLOPTIONS) -o $@ $<

deploy: all all_html
	mkdir -p prog_seq_c_cours
	cp *.pdf prog_seq_c_cours
	cp *.html prog_seq_c_cours
	cp index.html prog_seq_c_cours/

clean:
	rm -f *.pdf *.html