-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (56 loc) · 1.56 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
66
67
68
69
70
71
72
73
74
75
CFLAGS = -c -g -DDEBUG
TARGET = mas
CC = /usr/bin/gcc
MAKE = /usr/bin/make
#OBJS = y.tab.o lex.yy.o lextest.o keyword.o
#OBJS = y.tab.o scanner.o lextest.o keyword.o
#OBJS = y.tab.o scanner.o keyword.o yacctest.o
COMMON = y.tab.o keyword.o util.o interface.o ast.o string.o visitor.o traversor.o \
error.o error_message.o native.o
#RUN = simpleeval.o simpleexec.o
RUN = eval.o exec.o
HEAP = string_pool.o heap.o
MEMORY = ./memory/memory.o ./memory/storage.o
OBJS = $(COMMON) $(MEMORY) $(RUN) $(HEAP) scanner.o
YTEST = yacctest.o
EXEC = main.o
LTEST = lextest.o
YACC = mas.y
#all2: scanner.c
# gcc -o scanner scanner.c
all: $(OBJS) $(EXEC)
$(MAKE) $@ -C memory
$(CC) -o $(TARGET) $^
variabletest: $(OBJS) variabletest.o
$(MAKE) all -C memory
$(CC) -o $@ $^
stringpooltest: $(OBJS) stringpooltest.o
$(MAKE) all -C memory
$(CC) -o $@ $^
errortest: $(MEMORY) error.o error_message.o errortestmain.o
$(MAKE) all -C memory
$(CC) -o $@ $^
stringtest: $(MEMORY) string.o interface.o util.o stringtest.o
$(MAKE) all -C memory
$(CC) -o $@ $^
asttest: $(OBJS) asttest.o
$(CC) -o $@ $^
scantest: stest ltest
./stest > output.s
./ltest > output.l
diff -Naru output.s output.l
stest: $(COMMON) $(MEMORY) $(LTEST) scanner.o
$(CC) -o $@ $^
ltest: $(COMMON) $(MEMORY) $(LTEST) lex.yy.o
$(CC) -o $@ $^
keyword.c: keyword.key
gperf -ptT $^ > $@
y.tab.c: $(YACC)
bison --yacc -dv $^
lex.yy.c: mas.l
flex $^
.c.o:
$(CC) $(CFLAGS) $*.c
clean:
$(MAKE) $@ -C memory
rm -rf *.o *~ y.tab.c lex.yy.c y.output y.tab.h keyword.c ltest stest output.s output.l $(TARGET)