|
19 | 19 | # Add `## Description` after the target to make it appear in `make help` |
20 | 20 |
|
21 | 21 | .PHONY: all build dev start clean help |
22 | | -.PHONY: build-renderer version |
| 22 | +.PHONY: build-renderer version build-icons |
23 | 23 | .PHONY: lint lint-fix fmt fmt-check fmt-shell fmt-nix fmt-nix-check fmt-shell-check typecheck static-check |
24 | 24 | .PHONY: test test-unit test-integration test-watch test-coverage test-e2e |
25 | 25 | .PHONY: dist dist-mac dist-win dist-linux |
@@ -57,7 +57,7 @@ start: build-main build-preload ## Build and start Electron app |
57 | 57 | @bun x electron --remote-debugging-port=9222 . |
58 | 58 |
|
59 | 59 | ## Build targets (can run in parallel) |
60 | | -build: ensure-deps src/version.ts build-renderer build-main build-preload ## Build all targets |
| 60 | +build: ensure-deps src/version.ts build-renderer build-main build-preload build-icons ## Build all targets |
61 | 61 |
|
62 | 62 | build-main: ensure-deps dist/main.js ## Build main process |
63 | 63 |
|
@@ -87,6 +87,34 @@ version: ## Generate version file |
87 | 87 |
|
88 | 88 | src/version.ts: version |
89 | 89 |
|
| 90 | +# Platform-specific icon targets |
| 91 | +ifeq ($(shell uname), Darwin) |
| 92 | +build-icons: build/icon.icns build/icon.png ## Generate Electron app icons from logo (macOS builds both) |
| 93 | +else |
| 94 | +build-icons: build/icon.png ## Generate Electron app icons from logo (Linux builds PNG only) |
| 95 | +endif |
| 96 | + |
| 97 | +# Detect ImageMagick command (magick on v7+, convert on older versions) |
| 98 | +MAGICK_CMD := $(shell command -v magick 2>/dev/null || command -v convert 2>/dev/null || echo "magick") |
| 99 | + |
| 100 | +build/icon.png: docs/img/logo.webp |
| 101 | + @echo "Generating Linux icon..." |
| 102 | + @mkdir -p build |
| 103 | + @$(MAGICK_CMD) docs/img/logo.webp -resize 512x512 build/icon.png |
| 104 | + |
| 105 | +build/icon.icns: docs/img/logo.webp |
| 106 | + @echo "Generating macOS icon..." |
| 107 | + @mkdir -p build/icon.iconset |
| 108 | + @for size in 16 32 64 128 256 512; do \ |
| 109 | + $(MAGICK_CMD) docs/img/logo.webp -resize $${size}x$${size} build/icon.iconset/icon_$${size}x$${size}.png; \ |
| 110 | + if [ $$size -le 256 ]; then \ |
| 111 | + double=$$((size * 2)); \ |
| 112 | + $(MAGICK_CMD) docs/img/logo.webp -resize $${double}x$${double} build/icon.iconset/icon_$${size}x$${size}@2x.png; \ |
| 113 | + fi; \ |
| 114 | + done |
| 115 | + @iconutil -c icns build/icon.iconset -o build/icon.icns |
| 116 | + @rm -rf build/icon.iconset |
| 117 | + |
90 | 118 | ## Quality checks (can run in parallel) |
91 | 119 | static-check: lint typecheck fmt-check ## Run all static checks |
92 | 120 |
|
@@ -162,7 +190,7 @@ docs-watch: ## Watch and rebuild documentation |
162 | 190 | ## Clean |
163 | 191 | clean: ## Clean build artifacts |
164 | 192 | @echo "Cleaning build artifacts..." |
165 | | - @rm -rf dist release |
| 193 | + @rm -rf dist release build/icon.icns build/icon.png |
166 | 194 | @echo "Done!" |
167 | 195 |
|
168 | 196 | # Parallel build optimization - these can run concurrently |
|
0 commit comments