-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (24 loc) · 861 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
# To use the compiler:
# protoc --plugin=protoc-gen-js=./protoc-gen-js --js_out=. myfile.proto
PROTOC = protoc
CC = g++
PROTODIR = proto
CFLAGS = -I $(PROTODIR)
LDLIBS = -lprotobuf -lprotoc
OPTIONS_SRC = options.pb.cc
JAVA_TARGET = protoc-gen-jsonjava
JAVA_SOURCES = java_generator.cc util.cc $(OPTIONS_SRC)
JAVA_OBJECTS = $(subst .cc,.o,$(JAVA_SOURCES))
all: $(JAVA_TARGET)
$(JAVA_TARGET): $(JAVA_OBJECTS)
$(CC) -o $(JAVA_TARGET) $(JAVA_OBJECTS) $(LDLIBS)
$(OPTIONS_SRC): $(PROTODIR)/options.proto
$(PROTOC) -I $(PROTODIR) --cpp_out=. $(PROTODIR)/options.proto
java_generator.cc: $(OPTIONS_SRC)
example: $(JAVA_TARGET)
$(PROTOC) -I $(PROTODIR) --plugin=protoc-gen-jsonjava --java_out=. --jsonjava_out=. $(PROTODIR)/example.proto
.PHONY: clean example
clean:
rm -f *.o options.pb.h options.pb.cc $(JAVA_TARGET)
%.o: %.cc
$(CC) $(CFLAGS) -c $<