-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (37 loc) · 962 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
SHELL:=/bin/bash
OS=linux
BINARY=betemplate
BUILD_PREFIX=CGO_ENABLED=0 GOOS=linux GOARCH=amd64
## build all executable files
build:
@go build -ldflags '-w -s' -o ${BINARY} .
static:
@${BUILD_PREFIX} go build -ldflags '-w -s' -o ${BINARY} .
clean:
@rm -f ${BINARY}*
## run this application
run:
@go run main.go
## generate mock files
generate-mock:
@mockery --all --keeptree --inpackage
## generate proto files
generate-proto:
@protoc --go_out=./proto --go-grpc_out=./proto ./proto/hello.proto
.PHONY: help
## show help
help:
@echo ''
@echo 'Usage: be-template build'
@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 + 3, RLENGTH); \
printf " %-$(TARGET_MAX_CHAR_NUM)s\t%s\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)