forked from sdiehl/kaleidoscope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (40 loc) · 1.39 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
PANDOC = pandoc
IFORMAT = markdown
FLAGS = --standalone --toc --highlight-style pygments
TEMPLATE = page.tmpl
STYLE = css/style.css
HTML = tutorial.html
PDF = tutorial.pdf
CC = gcc
CHAPTERS = chapter2 chapter3 chapter4 chapter5 chapter6 chapter7
OPTS = -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d
all: $(HTML)
# Examples
# --------
examples: $(CHAPTERS)
chapter2:
ghc $(OPTS) --make src/chapter2/*.hs -o chapter2
chapter3:
ghc $(OPTS) --make src/chapter3/*.hs -o chapter3
chapter4:
$(CC) -fPIC -shared src/chapter4/cbits.c -o src/chapter4/cbits.so
ghc $(OPTS) src/chapter4/cbits.so --make src/chapter4/*.hs -o chapter4
chapter5:
$(CC) -fPIC -shared src/chapter5/cbits.c -o src/chapter5/cbits.so
ghc $(OPTS) src/chapter5/cbits.so --make src/chapter5/*.hs -o chapter5
chapter6:
$(CC) -fPIC -shared src/chapter6/cbits.c -o src/chapter6/cbits.so
ghc $(OPTS) src/chapter6/cbits.so --make src/chapter6/*.hs -o chapter6
chapter7:
$(CC) -fPIC -shared src/chapter7/cbits.c -o src/chapter7/cbits.so
ghc $(OPTS) src/chapter7/cbits.so --make src/chapter7/*.hs -o chapter7
# Tutorial
# --------
preprocessor:
ghc $(OPTS) --make preprocessor.hs -o preprocessor
%.html: %.md
./preprocessor < $< | $(PANDOC) -c $(STYLE) --template $(TEMPLATE) -s -f $(IFORMAT) -t html $(FLAGS) -o $@
%.pdf: %.md
./preprocessor < $< | $(PANDOC) -f $(IFORMAT) --toc -o $@
clean:
-rm $(CHAPTERS) $(HTML)