-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathMakefile
49 lines (35 loc) · 1.17 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
RM ?= rm -f
ECHO ?= echo
GO ?= go
NAME := gfile
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
deps:
@$(ECHO) "==> Installing deps ..."
@go get ./...
build: deps
@$(ECHO) "==> Building ..."
@go build -o $(NAME) .
build-all: deps
@$(ECHO) "==> Building all binaries..."
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o build/$(NAME)-macos main.go
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-w -extldflags "-static"' -o build/$(NAME)-linux-x86_64 main.go
@CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -ldflags '-w -extldflags "-static"' -o build/$(NAME)-linux-i386 main.go
generate:
@goreleaser --snapshot --skip-publish --rm-dist
lint:
@$(GOPATH)/bin/golint -set_exit_status ./... | grep -v vendor/ && exit 1 || exit 0
test:
@$(ECHO) "==> Running tests..."
@go test -short ${PKG_LIST}
clean:
@$(RM) $(NAME)
race: deps
@go test -race -short ${PKG_LIST}
msan: deps
@go test -msan -short ${PKG_LIST}
coverage:
@mkdir -p cover/
@go test ${PKG_LIST} -v -coverprofile cover/testCoverage.txt
coverhtml: coverage
@go tool cover -html=cover/testCoverage.txt -o cover/coverage.html
.PHONY: deps build build-all test clean lint generate