-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (43 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
#
# Makefile for TINY
# Gnu C Version
# K. Louden 2/3/98
#
CC = gcc
CFLAGS = -g
OBJS = main.o util.o scan.o parse.o symtab.o analyze.o code.o cgen.o
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
fl = -ll
else
fl = -lfl
endif
cminus: $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o cminus
parse.c y.tab.h: yacc/cminus.y
yacc -d -t -v yacc/cminus.y
mv y.tab.c parse.c
main.o: main.c globals.h util.h scan.h y.tab.h
$(CC) $(CFLAGS) -c main.c
util.o: util.c util.h globals.h
$(CC) $(CFLAGS) -c util.c
scan.o: scan.c scan.h util.h globals.h
$(CC) $(CFLAGS) -c scan.c
parse.o: parse.c parse.h scan.h globals.h util.h
$(CC) $(CFLAGS) -c parse.c
symtab.o: symtab.c symtab.h
$(CC) $(CFLAGS) -c symtab.c
analyze.o: analyze.c globals.h symtab.h analyze.h
$(CC) $(CFLAGS) -c analyze.c
code.o: code.c code.h globals.h
$(CC) $(CFLAGS) -c code.c
cgen.o: cgen.c globals.h symtab.h code.h cgen.h
$(CC) $(CFLAGS) -c cgen.c
clean:
-rm cminus
-rm tm
-rm $(OBJS)
-rm y.tab.h parse.c y.output
tm: tm.c
$(CC) $(CFLAGS) tm.c -o tm
all: cminus tm