Skip to content

Commit be0a56a

Browse files
committed
update Makefile
1 parent 4207761 commit be0a56a

1 file changed

Lines changed: 52 additions & 9 deletions

File tree

Makefile

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,60 @@
1-
.PHONY: test build
1+
# Agentic Control Plane — developer Makefile
2+
# Run `make` or `make help` to list targets.
23

3-
fmt:
4+
SHELL := bash
5+
.SHELLFLAGS := -eu -o pipefail -c
6+
7+
.PHONY: help all build install clean fmt verify-fmt vet test test-coverage check ci
8+
9+
.DEFAULT_GOAL := help
10+
11+
# ---- Primary targets ----------------------------------------------------------
12+
13+
help: ## Show available targets
14+
@echo "Usage: make [<target>]"
15+
@echo ""
16+
@echo "Targets:"
17+
@grep -E '^[a-zA-Z0-9_.-]+:.*?## ' $(MAKEFILE_LIST) \
18+
| sort \
19+
| awk 'BEGIN {FS = ":.*?## "}; {printf " %-16s %s\n", $$1, $$2}'
20+
21+
all: fmt vet test build ## Format, vet, test, and build (local pre-push)
22+
23+
build: ## Build agentctl into bin/agentctl
24+
mkdir -p bin
25+
go build -trimpath -o bin/agentctl ./cmd/agentctl
26+
27+
install: ## Install agentctl with go install (honours GOBIN / GOPATH/bin)
28+
go install -trimpath ./cmd/agentctl
29+
30+
clean: ## Remove bin/ and coverage.out
31+
rm -rf bin/
32+
rm -f coverage.out
33+
34+
# ---- Go tooling ---------------------------------------------------------------
35+
36+
fmt: ## Run go fmt on all packages
437
go fmt ./...
538

6-
test:
39+
verify-fmt: ## Fail if any file needs gofmt (matches CI check)
40+
@out="$$(gofmt -l .)"; \
41+
if [[ -n "$$out" ]]; then \
42+
echo "Run \"make fmt\" — gofmt would change:"; \
43+
echo "$$out"; \
44+
exit 1; \
45+
fi
46+
47+
vet: ## Run go vet
48+
go vet ./...
49+
50+
test: ## Run tests with race detector
751
go test ./... -race
852

9-
test-coverage:
53+
test-coverage: ## Run tests and write coverage.out
1054
go test ./... -race -coverprofile=coverage.out
55+
@echo "Summary:"
56+
@go tool cover -func=coverage.out | tail -n1
1157

12-
vet:
13-
go vet ./...
58+
check: vet test ## Vet + test (no formatting changes)
1459

15-
build:
16-
mkdir -p bin
17-
go build -o bin/agentctl ./cmd/agentctl
60+
ci: verify-fmt vet test ## CI-style gate: formatting, vet, tests (no build)

0 commit comments

Comments
 (0)