-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (37 loc) · 1.5 KB
/
Copy pathMakefile
File metadata and controls
54 lines (37 loc) · 1.5 KB
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
BINARY ?= things-cli
MAIN ?= ./cmd/things-cli
PKGS ?= ./...
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS ?= -s -w -X github.com/thaodangspace/things-cli/cli.version=$(VERSION)
.DEFAULT_GOAL := help
.PHONY: help build install test test-race fmt vet tidy check docs-install docs-dev docs-build docs-preview clean snapshot
help: ## Show this help
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make <target>\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*##/ {printf " %-12s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
build: ## Build the things-cli binary
go build -trimpath -ldflags "$(LDFLAGS)" -o $(BINARY) $(MAIN)
install: ## Install the CLI with go install
go install -trimpath -ldflags "$(LDFLAGS)" $(MAIN)
test: ## Run tests
go test $(PKGS)
test-race: ## Run tests with the race detector
go test -race $(PKGS)
fmt: ## Format Go code
go fmt $(PKGS)
vet: ## Run go vet
go vet $(PKGS)
tidy: ## Tidy Go modules
go mod tidy
check: fmt tidy vet test build ## Format, tidy, vet, test, and build
docs-install: ## Install documentation site dependencies
npm --prefix docs ci
docs-dev: ## Start the documentation site development server
npm --prefix docs run dev
docs-build: docs-install ## Build the static documentation site
npm --prefix docs run build
docs-preview: ## Preview the production documentation build
npm --prefix docs run preview
clean: ## Remove build artifacts
rm -f $(BINARY)
rm -rf dist
snapshot: ## Build a local GoReleaser snapshot
goreleaser release --snapshot --clean