diff --git a/Makefile b/Makefile index fa07d4e6a85d3490f1b44bf2e3178dc481bb3bf4..c75ba9e64202664b49b1eeb3244183c128af8edc 100644 --- a/Makefile +++ b/Makefile @@ -18,33 +18,29 @@ HTMLOPTIONS += -c css/tufte-css/tufte.css HTMLOPTIONS += --self-contained HTMLOPTIONS += --mathjax=MathJax.js -SOURCES = 00_macros.md 01_analyse_dimensionnelle.md 02_lois_de_newton.md 03_charge_electrique_champs_electrique.md 04_remerciements.md 10_footer.md +# SOURCES = 00_macros.md 01_analyse_dimensionnelle.md 02_lois_de_newton.md 03_charge_electrique_champs_electrique.md 04_remerciements.md 10_footer.md +CLASS_SOURCES := $(filter-out README.md, $(wildcard *.md)) +SOURCES := $(filter-out 00_macros.md, $(CLASS_SOURCES)) +SOURCES := $(filter-out 10_footer.md, $(SOURCES)) + +MARKDOWN := $(patsubst %.md, %.markdown, $(SOURCES)) all: cours.pdf cours.html -cours.pdf: $(SOURCES) +cours.pdf: $(CLASS_SOURCES) pandoc -s $(OPTIONS) $(PDFOPTIONS) -o $@ $^ --metadata-file metadata.yaml -cours.html: $(SOURCES) +cours.html: $(CLASS_SOURCES) pandoc -s $(OPTIONS) $(HTMLOPTIONS) -o $@ $^ --metadata-file metadata.yaml -hakyll_gen: Analyse_Dimensionnelle.markdown Lois_de_Newton.markdown Charge_Electrique_Champs_Electrique.markdown - -Analyse_Dimensionnelle.markdown: 00_macros.md 01_analyse_dimensionnelle.md 10_footer.md - cat $^ > $@ - sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 01_analyse_dimensionnelle.md | head -n 1)\nmathjax: on\n---" $@ - -Lois_de_Newton.markdown: 00_macros.md 02_lois_de_newton.md 10_footer.md - cat $^ > $@ - sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 02_lois_de_newton.md | head -n 1)\nmathjax: on\n---" $@ - -Charge_Electrique_Champs_Electrique.markdown: 00_macros.md 03_charge_electrique_champs_electrique.md 10_footer.md - cat $^ > $@ - sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 03_charge_electrique_champs_electrique.md | head -n 1)\nmathjax: on\n---" $@ +hakyll_gen: $(MARKDOWN) -Remerciements.markdown: 00_macros.md 04_remerciements.md 10_footer.md - cat $^ > $@ - sed -i "1i ---\ndate: $(shell git log --follow -p -1 --format=%cd --date=format:'%Y-%m-%d' -- 04_remerciements.md | head -n 1)\nmathjax: on\n---" $@ +$(MARKDOWN): %.markdown: 00_macros.md %.md 10_footer.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 phys @@ -56,5 +52,5 @@ deploy: all cp exercices/*.pdf phys/exercices clean: - rm -f *.html *.pdf *.markdown + rm -f *.html *.pdf $(MARKDOWN) rm -rf phys