Files
splinter/Makefile
T
Konrad d2e06b316d splinter: curses TUI on NetBSD curses, CDE palettes as themes
The harness now has the interface it was missing: a chat pane on three
quarters of the screen, a sidebar on one quarter, a status bar underneath.

- vendor/netbsd-curses: NetBSD's curses and terminfo, ported edition,
  vendored with PROVENANCE.md. The build of that one directory needs GNU
  make; splinter's own Makefile stays POSIX make.
- tools/genpalettes.py turns CDE's *.dp palette files into a C table. 42
  palettes, generated, checked in with the generator, so the source of every
  colour is a file in the CDE tree and not a guess.
- themes: roles are derived, not invented - background is the darkest of the
  eight colour sets, foreground the lightest, border the second darkest,
  accent the most saturated of the rest, status the accent darkened by a
  third. Delphinium is the default. Unknown palette is an error.
- colours map to the terminal through xterm's 256-colour cube when available,
  the 16 basic colours otherwise, so a palette looks the same everywhere
  within what the terminal can show.
- ui.c redraws only on change; the sidebar shows session, transport, theme
  and last-turn numbers. Widgets are a labelled empty area - the registry
  lands next.

Six test binaries green, including test_theme (42 palettes, ordering
invariants, unknown name rejected, colour indices in range).
2026-11-07 11:27:09 +00:00

105 lines
3.5 KiB
Makefile

# splinter -- POSIX make for our own code, GNU make only for the vendored curses.
#
# make builds the binary (with the curses TUI)
# make check builds and runs every test binary
# make curses builds the vendored NetBSD curses explicitly
# make clean removes generated files only
#
# Generated files never mix with handwritten ones, and nothing here needs a
# configure step: the dependency set is libc, the vendored NetBSD curses, and
# curl(1) at runtime if you use --endpoint.
CC ?= cc
CFLAGS ?= -std=c99 -O2 -Wall -Wextra -Werror -D_POSIX_C_SOURCE=200809L \
-Iinclude -Isrc -Ivendor/netbsd-curses/libcurses
LDFLAGS ?=
LIBS ?=
PREFIX ?= /usr/local
CURSES_DIR = vendor/netbsd-curses
CURSES_A = $(CURSES_DIR)/libcurses/libcurses.a \
$(CURSES_DIR)/libterminfo/libterminfo.a
BIN = splinter
OBJ = src/buf.o src/tool.o src/session.o src/transport.o src/transport_curl.o \
src/builtin.o src/agent.o src/theme.o src/palettes.o src/ui.o
TESTS = tests/test_buf tests/test_tool tests/test_session tests/test_transport \
tests/test_agent tests/test_theme
all: $(BIN)
# The vendored tree ships a GNUmakefile; this is the only place that needs GNU
# make, and it is why the comment above says so out loud.
$(CURSES_A):
cd $(CURSES_DIR) && $(MAKE) -f GNUmakefile libcurses/libcurses.a \
libterminfo/libterminfo.a
curses: $(CURSES_A)
$(BIN): $(OBJ) src/main.o $(CURSES_A)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) src/main.o $(CURSES_A) $(LIBS)
src/buf.o: src/buf.c include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/buf.c
src/tool.o: src/tool.c include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/tool.c
src/session.o: src/session.c include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/session.c
src/transport.o: src/transport.c include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/transport.c
src/transport_curl.o: src/transport_curl.c include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/transport_curl.c
src/builtin.o: src/builtin.c include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/builtin.c
src/agent.o: src/agent.c include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/agent.c
src/theme.o: src/theme.c src/theme.h src/palettes.h include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/theme.c
src/palettes.o: src/palettes.c src/palettes.h
$(CC) $(CFLAGS) -c -o $@ src/palettes.c
src/ui.o: src/ui.c src/ui.h src/theme.h include/splinter.h
$(CC) $(CFLAGS) -c -o $@ src/ui.c
src/main.o: src/main.c include/splinter.h src/ui.h src/theme.h
$(CC) $(CFLAGS) -c -o $@ src/main.c
tests/test_buf: tests/test_buf.c $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_buf.c $(OBJ) $(CURSES_A) $(LIBS)
tests/test_tool: tests/test_tool.c $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_tool.c $(OBJ) $(CURSES_A) $(LIBS)
tests/test_session: tests/test_session.c $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_session.c $(OBJ) $(CURSES_A) $(LIBS)
tests/test_transport: tests/test_transport.c $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_transport.c $(OBJ) $(CURSES_A) $(LIBS)
tests/test_agent: tests/test_agent.c $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_agent.c $(OBJ) $(CURSES_A) $(LIBS)
tests/test_theme: tests/test_theme.c $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_theme.c $(OBJ) $(CURSES_A) $(LIBS)
check: $(BIN) $(TESTS)
@set -e; for t in $(TESTS); do echo "== $$t"; ./$$t; done; \
echo "all tests passed"
install: $(BIN)
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp $(BIN) $(DESTDIR)$(PREFIX)/bin/
clean:
rm -f $(BIN) $(OBJ) src/main.o $(TESTS)
.PHONY: all check curses install clean