CS143-Lab/assignments/PA5/Makefile
2023-03-27 19:21:05 +08:00

78 lines
1.6 KiB
Makefile

ASSN = 5
CLASS= cs143
CLASSDIR= ../..
LIB= -L/usr/pubsw/lib -lfl
AR= gar
ARCHIVE_NEW= -cr
RANLIB= gar -qs
SRC= cgen.cc cgen.h cgen_supp.cc cool-tree.h cool-tree.handcode.h emit.h example.cl README
CSRC= cgen-phase.cc utilities.cc stringtab.cc dumptype.cc tree.cc cool-tree.cc ast-lex.cc ast-parse.cc handle_flags.cc
TSRC= mycoolc
CGEN=
HGEN=
LIBS= lexer parser semant
CFIL= cgen.cc cgen_supp.cc ${CSRC} ${CGEN}
LSRC= Makefile
OBJS= ${CFIL:.cc=.o}
OUTPUT= good.output bad.output
CPPINCLUDE= -I. -I${CLASSDIR}/include/PA${ASSN} -I${CLASSDIR}/src/PA${ASSN}
FFLAGS = -d8 -ocool-lex.cc
BFLAGS = -d -v -y -b cool --debug -p cool_yy
CC=g++
CFLAGS=-g -Wall -Wno-unused -Wno-write-strings -Wno-deprecated ${CPPINCLUDE} -DDEBUG -std=c++11
FLEX=flex ${FFLAGS}
BISON= bison ${BFLAGS}
DEPEND = ${CC} -MM ${CPPINCLUDE}
source: ${SRC} ${TSRC} ${LIBS} lsource
lsource: ${LSRC}
${OUTPUT}: cgen
@rm -f ${OUTPUT}
./mycoolc example.cl >example.output 2>&1
compile: cgen change-prot
change-prot:
@-chmod 660 ${SRC} ${OUTPUT}
cgen: ${OBJS} parser semant
${CC} ${CFLAGS} ${OBJS} ${LIB} -o cgen
.cc.o:
${CC} ${CFLAGS} -c $<
dotest: cgen example.cl
@echo "\nRunning code generator on example.cl\n"
-./mycoolc example.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 parser semant lexer *~ *.a *.o
clean-compile:
@-rm -f core ${OBJS} ${LSRC}
%.d: %.cc ${SRC}
${SHELL} -ec '${DEPEND} $< | sed '\''s/\($*\.o\)[ :]*/\1 $@ : /g'\'' > $@'
-include ${CFIL:.cc=.d}