84 lines
1.9 KiB
Makefile
84 lines
1.9 KiB
Makefile
|
|
ASSN = 3
|
|
CLASS= cs143
|
|
CLASSDIR= ../..
|
|
LIB= -lfl
|
|
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/PA${ASSN} -I${CLASSDIR}/src/PA${ASSN}
|
|
|
|
BFLAGS = -d -v -y -b cool --debug -p cool_yy
|
|
|
|
CC=g++
|
|
CFLAGS=-g -Wall -Wno-unused -Wno-deprecated -Wno-write-strings -DDEBUG -std=c++11 ${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/PA${ASSN}/$@ $@
|
|
|
|
${HSRC}:
|
|
-ln -s ${CLASSDIR}/include/PA${ASSN}/$@ $@
|
|
|
|
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}
|
|
|
|
TESTCASE = good.cl
|
|
comparetest: parser
|
|
./stdparser ${TESTCASE} > std.out
|
|
./myparser ${TESTCASE} > my.out
|
|
diff std.out my.out
|
|
rm std.out my.out
|