blob: 2b31b661b9c632bbd077ccb0b86b8bd39d7ee3ab [file] [log] [blame]
Josh Bleecher Snyder1c18ec92025-07-08 10:55:54 -07001# Makefile for building sketch with embedded assets
2#
3# Two-layer architecture:
4# 1. Linux binary ("innie") - runs in container, embeds webui assets
5# 2. Native binary ("outie") - runs on user's machine, embeds innie
6
7BUILD_TIME := $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
8COMMIT := $(shell git rev-parse HEAD 2>/dev/null || echo "unknown")
9VERSION := $(shell git describe --tags --dirty --always 2>/dev/null || echo "dev")
10LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(BUILD_TIME) -X main.makefile=true
11
12.PHONY: all clean help
13.PHONY: outie innie
14.PHONY: webui-assets
15
16all: outie
17
18outie: innie
19 go build -ldflags="$(LDFLAGS)" -tags=outie -o sketch ./cmd/sketch
20
21innie: webui-assets
22 CGO_ENABLED=0 GOOS=linux go build -ldflags="$(LDFLAGS)" -tags=innie -o embedded/sketch-linux/sketch-linux ./cmd/sketch
23
24webui-assets:
25 rm -rf embedded/webui-dist
26 go run ./cmd/genwebui -- embedded/webui-dist
27
28clean:
29 @echo "Cleaning build artifacts..."
30 rm -f sketch
31 rm -rf embedded/sketch-linux embedded/webui-dist
32 cd webui && rm -rf node_modules dist