-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (28 loc) · 914 Bytes
/
Makefile
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
32
33
34
35
36
JAVAC = javac
ANTLR_COMPLETE = lib/antlr-4.13.1-complete.jar
JAVAC_FLAGS = -cp $(ANTLR_COMPLETE) -Xlint:deprecation -d out
SRC_DIR = src
PARSER_DIR = src/parser
BIN_DIR = out
MAIN_CLASS = Main
PARSEALL_CLASS = ParseAll
SOURCES = $(wildcard $(SRC_DIR)/*.java $(SRC_DIR)/*/*.java $(SRC_DIR)/*/*/*.java)
GRAMMARS = $(PARSER_DIR)/Python3Lexer.g4 $(PARSER_DIR)/Python3Parser.g4
ANTLR_OUTPUT = $(PARSER_DIR)/*.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 $^
build:
$(JAVAC) $(JAVAC_FLAGS) $(SOURCES)
run:
java -cp $(ANTLR_COMPLETE):$(BIN_DIR) $(MAIN_CLASS) $(ARGS)
runall:
java -cp $(ANTLR_COMPLETE):$(BIN_DIR) $(PARSEALL_CLASS) $(ARGS)
clean:
rm -rf $(BIN_DIR)/* trees/*
release: clean
zip -r ../python3-miniparser-$(DATE).zip .
.PHONY: all build run clean release runall