forked from hshdb/hshdb2014
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (56 loc) · 2.09 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
.SUFFIXES: .md .html .pdf
.PHONY: clean
info:
@echo use the sources, luke!
CURDIR := $(dir $(lastword $(MAKEFILE_LIST)))
html: $(patsubst %.md,%.html,$(wildcard *.md))
pdf: $(patsubst %.md,%.pdf,$(wildcard *.md))
bib: $(patsubst %.yaml,%.bib,$(wildcard *.yaml))
all: html pdf
clean:
@rm -rf *.html *.pdf
total: all
@for d in 2014-0?-??; do cd $$d; make all; cd ..; done
# build slides or paper in local directory
# TODO: relative path to includir and css/
BOOTSTRAP=$(realpath $(CURDIR)css)
BEAMER=$(realpath $(CURDIR)beamer-template)
ANY_FORMAT=-s -V title-prefix=hshdb2014
ANY_PDF=--latex-engine xelatex $(ANY_FORMAT)
SLIDES_PDF=$(ANY_PDF) -t beamer --template $(BEAMER)/template.tex
PAPER_PDF=$(ANY_PDF)
ANY_HTML=-S $(ANY_FORMAT)
SLIDES_HTML=-t dzslides $(ANY_HTML)
# TODO: calculate relative path to CSS
PAPER_HTML=-t html5 $(ANY_HTML) --template $(BOOTSTRAP)/template.html --css $(BOOTSTRAP)/template.css --toc --toc-depth 2
HTML_PAPER_FILTER=sed 's/\([^()]\+\.slides\)\.md)/\1.html) ([PDF](\1.pdf))/g'
HTML_SLIDES_FILTER=cat
PDF_SLIDES_FILTER=sed 's/\.gif)/.png)/'
.md.pdf: bib
@cd `dirname $<`; \
NAME="$(basename $(basename $<))"; \
[ -e "$$NAME.bib" ] && BIB="--bibliography $$NAME.bib"; \
if [ "$(suffix $(basename $<))" = ".slides" ]; then \
$(PDF_SLIDES_FILTER) $(notdir $<) | pandoc $(SLIDES_PDF) $$BIB - -o $(notdir $@) ;\
else \
pandoc $(PAPER_PDF) $$BIB $(notdir $<) -o $(notdir $@) ;\
fi
# TODO: Infoseite zu jedem Foliensatz mit HTML und PDF-Ansicht
.md.html: bib
@cd `dirname $<`; \
NAME="$(basename $(basename $<))"; \
[ -e "$$NAME.bib" ] && BIB="--bibliography $$NAME.bib"; \
if [ "$(suffix $(basename $<))" = ".slides" ]; then \
$(HTML_SLIDES_FILTER) $(notdir $<) | pandoc $(SLIDES_HTML) $$BIB - -o $(notdir $@) ;\
else \
$(HTML_PAPER_FILTER) $(notdir $<) | pandoc $(PAPER_HTML) $$BIB - -o $(notdir $@) ;\
fi
include $(CURDIR)/yaml2bib/Makefile
## Make website
.PHONY: website clean-repo
clean-repo:
@git diff-index --quiet HEAD --
website: clean-repo
@git checkout gh-pages && \
echo "Not implemented yet" && \
git checkout master && git submodule foreach git checkout .