Update Makefile to support grpc lib generation for all supported languages.

pull/7/head
Ethan Bao 10 years ago
parent bd90877ba1
commit 14bef99b03
  1. 15
      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,24 +28,18 @@ 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)

Loading…
Cancel
Save