-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
42 lines (30 loc) · 1.16 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
PKG_PREFIX = github.com/ibraimgm/enigma
NAME = enigma
VERSION = 0.1.0
BUILD = `git rev-parse HEAD`
GOTOOLS = \
github.com/golang/dep
LDFLAGS = -ldflags "-X=main.Version=$(VERSION) -X=main.Build=$(BUILD)"
tools: ## Install the tools needed for development and dependency management
go get -u -v $(GOTOOLS)
# 'dep' need extra steps:
cd $(GOPATH)/src/github.com/golang/dep && git describe --abbrev=0 --tags | xargs git checkout && go install ./cmd/dep && git checkout master
clean: ## Remove the generated binary
-@rm -f $(NAME)
deps: ## Ensure package dependencies are available
@dep ensure
build: deps $(NAME) ## Builds the application for the current platform
@true
check: deps ## Run tests (WIP)
@-rm -f coverage.txt
@-rm -f cover.html
@go test -covermode=count -coverprofile=coverage.txt `go list ./... | grep -v cmd`
cover: check
@-rm -f cover.html
@go tool cover -html=coverage.txt -o cover.html
$(NAME):
@go build $(LDFLAGS) $(PKG_PREFIX)/cmd/enigma
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL = help
.PHONY: tools clean deps build help