-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (55 loc) · 1.54 KB
/
Copy pathMakefile
File metadata and controls
69 lines (55 loc) · 1.54 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
57
58
59
60
61
62
63
64
65
66
67
68
69
# Makefile for squadai
BINARY := squadai
CMD_PATH := ./cmd/squadai
VERSION ?= dev
LDFLAGS := -s -w -X main.version=$(VERSION)
.PHONY: all build test test-race vet fmt fmt-check lint smoke install clean help
# Default target
all: build
## build: Compile the binary to ./squadai
build:
go build -ldflags "$(LDFLAGS)" -o $(BINARY) $(CMD_PATH)
## test: Run all unit tests
test:
go test ./...
## test-race: Run all unit tests with race detector
test-race:
go test -race ./...
## vet: Run go vet static analysis
vet:
go vet ./...
## fmt: Format all Go source files in-place
fmt:
gofmt -w .
## fmt-check: Fail if any Go source files need formatting
fmt-check:
@unformatted=$$(gofmt -l .); \
if [ -n "$$unformatted" ]; then \
echo "The following files need formatting (run 'make fmt'):"; \
echo "$$unformatted"; \
exit 1; \
fi
## lint: Run golangci-lint if available, otherwise fall back to go vet
lint:
@if command -v golangci-lint > /dev/null 2>&1; then \
golangci-lint run; \
else \
echo "golangci-lint not found, falling back to go vet"; \
go vet ./...; \
fi
## smoke: Build the binary then run the smoke-test script
smoke: build
./scripts/smoke-test.sh
## install: Install the binary to GOPATH/bin
install:
go install -ldflags "$(LDFLAGS)" $(CMD_PATH)
## clean: Remove the built binary, dist/ directory, and test caches
clean:
rm -f $(BINARY)
rm -rf dist/
go clean -testcache
## help: List available targets with descriptions
help:
@echo "Usage: make <target>"
@echo ""
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/^## / /'