aboutsummaryrefslogtreecommitdiff
path: root/slides/Makefile
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2018-04-24 09:23:08 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2018-04-24 09:23:08 +0200
commitf64b81fed9702c41af4cec14d91f38ce5ad3384e (patch)
tree63e91bbcd80c75f2239e7313284fcc9b1f42f22d /slides/Makefile
parent83f6af8f26bd51844d5e83640e81d9d80dc467d4 (diff)
downloadiot-workshop-f64b81fed9702c41af4cec14d91f38ce5ad3384e.tar.gz
iot-workshop-f64b81fed9702c41af4cec14d91f38ce5ad3384e.tar.bz2
iot-workshop-f64b81fed9702c41af4cec14d91f38ce5ad3384e.tar.xz
iot-workshop-f64b81fed9702c41af4cec14d91f38ce5ad3384e.zip
o Moving everything under slides.
Diffstat (limited to 'slides/Makefile')
-rw-r--r--slides/Makefile83
1 files changed, 83 insertions, 0 deletions
diff --git a/slides/Makefile b/slides/Makefile
new file mode 100644
index 0000000..5761bbb
--- /dev/null
+++ b/slides/Makefile
@@ -0,0 +1,83 @@
+P=what-is-iot
+# Madrid Pittsburgh boxes
+SLIDE_THEME?=boxes
+PDFS=$(P)-text.pdf $(P)-slides.pdf
+HTMLS=$(P)-reveal.html
+
+ifeq (1,$(QUICK))
+PP_DEFS+=QUICK
+PDF_ENGINE = pdflatex
+PANDOC_ARGS += --no-highlight
+else
+PDF_ENGINE = xelatex
+PANDOC_ARGS += --highlight-style=pygments
+endif
+
+RUN_PP_BEAMER=pp -DBEAMER $(patsubst %,-D%,$(PP_DEFS))
+RUN_PP_REVEALJS=pp -DREVEALJS $(patsubst %,-D%,$(PP_DEFS))
+RUN_PANDOC_BEAMER=pandoc -f markdown -t beamer $(PANDOC_ARGS) -V theme:$(SLIDE_THEME) \
+ --pdf-engine=$(PDF_ENGINE)
+RUN_PANDOC_REVEALJS=pandoc -f markdown -t revealjs -s -V revealjs-url=./bower_components/reveal.js
+RUN_PANDOC_TEXT=pandoc -f markdown --pdf-engine=$(PDF_ENGINE)
+
+all: toc.md $(PDFS) $(HTMLS)
+
+slides: $(P)-slides.tex $(P)-slides.pdf
+html: $(P)-reveal.html
+.PHONY: html slides
+
+clean:
+ rm -f $(PDFS) $(HTMLS)
+
+toc.md: $(P).md
+ grep '^#' $< | sed -e 's,^# ,* ,' -e 's,^## , * ,' > $@
+
+spell: .$(P).md.spell
+
+.$(P).md.spell: $(P).md
+
+.%.spell: %
+ aspell --home-dir=. --personal=dictionary.txt --lang=en_US check $<
+ touch $@
+
+$(P).md: Makefile
+ @touch $@
+
+%.beamer.md: %.md
+ $(RUN_PP_BEAMER) < $< > $@
+
+%-text.pdf: %.beamer.md
+ $(RUN_PANDOC_TEXT) -o $@ $<
+
+%-slides.pdf: %.beamer.md .var/SLIDE_THEME
+ $(RUN_PANDOC_BEAMER) -o $@ $<
+
+%-slides.tex: %.beamer.md .var/SLIDE_THEME
+ $(RUN_PANDOC_BEAMER) -o $@ $<
+
+%.revealjs.md: %.md
+ $(RUN_PP_REVEALJS) < $< > $@
+
+%-reveal.html: %.revealjs.md
+ $(RUN_PANDOC_REVEALJS) -o $@ $<
+
+images/%.pdf: images/%.tex | images/pp-template Makefile
+ images/pp-template < $< > $(patsubst %.tex,%-full.tex,$<)
+ xelatex -output-directory=images $(patsubst %.tex,%-full.tex,$<)
+ mv $(patsubst %.pdf,%-full.pdf,$@) $@
+
+
+VARS=SLIDE_THEME
+
+define refresh =
+.var/$(1)::
+ @mkdir -p .var
+ @./refresh $$@ $(1) $($(1))
+endef
+
+$(foreach var,$(VARS),$(eval $(call refresh,$(var))))
+
+# Dependencies
+$(P).md: images/IP-Header_eng.tex
+$(P).md: images/ip-header.pdf
+$(P).md: images/ip-header.svg