-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
38 lines (28 loc) · 1.05 KB
/
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
37
38
.POSIX:
.SUFFIXES:
BUILD = build
CLASSPATH = ".:$(BUILD):/usr/share/java/protobuf.jar"
PACKAGE = com.rapczak.taeber.protobuf
SOURCE = com/rapczak/taeber/protobuf
OUTPUT = $(BUILD)/$(SOURCE)
all: tests
tests: compile
java -cp $(CLASSPATH) $(PACKAGE).Tests
compile: preprocessor $(OUTPUT)/Tests.class
$(OUTPUT)/Tests.class: $(SOURCE)/Tests.java $(OUTPUT)/Triples.java
javac -cp $(CLASSPATH) -d $(BUILD) -processor $(PACKAGE).ProtobufTemplateProcessor $(SOURCE)/Tests.java
$(OUTPUT)/Triples.java: $(BUILD)/protoc $(SOURCE)/triples.proto
protoc --java_out=$(BUILD) $(SOURCE)/triples.proto
preprocessor: $(OUTPUT)/ProtobufTemplateProcessor.class
$(OUTPUT)/ProtobufTemplateProcessor.class: $(SOURCE)/ProtobufTemplateProcessor.java $(SOURCE)/ProtobufTemplate.java
javac -cp $(CLASSPATH) -d $(BUILD) $^
$(BUILD):
mkdir -p $(BUILD)
$(BUILD)/protoc: $(BUILD)
which protoc || sudo apt install protobuf-compiler libprotobuf-java
touch $(BUILD)/protoc
clean:
rm -rf $(BUILD)
@echo ''
@echo Do you need to uninstall protoc?
@echo ' sudo apt remove protobuf-compiler'