plugins/sdk/Makefile

39 lines
1.1 KiB
Makefile

GOHOSTOS:=$(shell go env GOHOSTOS)
GOPATH:=$(shell go env GOPATH)
ifeq ($(GOHOSTOS), windows)
Git_Bash=$(subst \,/,$(subst cmd\,bin\bash.exe,$(dir $(shell where git | grep cmd))))
PROTO_FILES=$(shell $(Git_Bash) -c "find proto -name *.proto")
else
PROTO_FILES=$(shell find proto -name *.proto)
endif
.PHONY: proto
# generate proto
proto:
protoc --proto_path=./ \
--proto_path=./proto \
--proto_path=./third_party \
--go_out=paths=source_relative:./ \
--go-http_out=paths=source_relative:./ \
--go-grpc_out=paths=source_relative:./ \
--validate_out=paths=source_relative,lang=go:./ \
--go-errors_out=paths=source_relative:./ \
$(PROTO_FILES)
# show help
help:
@echo ''
@echo 'Usage:'
@echo ' make [target]'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^# (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
printf "\033[36m%-22s\033[0m %s\n", helpCommand,helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)