-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (29 loc) · 1.05 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
.PHONY: help
help: ## Show this
@grep -E '^[0-9a-zA-Z_-]+:(.*?## .*|[a-z _0-9]+)?$$' Makefile | sort | awk 'BEGIN {FS = ":(.*## |[\t ]*)"}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
NAME:=hbtsrv
build_tag:=$(shell git describe --tags 2> /dev/null)
BUILDFLAGS:="-s -w -X github.com/lzambarda/hbt/internal.Version=$(build_tag)"
.PHONY: dependencies
dependencies: ## Install dependencies requried for development operations.
@go install github.com/golangci/golangci-lint/cmd/[email protected]
@go mod tidy
.PHONY: lint
lint:
go fmt ./...
golangci-lint run ./...
.PHONY: build
build:
@GOOS=darwin GOARCH=amd64 go build -ldflags $(BUILDFLAGS) -o ./bin/darwin/$(NAME) ./main.go
@GOOS=linux GOARCH=amd64 go build -ldflags $(BUILDFLAGS) -o bin/linux/$(NAME) ./main.go
.PHONY: build_assets
build_assets: build
@mkdir -p assets
@tar -zcvf assets/darwin-amd64-$(NAME).tgz ./bin/darwin/$(NAME)
@tar -zcvf assets/linux-amd64-$(NAME).tgz ./bin/linux/$(NAME)
run="."
dir="./..."
short="-short"
.PHONY: test
test:
@go test --timeout=40s $(short) $(dir) -run $(run);