-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (46 loc) · 1.02 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
CFLAGS = -g -Wall $(OFLAGS) $(XFLAGS)
OFLAGS = -O3 -DNDEBUG
#OFLAGS = -pg
OBJS = tree.o compile.o
all : peg leg
peg : peg.o $(OBJS)
$(CC) $(CFLAGS) -o $@-new peg.o $(OBJS)
mv $@-new $@
leg : leg.o $(OBJS)
$(CC) $(CFLAGS) -o $@-new leg.o $(OBJS)
mv $@-new $@
ROOT =
PREFIX = /usr/local
BINDIR = $(ROOT)$(PREFIX)/bin
install : $(BINDIR)/peg $(BINDIR)/leg
$(BINDIR)/% : %
cp -p $< $@
strip $@
uninstall : .FORCE
rm -f $(BINDIR)/peg
rm -f $(BINDIR)/leg
peg.o : peg.c peg.peg-c
%.peg-c : %.peg compile.c
./peg -o $@ $<
leg.o : leg.c
leg.c : leg.leg compile.c
./leg -o $@ $<
check : check-peg check-leg
check-peg : peg .FORCE
./peg < peg.peg > peg.out
diff peg.peg-c peg.out
rm peg.out
check-leg : leg .FORCE
./leg < leg.leg > leg.out
diff leg.c leg.out
rm leg.out
test examples : .FORCE
$(SHELL) -ec '(cd examples; $(MAKE))'
clean : .FORCE
rm -f *~ *.o *.peg.[cd] *.leg.[cd]
$(SHELL) -ec '(cd examples; $(MAKE) $@)'
spotless : clean .FORCE
rm -f peg
rm -f leg
$(SHELL) -ec '(cd examples; $(MAKE) $@)'
.FORCE :