-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
30 lines (21 loc) · 903 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
APP_NAME = server
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 lint
.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
build: dep ## Build pgcenter executable.
mkdir -p ./bin
CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o bin/${APP_NAME} ./cmd/server
clean: ## Clean build directory.
rm -f ./bin/${APP_NAME}
rmdir ./bin
lint: dep ## Lint the source files
golangci-lint run --timeout 5m -E golint
gosec -quiet ./...