Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (45 loc) · 1.35 KB
/
Copy pathMakefile
File metadata and controls
56 lines (45 loc) · 1.35 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
55
56
.PHONY: all build clean run test test-race tools lint check help
# The name of the binary
BINARY_NAME=ttscli
VERSION ?= dev
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo none)
DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DATE)
STATICCHECK ?= $(shell command -v staticcheck || echo $(shell go env GOPATH)/bin/staticcheck)
all: build
## build: Build the CLI binary
build:
@echo "Building $(BINARY_NAME)..."
@go build -ldflags "$(LDFLAGS)" -o $(BINARY_NAME) ./cmd/ttscli
## clean: Remove the compiled binary
clean:
@echo "Cleaning up..."
@rm -f $(BINARY_NAME)
@rm -f *.mp3
## run: Run the CLI (e.g., make run ARGS="--text 'Hello' --play")
run: build
@./$(BINARY_NAME) $(ARGS)
## test: Run tests
test:
@go test -v ./...
## test-race: Run tests with the race detector
test-race:
@go test -race ./...
## tools: Install local developer tools
tools:
@go install honnef.co/go/tools/cmd/staticcheck@v0.7.0
## lint: Run static analysis checks
lint:
@$(STATICCHECK) ./...
## check: Run vet, tests, race tests, and lint
check:
@go vet ./...
@go test ./...
@go test -race ./...
@$(STATICCHECK) ./...
## help: Show this help message
help:
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'