-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
64 lines (51 loc) · 1.76 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
SHELL=/bin/bash -o pipefail
export GOPATH ?= $(shell go env GOPATH)
export GO111MODULE ?= on
DOCKER_DOC_TAG ?= latest
.PHONY: all
all: build
.PHONY: mod
mod:
@go mod download
.PHONY: build
build: build-clients build-servers ## build all modules
.PHONY: build-clients
build-clients: build-v1-client ## build all clients
.PHONY: build-v1-client
build-v1-client: ## build only client of v1
./v1/indirect/update-client.sh
@go mod tidy
@go build ./v1/client
.PHONY: build-servers
build-servers: build-v1-server ## build all servers
.PHONY: build-v1-server
build-v1-server: ## build only server of v1
./v1/indirect/update-server.sh
@go build ./v1/server
.PHONY: open
open: ## open all index.html files
open ./**/html/index.html
.PHONY: help
help: ## display help screen
@grep -E '^[a-zA-Z_GO111MODULE=on go mod tidy-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
HOOK_FILE_SOURCE=".indirect/pre-commit.sh"
HOOK_FILE_TARGET=".git/hooks/pre-commit"
SELECT_LIST= yes no
.PHONY: hook
hook: ## add pre-commit git hook file
@if test -f "${HOOK_FILE_TARGET}"; then \
echo -e "\nPre-commit file already exist: ${HOOK_FILE_TARGET}\nReplace file?"; \
select SELECTED in ${SELECT_LIST}; \
do test -n "$$SELECTED" && break; \
echo -e "\x1b[31;01mInvalid Selection\x1b[0m"; \
done; \
if [ "$${SELECTED}" != "yes" ]; then \
echo -e "\033[0;32mSkipped\033[0m"; \
exit 0; \
fi; \
fi; \
echo -n > .git/hooks/pre-commit; \
echo -e "#!/bin/bash" >> .git/hooks/pre-commit; \
echo -e ".indirect/pre-commit.sh" >> .git/hooks/pre-commit; \
chmod 0755 ${HOOK_FILE_TARGET}; \
echo -e "\033[0;32mHook added successfully: ${HOOK_FILE_TARGET}\033[0m";