-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (57 loc) · 2.06 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
# =================================================================
#
# Copyright (C) 2020 Spatial Current, Inc. - All Rights Reserved
# Released as open source under the MIT License. See LICENSE file.
#
# =================================================================
.PHONY: help
help: ## Print the help documentation
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
#
# Go building, formatting, testing, and installing
#
fmt: ## Format Go source code
go fmt $$(go list ./... )
.PHONY: imports
imports: bin/goimports ## Update imports in Go source code
bin/goimports -w -local github.com/spatialcurrent/gocat,github.com/spatialcurrent $$(find . -iname '*.go')
vet: ## Vet Go source code
go vet github.com/spatialcurrent/gocat/pkg/... # vet packages
go vet github.com/spatialcurrent/gocat/cmd/... # vet commands
tidy: ## Tidy Go source code
go mod tidy
.PHONY: test_go
test_go: bin/errcheck bin/misspell bin/staticcheck bin/shadow ## Run Go tests
bash scripts/test.sh
.PHONY: test_cli
test_cli: bin/gocat ## Run CLI tests
bash scripts/test-cli.sh
install: ## Install the CLI on current platform
go install github.com/spatialcurrent/gocat/cmd/gocat
#
# Command line Programs
#
bin/errcheck:
go build -o bin/errcheck github.com/kisielk/errcheck
bin/goimports:
go build -o bin/goimports golang.org/x/tools/cmd/goimports
bin/gox:
go build -o bin/gox github.com/mitchellh/gox
bin/misspell:
go build -o bin/misspell github.com/client9/misspell/cmd/misspell
bin/staticcheck:
go build -o bin/staticcheck honnef.co/go/tools/cmd/staticcheck
bin/shadow:
go build -o bin/shadow golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
bin/gocat: ## Build CLI for Darwin / amd64
go build -o bin/gocat github.com/spatialcurrent/gocat/cmd/gocat
bin/gocat_linux_amd64: bin/gox ## Build CLI for Darwin / amd64
scripts/build-release linux amd64
.PHONY: build
build: bin/gocat
.PHONY: build_release
build_release: bin/gox
scripts/build-release
## Clean
clean: ## Clean artifacts
rm -fr bin