Initial patterm project
This commit is contained in:
42
Makefile
Normal file
42
Makefile
Normal file
@@ -0,0 +1,42 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
ROOT := $(abspath .)
|
||||
VENDOR := $(ROOT)/third_party/libghostty-vt
|
||||
SOURCE := $(VENDOR)/source
|
||||
INSTALL := $(VENDOR)/install
|
||||
COMMIT := $(shell cat $(VENDOR)/COMMIT)
|
||||
|
||||
.PHONY: deps deps-fetch deps-build clean-deps spike patterm test
|
||||
|
||||
# `make deps` fetches and builds libghostty-vt at the pinned commit.
|
||||
# Re-runs are idempotent on success; touch $(VENDOR)/COMMIT to force a rebuild.
|
||||
deps: $(INSTALL)/lib/libghostty-vt.a
|
||||
|
||||
$(SOURCE)/.git/HEAD:
|
||||
@echo ">> cloning ghostty-org/ghostty @ $(COMMIT)"
|
||||
@rm -rf $(SOURCE)
|
||||
@git clone --filter=blob:none https://github.com/ghostty-org/ghostty.git $(SOURCE)
|
||||
@cd $(SOURCE) && git checkout --detach $(COMMIT)
|
||||
|
||||
deps-fetch: $(SOURCE)/.git/HEAD
|
||||
|
||||
$(INSTALL)/lib/libghostty-vt.a: $(SOURCE)/.git/HEAD
|
||||
@command -v zig >/dev/null || { echo "ERROR: zig not on PATH (need >=0.15.2 to build libghostty-vt)"; exit 1; }
|
||||
@echo ">> building libghostty-vt with zig"
|
||||
@cd $(SOURCE) && zig build -Demit-lib-vt --prefix $(INSTALL)
|
||||
@test -f $(INSTALL)/lib/libghostty-vt.a || { echo "ERROR: expected static lib at $(INSTALL)/lib/libghostty-vt.a"; exit 1; }
|
||||
@echo ">> libghostty-vt installed under $(INSTALL)"
|
||||
|
||||
deps-build: $(INSTALL)/lib/libghostty-vt.a
|
||||
|
||||
clean-deps:
|
||||
rm -rf $(SOURCE) $(INSTALL)
|
||||
|
||||
spike: deps
|
||||
go build -o ./bin/spike ./cmd/spike
|
||||
|
||||
patterm: deps
|
||||
go build -o ./bin/patterm ./cmd/patterm
|
||||
|
||||
test: deps
|
||||
go test ./...
|
||||
Reference in New Issue
Block a user