# Makefile for CSCI410 Program 4 # You probably won't need to change this file. # # Useful commands to use with this Makefile: # # gmake getfiles # copies or links necessary assignment files to your current directory. # see comments near the bottom of the file for more details. # Generally you should not make and modify a local copy of the shared # files. # # gmake espc # creates an Espresso compiler, linking together code generator, # semantic analyzer, parser and lexical analyzer # # gmake testemit # creates program that emits a few MIPS instructions. The code testemit.cc # is an example of how to use the provided emit and related routines. # When you run testemit, you can use it's output as a spim program. # See comments in testemit.cc for details. # # gmake testsemant # creates a semantic analyzer and links it with a lexical analyzer and # a parser. # # gmake testparser # creates a parser and links it with a lexical analyzer and a test program # # gmake testlexer # creates a lexical analyzer and links it with a test program # # # gmake submit # submit your completed PA3 to the course account ESPRHOME= /auto/home-scf-05/csci410/espresso ESPRCGENHOME= $(ESPRHOME)/codegen CXX=g++ CXXFLAGS= -g -Wall -Wno-unused # flex flags FFLAGS= -oespresso-lex.cc # bison flags BFLAGS = -d -v --debug #objs for espc ESP_OBJS = espc.o codegen.o emit.o semant.o StringTab.o astDump.o espresso-lex.o espresso-parse.o SError.o printToken.o #objs for testemit EOBJS = emit.o testemit.o #objs for testsemant SOBJS = testsemant.o semant.o StringTab.o astDump.o espresso-lex.o espresso-parse.o SError.o printToken.o #objs for testsymtab. no SymTab.o, because it's a template class SYOBJS = testSymTab.o StringTab.o # objs for testparser POBJS = testparser.o espresso-parse.o astDump.o StringTab.o espresso-lex.o printToken.o #objs for testlexer LOBJS = testlexer.o espresso-lex.o printToken.o StringTab.o espc: $(ESP_OBJS) $(CXX) $(CXXFLAGS) $(ESP_OBJS) -o $@ testemit: $(EOBJS) $(CXX) $(CXXFLAGS) $(EOBJS) -o $@ testsemant: $(SOBJS) $(CXX) $(CXXFLAGS) $(SOBJS) -o $@ testSymTab: $(SYOBJS) $(CXX) $(CXXFLAGS) $(SYOBJS) -o $@ espc.o: ast.h SymTab.h SymTab.i semant.h emit.h codegen.h StringTab.h parser.h codegen.o: codegen.h emit.h ast.h semant.h SymTab.h SymTab.i parser.h emit.o testemit.o: emit.h testsemant.o: ast.h parser.h SymTab.h StringTab.h SymTab.i semant.h SError.h semant.o: ast.h parser.h SymTab.h StringTab.h SymTab.i SError.h semant.h SError.o: SError.h ast.h parser.h testparser: $(POBJS) $(CXX) $(CXXFLAGS) $(POBJS) -o $@ StringTab.o: StringTab.h astDump.o: ast.h parser.h StringTab.h testparser.o: ast.h parser.h espresso-parse.o: ast.h parser.h printToken.h StringTab.h espresso-lex.o: espresso.tab.h parser.h lexer.h StringTab.h printToken.h testlexer.o: StringTab.h espresso.tab.h printToken.h lexer.h parser.h espresso-parse.cc espresso.tab.h: espresso.y bison ${BFLAGS} espresso.y mv -f espresso.tab.c espresso-parse.cc printToken.o: printToken.h testlexer: $(LOBJS) $(CXX) $(CXXFLAGS) $(LOBJS) -o $@ espresso-lex.cc: espresso.flex flex $(FFLAGS) espresso.flex # gmake getfiles # Uses shared copies of files for source code you # do not modify. This means if we change the master version, you will # get the change as well. # Makes local copies of the files you will modify. # Safe to use more than once: Does not overwrite any existing # files in your directory with the same name. # If you are on a different architecture than Solaris, you # will need to make local copies of the source code, and compile # them on your machine. # getfiles: -ln -s $(ESPRCGENHOME)/Makefile . -ln -s $(ESPRCGENHOME)/SError.cc . -ln -s $(ESPRCGENHOME)/SError.h . -ln -s $(ESPRCGENHOME)/StringTab.cc . -ln -s $(ESPRCGENHOME)/StringTab.h . -ln -s $(ESPRCGENHOME)/SymTab.h . -ln -s $(ESPRCGENHOME)/SymTab.i . -ln -s $(ESPRCGENHOME)/lexer.h -ln -s $(ESPRCGENHOME)/parser.h . -ln -s $(ESPRCGENHOME)/printToken.cc . -ln -s $(ESPRCGENHOME)/printToken.h . -ln -s $(ESPRCGENHOME)/astDump.cc . -ln -s $(ESPRCGENHOME)/testlexer.cc -ln -s $(ESPRCGENHOME)/testparser.cc -ln -s $(ESPRCGENHOME)/testsemant.cc . -ln -s $(ESPRCGENHOME)/testemit.cc . -ln -s $(ESPRCGENHOME)/espc.cc . -ln -s $(ESPRCGENHOME)/emit.h . -ln -s $(ESPRCGENHOME)/emit.cc . -$(ESPRHOME)/bin/safecopy $(ESPRCGENHOME)/README . -$(ESPRHOME)/bin/safecopy $(ESPRCGENHOME)/Test.esp . -$(ESPRHOME)/bin/safecopy $(ESPRCGENHOME)/codegen.h -$(ESPRHOME)/bin/safecopy $(ESPRCGENHOME)/codegen.cc ################ SUBMIT RULE ################ ## you will have to change the submit command if you want to ## submit additional files. submit: submit -user csci410 -tag PA4 ast.h semant.h semant.cc codegen.h codegen.cc Test.esp README