-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (53 loc) · 1.67 KB
/
Copy pathMakefile
File metadata and controls
67 lines (53 loc) · 1.67 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
BINARY := wgtui
PKG := ./cmd/wgtui
BIN_DIR := bin
DIST_DIR := dist
# Platforms to cross-compile for. wg/wg-quick are Linux-native, so Linux is the
# primary target; the others are provided for convenience and --demo use.
# PLATFORMS := linux/amd64 linux/arm64 darwin/amd64 darwin/arm64
PLATFORMS := linux/amd64
.DEFAULT_GOAL := build
.PHONY: build
build: ## Build the binary into ./bin
@mkdir -p $(BIN_DIR)
go build -o $(BIN_DIR)/$(BINARY) $(PKG)
.PHONY: run
run: ## Run against a live interface (make run IFACE=wg0)
go run $(PKG) -i $(or $(IFACE),wg0)
.PHONY: demo
demo: ## Run the TUI with synthetic data (no WireGuard needed)
go run $(PKG) --demo
.PHONY: test
test: ## Run all tests
go test ./...
.PHONY: snapshot
snapshot: ## Print a rendered demo frame to the terminal
go test ./internal/ui -run DemoFrameSnapshot -v
.PHONY: vet
vet: ## Run go vet
go vet ./...
.PHONY: tidy
tidy: ## Tidy go.mod / go.sum
go mod tidy
.PHONY: check
check: vet test ## Vet + test
.PHONY: install
install: ## Install the binary into GOBIN
go install $(PKG)
.PHONY: cross
cross: ## Cross-compile for all PLATFORMS into ./dist
@mkdir -p $(DIST_DIR)
@for platform in $(PLATFORMS); do \
os=$${platform%/*}; arch=$${platform#*/}; \
ext=""; [ "$$os" = "windows" ] && ext=".exe"; \
out=$(DIST_DIR)/$(BINARY)-$$os-$$arch$$ext; \
echo "building $$out"; \
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch go build -trimpath -o $$out $(PKG) || exit 1; \
done
.PHONY: clean
clean: ## Remove build artifacts
rm -rf $(BIN_DIR) $(DIST_DIR)
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'