1# SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
2#
3# SPDX-License-Identifier: CC0-1.0
4
5.PHONY: all fmt fmt-check lint check test test-quiet ci dist clean install
6
7all: fmt lint check test-quiet
8
9# Bundle all modules into single distributable file
10dist: dist/wt
11
12dist/wt: src/main.lua $(wildcard src/wt/*.lua) $(wildcard src/wt/cmd/*.lua) scripts/bundle.lua
13 @mkdir -p dist
14 lua scripts/bundle.lua > dist/wt
15 chmod +x dist/wt
16
17clean:
18 rm -rf dist
19
20install: dist/wt
21 @mkdir -p ~/.local/bin
22 cp dist/wt ~/.local/bin/
23
24fmt:
25 lx fmt
26
27fmt-check:
28 lx fmt --check
29
30lint:
31 lx lint
32
33check:
34 lx check
35
36test:
37 lx test
38
39# For agents: show full output only on failure, otherwise just summary
40test-quiet:
41 @output=$$(lx test 2>&1); rc=$$?; \
42 if [ $$rc -eq 0 ]; then \
43 echo "$$output" | tail -1; \
44 else \
45 echo "$$output"; \
46 fi; \
47 exit $$rc
48
49ci: fmt-check lint check test