aboutsummaryrefslogtreecommitdiffstats
path: root/utils/Burg/Makefile
blob: c22bd552e8453178f316504b2e34bd034cd62774 (plain)
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
# $Id$

LEVEL = ../..

UNAME := $(shell uname)
include $(LEVEL)/Makefile.config
include $(LEVEL)/Makefile.$(UNAME)

TARGET = burg.$(UNAME)

#CFLAGS	=
#CFLAGS	= -O
#CFLAGS	= -O -DNOLEX
CFLAGS	= -g -DDEBUG
#CFLAGS	= -g -DNOLEX -DDEBUG

SRCS = \
	be.c \
	burs.c \
	closure.c \
	delta.c \
	fe.c \
	item.c \
	lex.c \
	list.c \
	main.c \
	map.c \
	nonterminal.c \
	operator.c \
	pattern.c \
	plank.c \
	queue.c \
	rule.c \
	string.c \
	symtab.c \
	table.c \
	trim.c \
	zalloc.c

BU_OBJS = \
	burs.o \
	closure.o \
	delta.o \
	item.o \
	list.o \
	map.o \
	nonterminal.o \
	operator.o \
	pattern.o \
	queue.o \
	rule.o \
	table.o \
	trim.o \
	zalloc.o

BU_OBJS := $(addprefix $(UNAME)/,$(BU_OBJS))

FE_OBJS = \
	be.o \
	fe.o \
	lex.o \
	main.o \
	plank.o \
	string.o \
	symtab.o \
	y.tab.o

FE_OBJS := $(addprefix $(UNAME)/,$(FE_OBJS))

all: $(TARGET)


$(TARGET): $(BU_OBJS) $(FE_OBJS)
	$(CC) -o $(TARGET) $(CFLAGS) $(BU_OBJS) $(FE_OBJS)

y.tab.c y.tab.h: gram.y
	yacc -d gram.y

clean:
	rm -rf $(UNAME) *.o y.tab.h y.tab.c core burg *.aux *.log *.dvi sample sample.c tmp

$(FE_OBJS):	b.h
$(BU_OBJS):	b.h
$(FE_OBJS):	fe.h

lex.o:	y.tab.h

doc.dvi: doc.tex
	latex doc; latex doc

$(UNAME)/%.o: %.c
	$(VERB) $(CC) -c -g $< -o $@

test: $(TARGET) sample.gr
	./$(TARGET) -I     <sample.gr   >sample.c && cc $(CFLAGS) -o sample sample.c && ./sample
	./$(TARGET) -I      sample.gr   >tmp && cmp tmp sample.c
	./$(TARGET) -I     <sample.gr -o tmp && cmp tmp sample.c
	./$(TARGET) -I      sample.gr -o tmp && cmp tmp sample.c
	./$(TARGET) -I -O0 <sample.gr   >tmp && cmp tmp sample.c
	./$(TARGET) -I -=  <sample.gr   >tmp && cmp tmp sample.c