-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
23 lines (19 loc) · 683 Bytes
/
Copy pathMakefile
File metadata and controls
23 lines (19 loc) · 683 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Change the src to the path of your java source files
JAVA_SRC = $(shell find src -name '*.java')
# Change this to the path of your antlr jar
ANTLR_JAR = /usr/share/java/antlr-4.12.0-complete.jar
ANTLR_G4 = $(shell find -name '*.g4')
G4_DIR = $(shell find -name '*.g4' | xargs dirname | uniq)
.PHONY: all
all: Compiler
.PHONY: Compiler
Compiler: $(JAVA_SRC) antlr-parser
javac -d bin $(JAVA_SRC) -cp $(ANTLR_JAR) -encoding UTF-8
# replace the antlr4 command with your own
.PHONY: antlr-parser
antlr-parser: $(ANTLR_G4)
antlr4 $^ -visitor -listener -package grammar
.PHONY: clean
clean:
rm -f $(G4_DIR)/*.java $(G4_DIR)/*.tokens $(G4_DIR)/*.interp
rm -f bin/*.class bin/*.jar