-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (20 loc) · 976 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
# This is adapted from https://habr.com/ru/post/542410/
BINARY = sync-monitor
COMMIT=$(shell git rev-parse --short HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
TAG=$(shell git describe --tags |cut -d- -f1)
LDFLAGS = -ldflags "-X main.gitTag=${TAG} -X main.gitCommit=${COMMIT} -X main.gitBranch=${BRANCH}"
.PHONY: help clean dep build install uninstall
.DEFAULT_GOAL := help
help: ## Display this help screen.
@echo "Makefile available targets:"
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " * \033[36m%-15s\033[0m %s\n", $$1, $$2}'
dep: ## Download the dependencies.
go mod download && go get github.com/kyberorg/sync-monitor/cmd/sync-monitor
build: dep ## Build executable.
mkdir -p ./bin
CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o bin/${BINARY} ./cmd/sync-monitor
binary: build ## Alias to `build`
clean: ## Clean build directory.
rm -f ./bin/${BINARY}
rmdir ./bin