-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
51 lines (38 loc) · 882 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# t expects you have at least some version of gcc installed:
C=$(shell env env which gcc-11||which gcc-10||env which gcc-9||env which gcc-8||echo gcc)
O=-O2 -W -Wno-variadic-macros -Wno-dollar-in-identifier-extension -Wno-empty-body
T=in/x.in
all: clean c t y
./c $T > o/c.out
./t $T > o/t.out
diff o/c.out o/t.out
time: clean c t y
time ./c $T > o/c.out
time ./t $T > o/t.out
time ./y $T > o/y.out
c: c.c c.h
$C $O $@.c -o $@
t: t.c t.h
$C $O $@.c -o $@
y: g y.y
yacc y.y && $C $O y.tab.c -o $@
g:
yacc y.y
$C y.tab.c
$C -E y.tab.c |grep -v '^# *[0-9]'|indent -st -l180 |sed -e 's/\<_T/_ T/g' > y.c
$C -ggdb3 y.c -o y
# brackets (should fail)
b: c
./c in/xxx.in
# numerals
bb: c
./c in/xxxx.in
# literals
bbb: c
./c in/xxxxx.in
# strings
bbbb: c
./c in/xxxxxx.in
clean:
rm -rf o c t y && mkdir o
.PHONY:all rpn b c t y t clean