Update Makefile to support grpc lib generation for all supported languages.
This commit is contained in:
parent
bd90877ba1
commit
14bef99b03
17
Makefile
17
Makefile
|
|
@ -12,6 +12,9 @@ OUTPUT ?= ./gens
|
||||||
# Choose the target language.
|
# Choose the target language.
|
||||||
LANGUAGE ?= cpp
|
LANGUAGE ?= cpp
|
||||||
|
|
||||||
|
# Choose grpc plugin
|
||||||
|
GPRCPLUGIN ?= /usr/local/bin/grpc_$(LANGUAGE)_plugin
|
||||||
|
|
||||||
# Choose the proto include directory.
|
# Choose the proto include directory.
|
||||||
PROTOINCLUDE ?= /usr/local/include
|
PROTOINCLUDE ?= /usr/local/include
|
||||||
|
|
||||||
|
|
@ -25,27 +28,21 @@ ifeq ($(LANGUAGE),go)
|
||||||
FLAGS+= --$(LANGUAGE)_out=plugins=grpc:$(OUTPUT)
|
FLAGS+= --$(LANGUAGE)_out=plugins=grpc:$(OUTPUT)
|
||||||
else
|
else
|
||||||
FLAGS+= --$(LANGUAGE)_out=$(OUTPUT) --grpc_out=$(OUTPUT)
|
FLAGS+= --$(LANGUAGE)_out=$(OUTPUT) --grpc_out=$(OUTPUT)
|
||||||
FLAGS+= --plugin=protoc-gen-grpc=/usr/local/bin/grpc_$(LANGUAGE)_plugin
|
FLAGS+= --plugin=protoc-gen-grpc=$(GPRCPLUGIN)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(LANGUAGE),go)
|
ifeq ($(LANGUAGE),go)
|
||||||
SUFFIX:= pb.go
|
SUFFIX:= pb.go
|
||||||
endif
|
else
|
||||||
ifeq ($(LANGUAGE),cpp)
|
|
||||||
SUFFIX:= pb.cc
|
SUFFIX:= pb.cc
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DEPS:= $(shell find google $(PROTOINCLUDE)/google/protobuf -type f -name '*.proto' | sed "s/proto$$/$(SUFFIX)/")
|
DEPS:= $(shell find google $(PROTOINCLUDE)/google/protobuf -type f -name '*.proto' | sed "s/proto$$/$(SUFFIX)/")
|
||||||
|
|
||||||
all: supported_lang $(DEPS)
|
all: $(DEPS)
|
||||||
|
|
||||||
supported_lang:
|
|
||||||
ifndef SUFFIX
|
|
||||||
$(error unsupported language: [$(LANGUAGE)])
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef OUTPUT
|
ifdef OUTPUT
|
||||||
mkdir -p $(OUTPUT)
|
mkdir -p $(OUTPUT)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%.$(SUFFIX): %.proto
|
%.$(SUFFIX): %.proto
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue