CS143-Lab/assignments/PA2/Makefile
2023-03-23 04:54:42 +00:00

76 lines
1.4 KiB
Makefile

ASSN = 2
CLASS= cs143
CLASSDIR= ../..
LIB= -lfl
SRC= cool.flex test.cl README
CSRC= lextest.cc utilities.cc stringtab.cc handle_flags.cc
TSRC= mycoolc
HSRC=
CGEN= cool-lex.cc
HGEN=
LIBS= parser semant cgen
CFIL= ${CSRC} ${CGEN}
LSRC= Makefile
OBJS= ${CFIL:.cc=.o}
OUTPUT= test.output
TESTCASE=
CPPINCLUDE= -I. -I${CLASSDIR}/include/PA${ASSN} -I${CLASSDIR}/src/PA${ASSN}
FFLAGS= -d -ocool-lex.cc
CC=g++
CFLAGS= -g -Wall -Wno-unused -Wno-write-strings -std=c++11 ${CPPINCLUDE}
FLEX=flex ${FFLAGS}
DEPEND = ${CC} -MM ${CPPINCLUDE}
source : ${SRC} ${TSRC} ${LSRC} ${LIBS} lsource
lsource: ${LSRC}
${OUTPUT}: lexer test.cl
@rm -f test.output
-./lexer test.cl >test.output 2>&1
lexer: ${OBJS}
${CC} ${CFLAGS} ${OBJS} ${LIB} -o lexer
.cc.o:
${CC} ${CFLAGS} -c $<
cool-lex.cc: cool.flex
${FLEX} cool.flex
dotest: lexer test.cl
./lexer test.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} lexer cool-lex.cc *~ parser cgen semant
clean-compile:
@-rm -f core ${OBJS} cool-lex.cc ${LSRC}
%.d: %.cc ${SRC} ${LSRC}
${SHELL} -ec '${DEPEND} $< | sed '\''s/\($*\.o\)[ :]*/\1 $@ : /g'\'' > $@'
-include ${CFIL:.cc=.d}
comparetest: lexer
${CLASSDIR}/bin/lexer ${TESTCASE} > std.out
./lexer ${TESTCASE} > my.out
diff my.out std.out
rm my.out std.out