-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
61 lines (49 loc) · 1.58 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
61
NAME := precis
.DEFAULT_GOAL := explain
.PHONY: explain
explain: ## Explain what can be done
### Welcome
#
# .______ .______ _______ ______ __ _______.
# | _ \ | _ \ | ____| / || | / |
# | |_) | | |_) | | |__ | ,----'| | | (----
# | ___/ | / | __| | | | | \ \
# | | | |\ \----.| |____ | ----.| | .----) |
# | _| | _| ._____||_______| \______||__| |_______/
#
### Installation
#
# $$ make clean install
#
### 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/$(NAME)/version.GITCOMMIT=$(GITCOMMIT)" -o $(NAME) .
.PHONY: test
test: ## Run the unit tests
go test ./... -coverprofile=profile.out
# go tool cover -func=coverage.out
.PHONY: test-cov
test-cov: test ## Run the unit tests with coverage
go tool cover -html=profile.out
.PHONY: all
all: clean install lint vet build test ## Run everything
.PHONY: static-all
static-all: clean install vet static test ## Run everything