1.PHONY: build test run 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
39test:
40 go test ./...
41
42test-verbose:
43 go test -v ./...
44
45test-coverage:
46 go test -coverprofile=coverage.out ./...
47 go tool cover -html=coverage.out -o coverage.html
48
49clean:
50 rm -rf $(BUILD_DIR)
51 rm -f coverage.out coverage.html
52
53fmt:
54 go fmt ./...
55
56vet:
57 go vet ./...
58
59lint: fmt vet
60
61all: lint test build