summaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2018-09-01 15:21:58 +0000
committerMikael Magnusson <mikma@users.sourceforge.net>2021-01-20 16:41:32 +0000
commit3075254e73b113c1e4ce52936629fb73610a3e10 (patch)
tree3fb1940041e7b45d808d17318e3f6e8d67dc5432 /Makefile
parent35e733246e1aff6688f2e4f624c7a80be33fb7b9 (diff)
add Makefile for generating protobuf codemakefile
Use proto-gen-go, any.proto and empty.proto from vendor/github.com/golang/protobuf. Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
Diffstat (limited to 'Makefile')
-rwxr-xr-xMakefile25
1 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100755
index 00000000..eb4a3f9e
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,25 @@
+#
+# Use protoc-gen-go from pinned github.com/golang/protobuf.
+#
+PROTOC_GEN_GO_DIR:=vendor/github.com/golang/protobuf/protoc-gen-go
+PROTOC_GEN_GO:=$(PROTOC_GEN_GO_DIR)/protoc-gen-go
+PROTOCPLUGIN:=--plugin=$(PROTOC_GEN_GO)
+PROTOCFLAGS:=$(PROTOCPLUGIN) --go_out=plugins=grpc:api -I api
+
+PROTOC_SRC:= \
+ api/attribute.proto \
+ api/capability.proto \
+ api/gobgp.proto
+
+PROTOC_GEN:=$(PROTOC_SRC:.proto=.pb.go)
+
+all: $(PROTOC_GEN)
+
+maintainer-clean:
+ $(RM) $(PROTOC_GEN)
+
+$(PROTOC_GEN): $(PROTOC_GEN_GO) $(PROTOC_SRC)
+ protoc $(PROTOCFLAGS) $(PROTOC_SRC)
+
+$(PROTOC_GEN_GO):
+ cd $(PROTOC_GEN_GO_DIR) && go build