forked from sdiehl/wiwinwlh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (25 loc) · 829 Bytes
/
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
PANDOC = pandoc
IFORMAT = markdown
FLAGS = --standalone --toc --toc-depth=2 --highlight-style pygments
TEMPLATE = page.tmpl
STYLE = css/style.css
HTML = tutorial.html
# Check if sandbox exists. If it does, then use it instead.
ifeq ("$(wildcard $(.cabal-sandbox/))","")
GHC=ghc -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d
else
GHC=ghc
endif
all: $(HTML)
includes: includes.hs
$(GHC) --make $< ; \
%.html: %.md includes
./includes < $< \
| $(PANDOC) -c $(STYLE) --template $(TEMPLATE) -s -f $(IFORMAT) -t html $(FLAGS) \
| sed '/<extensions>/r extensions.html' > $@
%.epub: %.md includes
./includes < $< | $(PANDOC) -f $(IFORMAT) -t epub $(FLAGS) -o $@
%.pdf: %.md includes
./includes < $< | $(PANDOC) -c -s -f $(IFORMAT) --latex-engine=xelatex $(FLAGS) -o $@
clean:
-rm $(CHAPTERS) $(HTML)