a73x

Makefile

Ref:   Size: 1.6 KiB

ZIG ?= zig
OPT ?= ReleaseFast
FLAMEGRAPH ?= inferno-flamegraph
STACKCOLLAPSE ?= inferno-collapse-perf

.PHONY: build run test bench profile clean test-render golden-update bench-baseline bench-check

build:
	$(ZIG) build

run: build
	$(ZIG) build run

test:
	$(ZIG) build test

bench:
	$(ZIG) build -Doptimize=$(OPT)
	WAYSTTY_BENCH=1 ./zig-out/bin/waystty 2>bench.log || true
	@echo "--- frame timing ---"
	@grep -A 12 "waystty frame timing" bench.log || echo "(no timing data found)"

profile:
	$(ZIG) build -Doptimize=$(OPT)
	WAYSTTY_BENCH=1 perf record -g --call-graph dwarf,16384 -F 999 --no-inherit -o perf.data -- \
		./zig-out/bin/waystty 2>bench.log
	perf script -i perf.data \
		| $(STACKCOLLAPSE) \
		| $(FLAMEGRAPH) > flamegraph.svg
	@echo "--- frame timing ---"
	@grep -A 12 "waystty frame timing" bench.log || echo "(no timing data found)"
	xdg-open flamegraph.svg

test-render:
	$(ZIG) build test-render

golden-update:
	WAYSTTY_GOLDEN_UPDATE=1 $(ZIG) build test-render

bench-baseline:
	$(ZIG) build bench-baseline -Doptimize=$(OPT)

bench-check:
	$(ZIG) build bench-check -Doptimize=$(OPT)

.PHONY: scenario scenario-update

scenario:
	$(ZIG) build
	@for f in tests/scenarios/*.scenario; do \
	  echo "=== $$f ==="; \
	  ./zig-out/bin/waystty --scenario "$$f" || exit $$?; \
	done

scenario-update:
	$(ZIG) build
	@for f in tests/scenarios/*.scenario; do \
	  echo "=== $$f (update goldens) ==="; \
	  WAYSTTY_SCENARIO_UPDATE=1 ./zig-out/bin/waystty --scenario "$$f" || exit $$?; \
	done

clean:
	rm -rf zig-out .zig-cache perf.data bench.log flamegraph.svg tests/golden/output