-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
84 lines (65 loc) · 2.61 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.release
VERSION_PACKAGE := github.com/datahop/ipfs-lite/version
GO ?= go
GOLANGCI_LINT ?= $$($(GO) env GOPATH)/bin/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.50.0
build-mobile: VERSION := $(shell . $(SUPPORT); getMobileVersion)
build-mobile:
@gomobile bind -o ./mobile/datahop.aar -target=android -ldflags "\
-X '$(VERSION_PACKAGE).MobileVersion=$(VERSION)'" \
github.com/datahop/ipfs-lite/mobile
patch-release-mobile: VERSION := $(shell . $(SUPPORT); nextMobilePatchVersion)
patch-release-mobile:
@. $(SUPPORT) ; setMobileVersion $(VERSION)
minor-release-mobile: VERSION := $(shell . $(SUPPORT); nextMobileMinorVersion)
minor-release-mobile:
@. $(SUPPORT) ; setMobileVersion $(VERSION)
major-release-mobile: VERSION := $(shell . $(SUPPORT); nextMobileMajorVersion)
major-release-mobile:
@. $(SUPPORT) ; setMobileVersion $(VERSION)
patch-mobile:
@make patch-release-mobile
@make build-mobile
minor-mobile:
@make minor-release-mobile
@make build-mobile
major-mobile:
@make major-release-mobile
@make build-mobile
build-cli: VERSION := $(shell . $(SUPPORT); getCliVersion)
build-cli:
@cd ./cli && GOOS=linux GOARCH=amd64 go build -ldflags "\
-X '$(VERSION_PACKAGE).CliVersion=$(VERSION)'" -o datahop-cli-linux-v$(VERSION) datahop.go
@cd ./cli && GOOS=darwin GOARCH=amd64 go build -ldflags "\
-X '$(VERSION_PACKAGE).CliVersion=$(VERSION)'" -o datahop-cli-darwin-v$(VERSION) datahop.go
@cd ./cli && GOOS=windows GOARCH=amd64 go build -ldflags "\
-X '$(VERSION_PACKAGE).CliVersion=$(VERSION)'" -o datahop-cli-windows-v$(VERSION).exe datahop.go
patch-release-cli: VERSION := $(shell . $(SUPPORT); nextCliPatchVersion)
patch-release-cli:
@. $(SUPPORT) ; setCliVersion $(VERSION)
minor-release-cli: VERSION := $(shell . $(SUPPORT); nextCliMinorVersion)
minor-release-cli:
@. $(SUPPORT) ; setCliVersion $(VERSION)
major-release-cli: VERSION := $(shell . $(SUPPORT); nextCliMajorVersion)
major-release-cli:
@. $(SUPPORT) ; setCliVersion $(VERSION)
patch-cli:
@make patch-release-cli
@make build-cli
minor-cli:
@make minor-release-cli
@make build-cli
major-cli:
@make major-release-cli
@make build-cli
run-tests:
go test -json -p 1 -race -v ./...
.PHONY: linter
linter:
test -f $(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: lint
lint: linter
$(GOLANGCI_LINT) run
binary: VERSION := $(shell . $(SUPPORT); getCliVersion)
binary:
go build -trimpath -ldflags "-s -w -X '$(VERSION_PACKAGE).CliVersion=$(VERSION)'" -o dist/datahop ./cli