-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
82 lines (62 loc) · 1.91 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
78
79
80
81
82
# Justin Lardinois [email protected]
# Makefile for oc
ASG = asg5
CPPHEADERS = astree.h auxlib.h lyutils.h oil-generator.h \
stringset.h symbol-table.h
CPPSOURCES = ${CPPHEADERS:.h=.cpp} main.cpp
DELIVERABLES = ${CPPHEADERS} ${CPPSOURCES} ${LSOURCE} ${YSOURCE} \
Makefile README
GEN = ${LCPPGEN} ${YCPPGEN} ${YHGEN}
GPP = g++ -g -O0 -Wall -Wextra -std=gnu++11
LCPPGEN = yylex.cpp
LCPPGENO = ${LCPPGEN:.cpp=.o}
LSOURCE = scanner.l
OBJECTS = ${CPPSOURCES:.cpp=.o} ${LCPPGENO} ${YCPPGENO}
YCPPGEN = yyparse.cpp
YCPPGENO = yyparse.o
YHGEN = yyparse.h
YSOURCE = parser.y
all: oc
oc: ${OBJECTS}
${GPP} -o $@ $^
astree.o: astree.cpp astree.h auxlib.h lyutils.h stringset.h ${YHGEN}
${GPP} -c $<
auxlib.o: auxlib.cpp auxlib.h
${GPP} -c $<
lyutils.o: lyutils.cpp lyutils.h astree.h auxlib.h ${YHGEN}
${GPP} -c $<
oil-generator.o: oil-generator.cpp oil-generator.h astree.h
${GPP} -c $<
main.o: main.cpp auxlib.h lyutils.h oil-generator.h stringset.h
${GPP} -c $<
stringset.o: stringset.cpp stringset.h
${GPP} -c $<
symbol-table.o: symbol-table.cpp symbol-table.h astree.h yyparse.h
${GPP} -c $<
# three levels of hacks:
# piping to grep to skip flex's diagnostic ouput
# ORing with true so make ignores grep's exit status
# supressing echoing and then echoing a pretty command
${LCPPGEN}: ${LSOURCE}
@ echo "flex --outfile=${LCPPGEN} $<" && \
flex --outfile=${LCPPGEN} $< |& \
grep -v -e "^ " -e "^flex version" || true
${LCPPGENO}: ${LCPPGEN}
${GPP} -w -c $<
${YCPPGEN} ${YHGEN}: ${YSOURCE}
bison --defines=${YHGEN} --output=${YCPPGEN} ${YSOURCE}
${YCPPGENO}: ${YCPPGEN} ${YHGEN}
${GPP} -w -c $<
clean:
rm ${OBJECTS} ${GEN} *.output
spotless: clean
rm oc
ci: .git ${DELIVERABLES}
git add $(filer-out $<,$^)
git commit
.git:
git init
deps:
submit: ${DELIVERABLES}
checksource $^
submit cmps104a-wm.s15 ${ASG} $^