-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (35 loc) · 1.09 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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOTOOL=$(GOCMD) tool
GOGET=$(GOCMD) get
BINARY_DIR=./bin
BINARY_NAME=$(BINARY_DIR)/sqs_wrapper
BINARY_UNIX=$(BINARY_NAME)_unix
all: test build ## Build and test the binary
build: ## Build the binary
$(GOBUILD) -o $(BINARY_NAME) -v
test: ## Test all the test files recursively
$(GOTEST) -v ./tests/... -coverpkg=./...
test-cover: ## Test and generate the coverage report
$(GOTEST) -coverprofile=coverage.out ./tests/... -coverpkg=./... && $(GOTOOL) cover -func=coverage.out
test-show-cover:
$(GOTOOL) cover -html=coverage.out
clean: ## Clean the binaries
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(BINARY_UNIX)
.PHONY: run
run: ## Run the binary
$(GOBUILD) -o $(BINARY_NAME) -v
./$(BINARY_NAME)
.PHONY: build-linux
build-linux: ## Cross compilation
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v
.PHONY: --help
--help: ##
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}'
.PHONY: help
help: --help