-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (50 loc) · 1.71 KB
/
Copy pathMakefile
File metadata and controls
65 lines (50 loc) · 1.71 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
# CH-UI Makefile
# Single binary: server + agent + embedded frontend
VERSION ?= $(shell cat VERSION 2>/dev/null || git describe --tags --always --dirty 2>/dev/null || echo "dev")
COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
DATE ?= $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
LDFLAGS = -s -w \
-X main.Version=$(VERSION) \
-X main.Commit=$(COMMIT) \
-X main.BuildDate=$(DATE)
BINARY = ch-ui
.PHONY: app build rebuild from-scratch build-frontend build-go dev test clean tidy vet help
## app: Build frontend + Go binary (production-ready)
app: build-frontend build-go
## build: Build everything (frontend + Go binary)
build: app
## rebuild: Clean artifacts, then build everything
rebuild:
$(MAKE) clean
$(MAKE) build
## from-scratch: Alias for rebuild
from-scratch: rebuild
## build-frontend: Build the Svelte frontend
build-frontend:
cd ui && bun install --frozen-lockfile
@cd ui && (CHUI_VITE_MINIFY=true CHUI_VITE_REPORT_COMPRESSED=false bun run build || \
(echo "Frontend build was killed; retrying with low-memory profile (no minify)..." && \
CHUI_VITE_MINIFY=false CHUI_VITE_REPORT_COMPRESSED=false bun run build))
## build-go: Build just the Go binary (skip frontend rebuild)
build-go:
CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -o $(BINARY) .
## dev: Start the server in dev mode (expects Vite running on :5173)
dev:
go run -ldflags "$(LDFLAGS)" . server --dev
## test: Run all Go tests
test:
go test ./... -v -count=1
## clean: Remove build artifacts
clean:
rm -f $(BINARY)
rm -rf ui/dist/
## tidy: Clean up Go modules
tidy:
go mod tidy
## vet: Run go vet
vet:
go vet ./...
## help: Show this help message
help:
@echo "Available targets:"
@grep -E '^## ' Makefile | sed 's/## / /'