forked from ooc-lang/greg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
63 lines (44 loc) · 1.29 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
CFLAGS = -g -Wall $(OFLAGS) $(XFLAGS)
OFLAGS = -O3 -DNDEBUG
#OFLAGS = -pg
TOOL=valgrind -q
OBJS = tree.o compile.o
all : greg
greg : greg.o $(OBJS)
$(CC) $(CFLAGS) -o $@-new greg.o $(OBJS)
mv $@-new $@
ROOT =
PREFIX = /usr
BINDIR = $(ROOT)$(PREFIX)/bin
install : $(BINDIR)/greg
$(BINDIR)/% : %
cp -p $< $@
strip $@
uninstall : .FORCE
rm -f $(BINDIR)/greg
greg.o : greg.c
grammar : .FORCE
./greg -o greg.c greg.g
clean : .FORCE
rm -rf *~ *.o *.greg.[cd] greg samples/*.o samples/calc samples/*.dSYM testing1.c testing2.c *.dSYM selftest/
spotless : clean .FORCE
rm -f greg
samples/calc.c: samples/calc.g greg
./greg -o $@ $<
samples/calc: samples/calc.c
$(CC) $(CFLAGS) -o $@ $<
test: samples/calc
echo '21 * 2 + 0' | ./samples/calc | grep 42
run: greg.g greg
mkdir -p selftest
./greg -o testing1.c greg.g
$(CC) $(CFLAGS) -o selftest/testing1 testing1.c $(OBJS)
$(TOOL) ./selftest/testing1 -o testing2.c greg.g
$(CC) $(CFLAGS) -o selftest/testing2 testing2.c $(OBJS)
$(TOOL) ./selftest/testing2 -o selftest/test.c test.g
$(CC) $(CFLAGS) -o selftest/test selftest/test.c
$(TOOL) echo 'foobar' | ./selftest/test
$(TOOL) ./selftest/testing2 -o selftest/calc.c ./samples/calc.g
$(CC) $(CFLAGS) -o selftest/calc selftest/calc.c
$(TOOL) echo '21 * 2 + 0' | ./selftest/calc | grep 42
.FORCE :