-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
60 lines (48 loc) · 1.47 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
NAME := donny
.DEFAULT_GOAL := explain
.PHONY: explain
explain:
### Welcome
# _______ ______ .__ __. .__ __. ____ ____
# | \ / __ \ | \ | | | \ | | \ \ / /
# | .--. | | | | | \| | | \| | \ \/ /
# | | | | | | | | . | | . | \_ _/
# | '--' | --' | | |\ | | |\ | | |
# |_______/ \______/ |__| \__| |__| \__| |__|
#
#
### Installation
#
# $$ make all
#
### Targets
@cat Makefile* | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
GITCOMMIT := $(shell git rev-parse --short HEAD)
.PHONY: clean
clean: ## Clean the local dependencies
rm -fr vendor
.PHONY: install
install: ## Install the local dependencies
go get ./...
.PHONY: vet
vet: ## Vet the code
go vet ./...
.PHONY: lint
lint: ## Lint the code
golint -set_exit_status $(shell go list ./...)
.PHONY: build
build: ## Build the application
go build .
.PHONY: static
static: ## Build the application
CGO_ENABLED=0 go build -ldflags "-extldflags -static -X github.com/benmatselby/donny/version.GITCOMMIT=$(GITCOMMIT)" -o $(NAME) .
.PHONY: test
test: ## Run the unit tests
go test ./... -coverprofile=coverage.out
.PHONY: test-cov
test-cov: test ## Run the unit tests with coverage
go tool cover -html=coverage.out
.PHONY: all ## Run everything
all: clean install lint vet build test
.PHONY: static-all ## Run everything
static-all: clean install vet static test