forked from ooc-lang/greg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (40 loc) · 1.15 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
CFLAGS = -g -Wall $(OFLAGS) $(XFLAGS)
OFLAGS = -O3 -DNDEBUG
#OFLAGS = -pg
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.leg greg
./greg -o $@ $<
samples/calc: samples/calc.c
$(CC) $(CFLAGS) -o $@ $<
test: samples/calc greg-testing
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/calc.c ./samples/calc.leg
$(CC) $(CFLAGS) -o selftest/calc selftest/calc.c
$(TOOL) echo '21 * 2 + 0' | ./selftest/calc | grep 42
.FORCE :