-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·77 lines (57 loc) · 1.69 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
76
77
ASSN = 3
CLASS= cs143
CLASSDIR= ../..
LIB=
AR= gar
ARCHIVE_NEW= -cr
RANLIB= gar -qs
SRC= cool.y cool-tree.handcode.h good.cl bad.cl README
CSRC= parser-phase.cc utilities.cc stringtab.cc dumptype.cc \
tree.cc cool-tree.cc tokens-lex.cc handle_flags.cc
TSRC= myparser mycoolc cool-tree.aps
CGEN= cool-parse.cc
HGEN= cool-parse.h
LIBS= lexer semant cgen
CFIL= ${CSRC} ${CGEN}
HFIL= cool-tree.h cool-tree.handcode.h
LSRC= Makefile
OBJS= ${CFIL:.cc=.o}
OUTPUT= good.output bad.output
CPPINCLUDE= -I. -I${CLASSDIR}/include/parser -I${CLASSDIR}/src/parser
BFLAGS = -d -v -y -b cool --debug -p cool_yy
CC=g++
CFLAGS=-g -Wall -Wno-unused -Wno-deprecated -Wno-write-strings -DDEBUG ${CPPINCLUDE}
FLEX=flex ${FFLAGS}
BISON= bison ${BFLAGS}
DEPEND = ${CC} -MM ${CPPINCLUDE}
source: ${SRC} ${TSRC} ${LIBS} lsource
lsource: ${LSRC}
${OUTPUT}: parser good.cl bad.cl
@rm -f ${OUTPUT}
./myparser good.cl >good.output 2>&1
-./myparser bad.cl >bad.output 2>&1
parser: ${OBJS}
${CC} ${CFLAGS} ${OBJS} ${LIB} -o parser
.cc.o:
${CC} ${CFLAGS} -c $<
cool-parse.cc cool-parse.h: cool.y
bison ${BFLAGS} cool.y
mv -f cool.tab.c cool-parse.cc
dotest: parser good.cl bad.cl
@echo "\nRunning parser on good.cl\n"
-./myparser good.cl
@echo "\nRunning parser on bad.cl\n"
-./myparser bad.cl
${LIBS}:
${CLASSDIR}/etc/link-object ${ASSN} $@
${TSRC} ${CSRC}:
-ln -s ${CLASSDIR}/src/parser/$@ $@
${HSRC}:
-ln -s ${CLASSDIR}/include/parser/$@ $@
clean :
-rm -f ${OUTPUT} *.s core ${OBJS} ${CGEN} ${HGEN} lexer parser cgen semant *~ *.a *.o
clean-compile:
@-rm -f core ${OBJS} ${CGEN} ${HGEN} ${LSRC}
%.d: %.cc ${LSRC}
${SHELL} -ec '${DEPEND} $< | sed '\''s/\($*\.o\)[ :]*/\1 $@ : /g'\'' > $@'
-include ${CFIL:.cc=.d}