blob: 69192e6801b2bbc269ff73cf9e0b467f87c418ec [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
Josh Bleecher Snyder5ae245b2025-07-08 22:00:24 +000022 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$(LDFLAGS)" -tags=innie -o embedded/sketch-linux/sketch-linux-amd64 ./cmd/sketch
23 CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="$(LDFLAGS)" -tags=innie -o embedded/sketch-linux/sketch-linux-arm64 ./cmd/sketch
Josh Bleecher Snyder1c18ec92025-07-08 10:55:54 -070024
25webui-assets:
26 rm -rf embedded/webui-dist
27 go run ./cmd/genwebui -- embedded/webui-dist
28
29clean:
30 @echo "Cleaning build artifacts..."
31 rm -f sketch
32 rm -rf embedded/sketch-linux embedded/webui-dist
33 cd webui && rm -rf node_modules dist