Makefile

 1.PHONY: build test run run-log clean lint fmt vet build-full generate_screenshots
 2
 3BINARY_NAME=matcha
 4BUILD_DIR=bin
 5
 6generate_gif:
 7	alias matcha="go run ."
 8	vhs demo.tape
 9	mv demo.gif public/assets/demo.gif
10
11generate_screenshots:
12	@mkdir -p docs/docs/assets/features/
13	@for tape in screenshots/*.tape; do \
14		[ "$$(basename $$tape)" = "common.tape" ] && continue; \
15		name=$$(basename "$$tape" .tape); \
16		echo "==> Generating screenshot: $$name"; \
17		vhs "$$tape" || echo "Warning: $$name failed"; \
18	done
19	@mv screenshots/*.png docs/docs/assets/features/ 2>/dev/null || true
20	@rm -f screenshots/*.gif 2>/dev/null || true
21	@echo "Screenshots saved to docs/docs/assets/features/"
22
23build:
24	go build -o $(BUILD_DIR)/$(BINARY_NAME) .
25
26build-full:
27	@echo "Building with version information..."
28	@VERSION=$$(git describe --tags --abbrev=0 2>/dev/null || echo "dev"); \
29	COMMIT=$$(git rev-parse --short HEAD 2>/dev/null || echo "unknown"); \
30	DATE=$$(date +%Y-%m-%d); \
31	echo "Version: $$VERSION"; \
32	echo "Commit: $$COMMIT"; \
33	echo "Date: $$DATE"; \
34	go build -ldflags="-X 'main.version=$$VERSION' -X 'main.commit=$$COMMIT' -X 'main.date=$$DATE'" -o $(BUILD_DIR)/$(BINARY_NAME)-full .;
35
36run:
37	go run .
38
39run-log:
40	go run . --debug --logs
41
42test:
43	go test ./...
44
45test-verbose:
46	go test -v ./...
47
48test-coverage:
49	go test -coverprofile=coverage.out ./...
50	go tool cover -html=coverage.out -o coverage.html
51
52clean:
53	rm -rf $(BUILD_DIR)
54	rm -f coverage.out coverage.html
55
56fmt:
57	go fmt ./...
58
59vet:
60	go vet ./...
61
62lint: fmt vet
63
64all: lint test build