build(makefile): make gui build default and reorganize targets
- commit
- 51e7b4d615e34b9b7200b4e2ac95477a321e8762
- author
- bamen · · 2025-09-09 18:23 UTC
- committer
- bamen · · 2025-09-09 19:09 UTC
- parent
- bab08aa
- signature
- unsigned
1 file · +12 -11
M Makefile +12 -11
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | # Makefile for dumber | |
| 2 | 2 | ||
| 3 | - | .PHONY: build build-frontend test lint clean install-tools dev generate help check init build-static | |
| 3 | + | .PHONY: build build-frontend test lint clean install-tools dev generate help check init build-static build-no-gui | |
| 4 | 4 | ||
| 5 | 5 | # Load local overrides from .env.local if present (Makefile syntax) | |
| 6 | 6 | ifneq (,$(wildcard .env.local)) | |
| @@ -33,27 +33,28 @@ help: ## Show this help message | |||
| 33 | 33 | @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | |
| 34 | 34 | ||
| 35 | 35 | # Build targets | |
| 36 | - | build: build-frontend ## Build the application (frontend assets, then Go binary) | |
| 37 | - | @echo "Building $(BINARY_NAME) $(VERSION)..." | |
| 36 | + | build: build-frontend ## Build the application with GUI (frontend assets, then Go binary with WebKitGTK) | |
| 37 | + | @echo "Building $(BINARY_NAME) $(VERSION) with GUI..." | |
| 38 | 38 | @mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod | |
| 39 | - | $(GOENV) CGO_ENABLED=1 go build $(LDFLAGS) -o $(DIST_DIR)/$(BINARY_NAME) $(MAIN_PATH) | |
| 39 | + | $(GOENV) CGO_ENABLED=1 go build $(LDFLAGS) -tags=webkit_cgo -o $(DIST_DIR)/$(BINARY_NAME) $(MAIN_PATH) | |
| 40 | 40 | ||
| 41 | 41 | build-frontend: ## Build TypeScript frontend | |
| 42 | 42 | @echo "Building TypeScript frontend..." | |
| 43 | 43 | @cd frontend && npm install --silent && npm run build | |
| 44 | 44 | @echo "Frontend build complete" | |
| 45 | 45 | ||
| 46 | - | build-static: ## Build static binary (CGO disabled, CLI-only functionality) | |
| 47 | - | @echo "Building static $(BINARY_NAME) $(VERSION) (CLI-only)..." | |
| 46 | + | build-no-gui: build-frontend ## Build binary without GUI (CGO disabled, CLI-only functionality) | |
| 47 | + | @echo "Building $(BINARY_NAME) $(VERSION) (CLI-only, no GUI)..." | |
| 48 | 48 | @mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod | |
| 49 | - | $(GOENV) CGO_ENABLED=0 go build $(LDFLAGS) -o $(DIST_DIR)/$(BINARY_NAME)-static $(MAIN_PATH) | |
| 49 | + | $(GOENV) CGO_ENABLED=0 go build $(LDFLAGS) -o $(DIST_DIR)/$(BINARY_NAME)-no-gui $(MAIN_PATH) | |
| 50 | + | ||
| 51 | + | build-static: build-no-gui ## Alias for build-no-gui (backward compatibility) | |
| 52 | + | @echo "Note: build-static is deprecated, use build-no-gui instead" | |
| 50 | 53 | ||
| 51 | 54 | # GUI build with WebKitGTK 6.0 (GTK4) | |
| 52 | 55 | .PHONY: build-gui run-gui | |
| 53 | - | build-gui: build-frontend ## Build GUI binary with native WebKitGTK 6.0 (requires GTK4/WebKitGTK 6 dev packages) | |
| 54 | - | @echo "Building $(BINARY_NAME) (GUI, webkit_cgo)…" | |
| 55 | - | @mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod | |
| 56 | - | $(GOENV) CGO_ENABLED=1 go build $(LDFLAGS) -tags=webkit_cgo -o $(DIST_DIR)/$(BINARY_NAME) $(MAIN_PATH) | |
| 56 | + | build-gui: build ## Alias for default build (backward compatibility) | |
| 57 | + | @echo "Note: build-gui is now the default 'build' target" | |
| 57 | 58 | ||
| 58 | 59 | run-gui: ## Run the GUI with native WebKitGTK 6.0 (requires GTK4/WebKitGTK 6 dev packages) | |
| 59 | 60 | @echo "Running GUI (webkit_cgo)…" | |
| @@ -1,6 +1,6 @@ | |||||
| 1 | # Makefile for dumber | 1 | # Makefile for dumber | ||
| 2 | 2 | ||||
| 3 | - | .PHONY: build build-frontend test lint clean install-tools dev generate help check init build-static | 3 | + | .PHONY: build build-frontend test lint clean install-tools dev generate help check init build-static build-no-gui |
| 4 | 4 | ||||
| 5 | # Load local overrides from .env.local if present (Makefile syntax) | 5 | # Load local overrides from .env.local if present (Makefile syntax) | ||
| 6 | ifneq (,$(wildcard .env.local)) | 6 | ifneq (,$(wildcard .env.local)) | ||
| @@ -33,27 +33,28 @@ help: ## Show this help message | |||||
| 33 | @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | 33 | @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
| 34 | 34 | ||||
| 35 | # Build targets | 35 | # Build targets | ||
| 36 | - | build: build-frontend ## Build the application (frontend assets, then Go binary) | 36 | + | build: build-frontend ## Build the application with GUI (frontend assets, then Go binary with WebKitGTK) |
| 37 | - | @echo "Building $(BINARY_NAME) $(VERSION)..." | 37 | + | @echo "Building $(BINARY_NAME) $(VERSION) with GUI..." |
| 38 | @mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod | 38 | @mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod | ||
| 39 | - | $(GOENV) CGO_ENABLED=1 go build $(LDFLAGS) -o $(DIST_DIR)/$(BINARY_NAME) $(MAIN_PATH) | 39 | + | $(GOENV) CGO_ENABLED=1 go build $(LDFLAGS) -tags=webkit_cgo -o $(DIST_DIR)/$(BINARY_NAME) $(MAIN_PATH) |
| 40 | 40 | ||||
| 41 | build-frontend: ## Build TypeScript frontend | 41 | build-frontend: ## Build TypeScript frontend | ||
| 42 | @echo "Building TypeScript frontend..." | 42 | @echo "Building TypeScript frontend..." | ||
| 43 | @cd frontend && npm install --silent && npm run build | 43 | @cd frontend && npm install --silent && npm run build | ||
| 44 | @echo "Frontend build complete" | 44 | @echo "Frontend build complete" | ||
| 45 | 45 | ||||
| 46 | - | build-static: ## Build static binary (CGO disabled, CLI-only functionality) | 46 | + | build-no-gui: build-frontend ## Build binary without GUI (CGO disabled, CLI-only functionality) |
| 47 | - | @echo "Building static $(BINARY_NAME) $(VERSION) (CLI-only)..." | 47 | + | @echo "Building $(BINARY_NAME) $(VERSION) (CLI-only, no GUI)..." |
| 48 | @mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod | 48 | @mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod | ||
| 49 | - | $(GOENV) CGO_ENABLED=0 go build $(LDFLAGS) -o $(DIST_DIR)/$(BINARY_NAME)-static $(MAIN_PATH) | 49 | + | $(GOENV) CGO_ENABLED=0 go build $(LDFLAGS) -o $(DIST_DIR)/$(BINARY_NAME)-no-gui $(MAIN_PATH) |
| 50 | + | ||||
| 51 | + | build-static: build-no-gui ## Alias for build-no-gui (backward compatibility) | |||
| 52 | + | @echo "Note: build-static is deprecated, use build-no-gui instead" | |||
| 50 | 53 | ||||
| 51 | # GUI build with WebKitGTK 6.0 (GTK4) | 54 | # GUI build with WebKitGTK 6.0 (GTK4) | ||
| 52 | .PHONY: build-gui run-gui | 55 | .PHONY: build-gui run-gui | ||
| 53 | - | build-gui: build-frontend ## Build GUI binary with native WebKitGTK 6.0 (requires GTK4/WebKitGTK 6 dev packages) | 56 | + | build-gui: build ## Alias for default build (backward compatibility) |
| 54 | - | @echo "Building $(BINARY_NAME) (GUI, webkit_cgo)…" | 57 | + | @echo "Note: build-gui is now the default 'build' target" |
| 55 | - | @mkdir -p $(DIST_DIR) tmp tmp/go-cache tmp/go-mod | |||
| 56 | - | $(GOENV) CGO_ENABLED=1 go build $(LDFLAGS) -tags=webkit_cgo -o $(DIST_DIR)/$(BINARY_NAME) $(MAIN_PATH) | |||
| 57 | 58 | ||||
| 58 | run-gui: ## Run the GUI with native WebKitGTK 6.0 (requires GTK4/WebKitGTK 6 dev packages) | 59 | run-gui: ## Run the GUI with native WebKitGTK 6.0 (requires GTK4/WebKitGTK 6 dev packages) | ||
| 59 | @echo "Running GUI (webkit_cgo)…" | 60 | @echo "Running GUI (webkit_cgo)…" | ||