-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
53 lines (42 loc) · 1.08 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
GO ?= go
GOLANGCI_LINT ?= golangci-lint
GOLANGCI_LINT_VERSION ?= v1.61.0
COMMIT ?= "$(shell git describe --long --dirty --always --match "" || true)"
LDFLAGS ?= -s -w -X github.com/ethersphere/beekeeper.commit=$(COMMIT)
.PHONY: all
all: build lint vet test-race binary
.PHONY: binary
binary: export CGO_ENABLED=0
binary: dist FORCE
$(GO) version
ifeq ($(OS),Windows_NT)
$(GO) build -trimpath -ldflags "$(LDFLAGS)" -o dist/beekeeper.exe ./cmd/beekeeper
else
$(GO) build -trimpath -ldflags "$(LDFLAGS)" -o dist/beekeeper ./cmd/beekeeper
endif
dist:
mkdir $@
.PHONY: lint
lint: linter
$(GOLANGCI_LINT) run
.PHONY: linter
linter:
which $(GOLANGCI_LINT) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$($(GO) env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
.PHONY: vet
vet:
$(GO) vet ./...
.PHONY: test-race
test-race:
$(GO) test -race -v ./...
.PHONY: test
test:
$(GO) test -v ./pkg/...
.PHONY: build
build: export CGO_ENABLED=0
build:
$(GO) build -trimpath -ldflags "$(LDFLAGS)" ./...
.PHONY: clean
clean:
$(GO) clean
rm -rf dist/
FORCE: