summaryrefslogtreecommitdiff
path: root/Makefile
blob: b444d41bbe24fa07c10fb83cde250a50f1029ae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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