-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
123 lines (88 loc) · 2.63 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
uni: uni.cpp
clang++ -std=c++11 -O3 -Wall -Wno-unused-function $^ -o $@
unid: uni.cpp
clang++ -std=c++11 -O3 -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-unused-function -DLOG -fsanitize=memory -g $^ -o $@
unip: uni.cpp
clang++ -std=c++11 -O3 -Wall -Wno-unused-function -lprofiler -g $^ -o $@
mv unip uni
unic: uni.c
gcc -std=c99 -O3 -DM=1000000 $^ -o $@
unic.pg: uni.c
gcc -std=c99 -DM=1000000 -pg $^ -o $@
unicd: uni.c
gcc -std=c99 -Wall -DM=1000000 -DLOG $^ -o $@
# lam -> lc -> blc -> Blc
%.sym.lc: ioccc/symbolic.Blc %.blc
cat $^ | ./uni | head -1 > $@
%.dec.lc: decode.scm %.blc
cat $(word 2,$^) | guile $(word 1,$^) > $@
%.lc: %.lam
gcc -E -x c -P $^ | awk -f rename.awk > $@
%.inf.blc: ioccc/inflate.Blc %.Blc
cat $+ | ./uni > $@
%.blc: ioccc/parse.Blc %.lc
cat $^ | ./uni > $@
%.blc2: encode.scm %.lam
gcc -E -x c -P $(word 2,$^) | guile $(word 1,$^) > $@
%.Blc: ioccc/deflate.Blc %.blc
cat $^ | ./uni > $@
%.b: %.blc
cat $^ binary | ./uni -b | head -c 10
@echo
%.B: %.Blc
cat $^ bytes | ./uni
@echo
%.bi: %.blc
(cat $^; cat -) | ./uni -b
@echo
%.Bi: %.Blc
(cat $^; cat -) | ./uni
@echo
%.reduce: symbolic.Blc %.blc
cat $^ | ./uni
hilbert:
(cat hilbert.Blc; echo -n 1024) | ./uni
primes.dec: primes.blc
(cat oddindices.Blc; echo -n " "; cat $^ | ./uni -b) | ./uni | head -c 70
primes.bin: primes.blc
cat $^ | ./uni -b | head -c 70
hw_in_bf: bf.Blc hw.bf
cat $^ | ./uni
quine: quine.blc
@cat $^ $^
@echo
@cat $^ $^ | ./uni -b
reduction: symbolic.Blc 2exp3.blc
cat $^ | ./uni
trace.b: id.blc unid
(cat $<; echo -n 10) | ./unid -b 2> $@
trace.B: id.Blc unid
(cat $<; echo -n 10) | ./unid 2> $@
debug: test.blc unid
(cat $<; echo -n 10) | ./unid -b 2> $@
test_opt: uni unid primes.blc
(cat oddindices.Blc; echo -n " "; cat primes.blc | ./uni -b) | ./uni | head -c 70
@echo
(cat oddindices.Blc; echo -n " "; cat primes.blc | ./uni -b -o) | ./uni -o | head -c 70
@echo
(cat hilbert.Blc; echo -n 12) | ./unid 2> debug.orig
(cat hilbert.Blc; echo -n 12) | ./unid -o 2> debug.opt
%.encode: %.blc %.blc2
diff $*.blc $*.blc2
test_encode:
for i in *.lam; do make `basename $$i .lam`.encode; done
%.decode: %.blc %.dec.lc
cat $(word 2,$^) | guile encode.scm > $*.decode
diff $(word 1,$^) $*.decode
rm $*.decode $*.blc
test_decode:
for i in *.lam; do make `basename $$i .lam`.decode; done
bench:
/usr/bin/time -v make bench_uni
/usr/bin/time -v make bench_opt
bench_uni: uni1.blc primes.blc uni
@cat uni1.blc uni1.blc uni1.blc uni1.blc primes.blc | ./uni -b | head -c 70
@echo
bench_opt: uni1.blc primes.blc uni
@cat uni1.blc uni1.blc uni1.blc uni1.blc primes.blc | ./uni -b -o | head -c 70
@echo