31 lines
881 B
Makefile
31 lines
881 B
Makefile
|
PROTO_FILES=$(shell find proto -name *.proto)
|
||
|
|
||
|
.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)
|