# This is the name of your program. The class dictionary file should # be $(PROG).cd, and the behavior file should be $(PROG).beh. PROG = department # This is the name of the class which has the "main" method. MAIN = Main # Package specification. To put your generated code into a package # named "foo.bar.baz", set the following variables like so: # # PACKAGE_PREFIX = foo.bar.baz. # PACKAGE_DIR = foo/bar/baz # # Note that PACKAGE_PREFIX always ends with a ".", but PACKAGE_DIR # never ends with a "/". Also, at the beginning of your .cd file (but # *not* your .beh file) put the following declaration: # # package foo.bar.baz; # PACKAGE_PREFIX = PACKAGE_DIR = . # Arguments for testing the program. TEST_ARGS = < $(PROG).input # Files the program test depends on. Probably some subset of $(TEST_ARGS). TEST_DEPS = $(PROG).input # Make sure these are all in your $PATH: # interpreter JAVA = java # compiler JAVAC = javac -d . # only use guavac if you have a lot of RAM!! # JAVAC = guavac -d . # Demeter compiler DEMJAVA = demjava # parser generator PARSEGEN = jack # Use this if you absolutely need a LR(1) parser. # PARSEGEN = java_cup #### # You shouldn't have to change anything below here. #### MAIN_TARGET = $(PACKAGE_DIR)/$(MAIN).class ifeq ($(PARSEGEN),jack) PARSEGEN_CMD = jack DEMJAVA += -jack GRAMMAR = $(PROG).jack PARSER = Parser.java PARSER_AUX = ParseError.java ParserConstants.java ParserTokenManager.java \ Token.java ASCII_CharStream.java else PARSEGEN_CMD = java_cup -compact_red < DEMJAVA += -cup GRAMMAR = $(PROG).cup PARSER = parser.java PARSER_AUX = sym.java lexer.java endif all: $(MAIN_TARGET) $(MAIN_TARGET): $(PROG).java $(PARSER) $(PARSER_AUX) $(JAVAC) $? touch $(MAIN_TARGET) $(PROG).java: $(PROG).cd $(PROG).beh $(DEMJAVA) -code $(PROG) $(PARSER): $(GRAMMAR) $(PARSEGEN_CMD) $^ $(GRAMMAR): $(PROG).cd $(DEMJAVA) -grammar $(PROG) $(PARSER_AUX): test: all $(TEST_DEPS) $(JAVA) $(PACKAGE_PREFIX)$(MAIN) $(TEST_ARGS) clean: $(RM) $(PACKAGE_DIR)/*.class $(PROG).java $(RM) $(GRAMMAR) $(PARSER) $(PARSER_AUX) $(RM) *~ core new: clean all .PHONY: all test clean new