summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b444d41
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,31 @@
+JAVAC = javac
+ANTLR_COMPLETE = lib/antlr-4.13.1-complete.jar
+JAVAC_FLAGS = -cp $(ANTLR_COMPLETE) -Xlint:deprecation -d out
+SRC_DIR = src
+BIN_DIR = out
+MAIN_CLASS = Main
+SOURCES = $(wildcard $(SRC_DIR)/*.java)
+GRAMMARS = $(SRC_DIR)/Python3Lexer.g4 $(SRC_DIR)/Python3Parser.g4
+ANTLR_OUTPUT = $(SRC_DIR)/Python3Lexer.java $(SRC_DIR)/Python3Parser.java $(SRC_DIR)/Python3ParserListener.java $(SRC_DIR)/Python3ParserBaseListener.java
+DATE = $(shell date +%Y%m%d-%H%M%S)
+ARGS =
+
+all: $(SOURCES) $(ANTLR_OUTPUT)
+ $(JAVAC) $(JAVAC_FLAGS) $^
+
+$(ANTLR_OUTPUT): $(GRAMMARS)
+ java -jar lib/antlr-4.13.1-complete.jar $^
+
+run:
+ java -cp $(ANTLR_COMPLETE):$(BIN_DIR) $(MAIN_CLASS) $(ARGS)
+
+runall:
+ java -cp $(ANTLR_COMPLETE):$(BIN_DIR) ParseAll $(ARGS)
+
+clean:
+ rm -rf $(BIN_DIR)/* trees/*
+
+release: clean
+ zip -r ../python3-miniparser-$(DATE).zip .
+
+.PHONY: all run clean release runall