# Makefile for CSCI410 Program 3 # 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 testsemant # creates a semantic analyzer and links it with a lexical analyzer and # a parser. # # gmake testSymTab # creates a test driver for the SymTab class. Look at testSymTab.cc # for examples of how to use SymTab. Compile and run this to see how # the member functions behave. # # 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 ESPRSEMHOME= $(ESPRHOME)/semant CXX=g++ CXXFLAGS= -g -Wall -Wno-unused # flex flags FFLAGS= -oespresso-lex.cc # bison flags BFLAGS = -d -v --debug #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 testsemant: $(SOBJS) $(CXX) $(CXXFLAGS) $(SOBJS) -o $@ testSymTab: $(SYOBJS) $(CXX) $(CXXFLAGS) $(SYOBJS) -o $@ 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 testSymTab.o: SymTab.h SymTab.i StringTab.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 $(ESPRSEMHOME)/Makefile . -ln -s $(ESPRSEMHOME)/SError.cc . -ln -s $(ESPRSEMHOME)/SError.h . -ln -s $(ESPRSEMHOME)/StringTab.cc . -ln -s $(ESPRSEMHOME)/StringTab.h . -ln -s $(ESPRSEMHOME)/SymTab.h . -ln -s $(ESPRSEMHOME)/SymTab.i . -ln -s $(ESPRSEMHOME)/lexer.h -ln -s $(ESPRSEMHOME)/parser.h . -ln -s $(ESPRSEMHOME)/printToken.cc . -ln -s $(ESPRSEMHOME)/printToken.h . -ln -s $(ESPRSEMHOME)/astDump.cc . -ln -s $(ESPRSEMHOME)/testSymTab.cc . -ln -s $(ESPRSEMHOME)/testlexer.cc -ln -s $(ESPRSEMHOME)/testparser.cc -ln -s $(ESPRSEMHOME)/testsemant.cc . -$(ESPRHOME)/bin/safecopy $(ESPRSEMHOME)/README . -$(ESPRHOME)/bin/safecopy $(ESPRSEMHOME)/TestBad.esp . -$(ESPRHOME)/bin/safecopy $(ESPRSEMHOME)/Test.esp . -$(ESPRHOME)/bin/safecopy $(ESPRSEMHOME)/ast.h . -$(ESPRHOME)/bin/safecopy $(ESPRSEMHOME)/semant.cc -$(ESPRHOME)/bin/safecopy $(ESPRSEMHOME)/semant.h ################ SUBMIT RULE ################ ## you will have to change the submit command if you want to ## submit additional files. submit: submit -user csci410 -tag PA3 ast.h semant.h semant.cc Test.esp TestBad.esp README