forked from moshebe/gebug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (38 loc) · 1.04 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
WORKROOT := $(shell pwd)
OUTDIR := $(WORKROOT)/output
export PATH := $(shell go env GOPATH)/bin:$(PATH)
export GO111MODULE := on
GOFLAGS := -race
STATICCHECK := staticcheck
ARCH := $(shell getconf LONG_BIT)
ifeq ($(ARCH),64)
GOTEST += -race
endif
GEBUG_VERSION ?= $(shell cat VERSION)
GIT_COMMIT ?= $(shell git rev-parse HEAD)
PKGS := $(shell go list ./...)
all: compile package
compile: test build
build:
go build -ldflags "-X main.version=$(GEBUG_VERSION) -X main.commit=$(GIT_COMMIT)"
test: test-case vet-case
test-case:
go test -cover ./...
vet-case:
go vet ./...
coverage:
echo -n > coverage.txt
for pkg in $(PKGS) ; do go test -coverprofile=profile.out -covermode=atomic $${pkg} && cat profile.out >> coverage.txt; done
package:
mkdir -p $(OUTDIR)/bin
mv bfe $(OUTDIR)/bin
cp -r conf $(OUTDIR)
check:
go get honnef.co/go/tools/cmd/staticcheck
staticcheck ./...
clean:
rm -rf $(OUTDIR)
rm -rf $(WORKROOT)/gebug
rm -rf $(WORKROOT)/.gebug
rm -rf $(GOPATH)/pkg/linux_amd64
.PHONY: all compile test package clean build