-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathMakefile
More file actions
151 lines (123 loc) · 6.34 KB
/
Makefile
File metadata and controls
151 lines (123 loc) · 6.34 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
.PHONY: build test test-race lint clean install help build-notifier \
dev-local-install dev-local-update dev-local-bootstrap dev-local-status dev-local-reset \
dev-real-local dev-real-remote dev-real-toggle dev-real-status \
e2e-status e2e-smoke e2e-smoke-installed e2e-manual e2e-manual-installed \
linux-focus-debug
# Binary names
BINARY=claude-notifications
SOUND_PREVIEW=sound-preview
LIST_SOUNDS=list-sounds
BINARY_PATH=bin/$(BINARY)
SOUND_PREVIEW_PATH=bin/$(SOUND_PREVIEW)
LIST_SOUNDS_PATH=bin/$(LIST_SOUNDS)
# Build flags
# Development build: includes debug symbols for debugging
# Production build: optimized for size and deployment
RELEASE_FLAGS=-ldflags="-s -w" -trimpath
# Build targets
build: ## Build the binaries (development mode with debug symbols)
@echo "Building $(BINARY), $(SOUND_PREVIEW) and $(LIST_SOUNDS) (development mode)..."
@go build -o $(BINARY_PATH) ./cmd/claude-notifications
@go build -o $(SOUND_PREVIEW_PATH) ./cmd/sound-preview
@go build -o $(LIST_SOUNDS_PATH) ./cmd/list-sounds
@echo "Build complete! Binaries in bin/"
build-all: ## Build optimized binaries for all platforms
@echo "Building optimized release binaries for all platforms..."
@mkdir -p dist
@echo "Building claude-notifications..."
@GOOS=darwin GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(BINARY)-darwin-amd64 ./cmd/claude-notifications
@GOOS=darwin GOARCH=arm64 go build $(RELEASE_FLAGS) -o dist/$(BINARY)-darwin-arm64 ./cmd/claude-notifications
@GOOS=linux GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(BINARY)-linux-amd64 ./cmd/claude-notifications
@GOOS=linux GOARCH=arm64 go build $(RELEASE_FLAGS) -o dist/$(BINARY)-linux-arm64 ./cmd/claude-notifications
@GOOS=windows GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(BINARY)-windows-amd64.exe ./cmd/claude-notifications
@echo "Building sound-preview..."
@GOOS=darwin GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(SOUND_PREVIEW)-darwin-amd64 ./cmd/sound-preview
@GOOS=darwin GOARCH=arm64 go build $(RELEASE_FLAGS) -o dist/$(SOUND_PREVIEW)-darwin-arm64 ./cmd/sound-preview
@GOOS=linux GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(SOUND_PREVIEW)-linux-amd64 ./cmd/sound-preview
@GOOS=linux GOARCH=arm64 go build $(RELEASE_FLAGS) -o dist/$(SOUND_PREVIEW)-linux-arm64 ./cmd/sound-preview
@GOOS=windows GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(SOUND_PREVIEW)-windows-amd64.exe ./cmd/sound-preview
@echo "Building list-sounds..."
@GOOS=darwin GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(LIST_SOUNDS)-darwin-amd64 ./cmd/list-sounds
@GOOS=darwin GOARCH=arm64 go build $(RELEASE_FLAGS) -o dist/$(LIST_SOUNDS)-darwin-arm64 ./cmd/list-sounds
@GOOS=linux GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(LIST_SOUNDS)-linux-amd64 ./cmd/list-sounds
@GOOS=linux GOARCH=arm64 go build $(RELEASE_FLAGS) -o dist/$(LIST_SOUNDS)-linux-arm64 ./cmd/list-sounds
@GOOS=windows GOARCH=amd64 go build $(RELEASE_FLAGS) -o dist/$(LIST_SOUNDS)-windows-amd64.exe ./cmd/list-sounds
@echo "Build complete! Optimized binaries in dist/"
# Test targets
test: ## Run tests
@echo "Running tests..."
@go test -v -cover ./...
test-race: ## Run tests with race detection
@echo "Running tests with race detection..."
@go test -v -race -cover ./...
test-coverage: ## Run tests with coverage report
@echo "Running tests with coverage..."
@go test -v -coverprofile=coverage.txt -covermode=atomic ./...
@go tool cover -html=coverage.txt -o coverage.html
@echo "Coverage report generated: coverage.html"
# Linting
lint: ## Run linter
@echo "Running linter..."
@go vet ./...
@go fmt ./...
# Installation
install: build ## Install binary to /usr/local/bin
@echo "Installing $(BINARY) to /usr/local/bin..."
@cp $(BINARY_PATH) /usr/local/bin/$(BINARY)
@echo "Installation complete!"
# Local plugin workflows
dev-local-install: ## Install plugin in isolated Claude config
@bash scripts/dev-local-plugin.sh install
dev-local-update: ## Update plugin in isolated Claude config
@bash scripts/dev-local-plugin.sh update
dev-local-bootstrap: ## Run bootstrap in isolated Claude config
@bash scripts/dev-local-plugin.sh bootstrap
dev-local-status: ## Show isolated Claude config plugin status
@bash scripts/dev-local-plugin.sh status
dev-local-reset: ## Reset isolated Claude config
@bash scripts/dev-local-plugin.sh reset
dev-real-local: ## Point real Claude marketplace to local source
@bash scripts/dev-real-plugin.sh local
dev-real-remote: ## Point real Claude marketplace back to remote source
@bash scripts/dev-real-plugin.sh remote
dev-real-toggle: ## Toggle real Claude marketplace between local and remote
@bash scripts/dev-real-plugin.sh toggle
dev-real-status: ## Show real Claude marketplace/plugin status
@bash scripts/dev-real-plugin.sh status
e2e-status: ## Show real-Claude E2E support and target status
@bash scripts/e2e-real-claude.sh status
e2e-smoke: ## Run real-Claude smoke test via --plugin-dir
@bash scripts/e2e-real-claude.sh smoke-plugin-dir
e2e-smoke-installed: ## Run real-Claude smoke test against installed plugin
@bash scripts/e2e-real-claude.sh smoke-installed
e2e-manual: ## Run manual click validation via --plugin-dir
@bash scripts/e2e-real-claude.sh manual-click-plugin-dir
e2e-manual-installed: ## Run manual click validation against installed plugin
@bash scripts/e2e-real-claude.sh manual-click-installed
linux-focus-debug: ## Collect Linux click-to-focus diagnostics report
@bash scripts/linux-focus-debug.sh
# Cleanup
clean: ## Clean build artifacts
@echo "Cleaning..."
@rm -rf bin/ dist/ coverage.* *.log
@echo "Clean complete!"
# Rebuild and prepare for commit
rebuild-and-commit: build-all ## Rebuild optimized binaries and prepare for commit
@echo "Moving optimized binaries to bin/..."
@cp dist/* bin/ 2>/dev/null || true
@rm -rf dist
@echo "✓ Optimized binaries ready in bin/"
@echo ""
@echo "Platform binaries updated:"
@ls -1 bin/claude-notifications-* 2>/dev/null || echo " (none found)"
@echo ""
@echo "To commit: git add bin/claude-notifications-* && git commit -m 'chore: rebuild binaries'"
# Swift notifier (macOS only)
build-notifier: ## Build ClaudeNotifier .app bundle (macOS)
@echo "Building ClaudeNotifier..."
@cd swift-notifier && bash scripts/build-app.sh
@echo "Done! Bundle at swift-notifier/ClaudeNotifier.app"
# Help
help: ## Show this help message
@echo "Available targets:"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-20s %s\n", $$1, $$2}'