diff --git a/Makefile b/Makefile
index 30f39507dd1de40d8328e412a88041eebbd9c13f..62f4319d0147507c934ff49633c4d647deeb4be2 100644
--- a/Makefile
+++ b/Makefile
@@ -18,50 +18,31 @@ HTMLOPTIONS += -c css/tufte-css/tufte.css
 HTMLOPTIONS += --self-contained
 HTMLOPTIONS += --mathjax=MathJax.js
 
+CLASS_SOURCES := $(sort $(filter-out README.md, $(wildcard *.md)))
+SOURCES := $(filter-out 00_macros.md, $(CLASS_SOURCES))
+SOURCES := $(filter-out 08_notes.md, $(CLASS_SOURCES))
+
 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
+cours.pdf: $(CLASS_SOURCES)
 	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
+cours.html: $(CLASS_SOURCES)
 	pandoc -s $(OPTIONS) $(HTMLOPTIONS) -o $@ $^ --metadata-file metadata.yaml
 
-hakyll_gen: 1_Rappel.markdown 2_Optimisation.markdown 3_Integrales.markdown 4_Equation_Differentielles_Ordinaires.markdown 5_Transformees_de_Fourier.markdown 6_Probabilites_et_Statistique.markdown 7_Remerciements.markdown
-
-# macros: 00_macros.md
-# 	sed  "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 02_optimisation.md | head -n 1)\n---" $< > $@
-
-1_Rappel.markdown: 00_macros.md 01_rappel.md 08_notes.md
-	cat $^ > $@
-	sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 01_rappel.md | head -n 1)\nmathjax: on\n---" $@
-
-2_Optimisation.markdown: 00_macros.md 02_optimisation.md 08_notes.md
-	cat $^ > $@
-	sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 02_optimisation.md | head -n 1)\nmathjax: on\n---" $@
-
-3_Integrales.markdown: 00_macros.md 03_integrales.md 08_notes.md
-	cat $^ > $@
-	sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 03_integrales.md | head -n 1)\nmathjax: on\n---" $@
-
-4_Equation_Differentielles_Ordinaires.markdown: 00_macros.md 04_edo.md 08_notes.md
-	cat $^ > $@
-	sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 04_edo.md | head -n 1)\nmathjax: on\n---" $@
-
-5_Transformees_de_Fourier.markdown: 00_macros.md 05_fourier.md 08_notes.md
-	cat $^ > $@
-	sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 05_fourier.md | head -n 1)\nmathjax: on\n---" $@
-
-6_Probabilites_et_Statistique.markdown: 00_macros.md 06_probas_stats.md 08_notes.md
-	cat $^ > $@
-	sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 06_probas_stats.md | head -n 1)\nmathjax: on\n---" $@
+MARKDOWN := $(patsubst %.md, %.markdown, $(SOURCES))
 
-7_Remerciements.markdown: 00_macros.md 07_remerciements.md 08_notes.md
-	cat $^ > $@
-	sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 07_remerciements.md | head -n 1)\nmathjax: on\n---" $@
+hakyll_gen: $(MARKDOWN)
 
+$(MARKDOWN): %.markdown: 00_macros.md %.md 08_notes.md
+	$(file >$@,---)
+	$(file >>$@,\date: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- $(word 2,$^) | head -n 1))
+	$(file >>$@,mathjax: on)
+	$(file >>$@,---)
+	cat $^ >> $@
 
 deploy: all
 	mkdir -p mti