blob: dc614d4041a7a88f21f093d982490b1953f36f90 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# sl0ppty — see DESIGN.md
#
# zig is the C compiler: it is already required to build libghostty-vt, and it
# gives us static musl linking and cross-compilation for free (D12).
ZIG ?= $(HOME)/zig-0.16.0/zig
CC := $(ZIG) cc
VT := vendor/libghostty-vt
VT_OUT := $(VT)/zig-out
VT_LIB := $(VT_OUT)/lib/libghostty-vt.a
VT_INC := $(VT_OUT)/include
CFLAGS := -std=c23 -O1 -g -Wall -Wextra -Wno-unused-parameter \
-I$(VT_INC) -Isrc
LDFLAGS :=
SRC := $(wildcard src/*.c)
OBJ := $(SRC:src/%.c=build/%.o)
BIN := build/sl0ppty
.PHONY: all clean vendor run test test-live test-all smoke help
.DEFAULT_GOAL := help
help: ## show this
@grep -hE '^[a-z-]+:.*##' $(MAKEFILE_LIST) | sed 's/:.*##/\t/' | expand -t20
all: $(BIN) ## build sl0ppty
$(BIN): $(OBJ) $(VT_LIB)
$(CC) $(OBJ) $(VT_LIB) -o $@ $(LDFLAGS)
build/%.o: src/%.c $(VT_LIB) | build
$(CC) $(CFLAGS) -c $< -o $@
build:
@mkdir -p build
$(VT_LIB):
@$(MAKE) vendor
vendor: ## build the vendored libghostty-vt (needs zig 0.16)
cd $(VT) && PATH="$(dir $(ZIG)):$$PATH" zig build -Demit-lib-vt -Doptimize=ReleaseFast
TEST_BIN := build/input_test
$(TEST_BIN): tests/input_test.c src/input.c $(VT_LIB) | build
$(CC) $(CFLAGS) tests/input_test.c src/input.c $(VT_LIB) -o $@
KDL_TEST := build/kdl_test
$(KDL_TEST): tests/kdl_test.c src/kdl.c | build
$(CC) $(CFLAGS) tests/kdl_test.c src/kdl.c -o $@
test: $(BIN) $(TEST_BIN) $(KDL_TEST) ## unit + headless checks (fast)
./$(TEST_BIN)
@echo
./$(KDL_TEST)
@echo
cd tests && python3 test_screen.py && python3 test_layout.py && python3 test_tabs.py && python3 test_osc5577.py && \
python3 test_responsive.py && python3 test_finder.py && \
python3 test_config.py && python3 test_layout_files.py && python3 test_drag.py && python3 test_hover.py && python3 test_scroll.py && python3 test_clipboard.py && python3 test_split_ux.py && python3 test_graphics.py
test-live: $(BIN) ## the checks that need a real tty (slow)
python3 tests/live_m0.py
@echo
python3 tests/live_input.py
@echo
python3 tests/test_session.py
test-all: test test-live ## everything
smoke: $(BIN) ## compose a screen headlessly and print it
./$(BIN) --headless --cols 40 --rows 6 -- /bin/sh -c 'printf "hello \033[1;32msl0ppty\033[0m\n"; echo "wide: 日本語"'
run: $(BIN) ## build and run
./$(BIN)
clean: ## remove our build output (not the vendor lib)
rm -rf build
|