-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (59 loc) · 1.46 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
CC = cc
CFLAGS = -Wall -g
.PHONY: test
test: scheme
@mkdir -p temp
./scheme pro99.scm > temp/output
diff temp/output test/pro99.out
scheme : scheme.c
clang-format -i $<
awk -i inplace -f scripts/fmt.awk $<
awk -i inplace -f scripts/codegen.awk $<
$(CC) $(CFLAGS) $^ -o $@
temp/autogen.c : scheme.c scripts/codegen.awk
@mkdir -p temp
awk -f scripts/codegen.awk $< > $@
.PHONY: all
all: clean test README.md
.PHONY: clean
clean:
rm -f scheme
rm -f temp/output
rm -f temp/*.c
rm -rf leanpub
README.md: scheme scheme.c
awk -f scripts/cut.awk scheme.c > $@
awk -i inplace -f scripts/markdown.awk $@
awk -i inplace -f scripts/compact.awk $@
.PHONY: leanpub
leanpub:
@mkdir -p leanpub
awk -f scripts/leanpub.awk README.md
gaps: temp/cut.c
make temp/cut 2>&1 | awk -f scripts/gaps.awk | tee $@
temp/cut : temp/cut.c
$(CC) $(CFLAGS) $< -o $@
temp/cut.c : scheme.c
@mkdir -p temp
awk -f scripts/cut.awk $< > $@
awk -i inplace -f scripts/codegen.awk $@
.PHONY: push
push: all
git add .
git commit -m 'Tweaks'
git push wip master
.PHONY: pull
pull:
git pull --rebase wip master
grind: scheme
valgrind ./scheme pro99.scm
grind_leaks: scheme
valgrind --leak-check=full --show-leak-kinds=all ./scheme pro99.scm
profile.txt: scheme pro99.scm
rm -f callgrind.out.*
valgrind --tool=callgrind ./scheme pro99.scm
callgrind_annotate --tree=both > profile.txt
.PHONY: grammar
grammar: README.md scripts/grammar.awk
mkdir -p temp
awk -f scripts/grammar.awk $<