-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (73 loc) · 2.67 KB
/
Makefile
File metadata and controls
91 lines (73 loc) · 2.67 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
DATADIR ?= $(PREFIX)/share
APPDIR ?= $(DATADIR)/kara
TARGET := kara-gate
CARGO ?= cargo
PROFILE ?= release
.PHONY: all build release debug check clean install install-config uninstall \
pkg srcinfo reload run deps-check fmt clippy test
all: build
build: release
release:
$(CARGO) build --release
debug:
$(CARGO) build
check:
$(CARGO) check
test:
$(CARGO) test
fmt:
$(CARGO) fmt --all
clippy:
$(CARGO) clippy --all-targets
run:
$(CARGO) run -p kara-gate
deps-check:
@command -v cargo >/dev/null 2>&1 || { echo "error: cargo not found — install rustup"; exit 1; }
@command -v pkg-config >/dev/null 2>&1 || { echo "error: pkg-config not found"; exit 1; }
@pkg-config --exists xkbcommon || { \
echo "Missing runtime dependency: libxkbcommon"; \
echo "On Arch/Artix: doas pacman -S libxkbcommon"; \
exit 1; \
}
@echo "build dependencies OK"
install:
@test -f "target/release/$(TARGET)" || { echo "error: run 'make' first to build"; exit 1; }
install -d "$(DESTDIR)$(BINDIR)"
install -m 0755 "target/release/$(TARGET)" "$(DESTDIR)$(BINDIR)/$(TARGET)"
@test -f "target/release/kara-summon" && \
install -m 0755 "target/release/kara-summon" "$(DESTDIR)$(BINDIR)/kara-summon" || true
@test -f "target/release/kara-glimpse" && \
install -m 0755 "target/release/kara-glimpse" "$(DESTDIR)$(BINDIR)/kara-glimpse" || true
@test -f "target/release/kara-whisper" && \
install -m 0755 "target/release/kara-whisper" "$(DESTDIR)$(BINDIR)/kara-whisper" || true
install -d "$(DESTDIR)$(APPDIR)"
install -m 0644 example/kara-gate.conf "$(DESTDIR)$(APPDIR)/kara-gate.conf.example"
install -d "$(DESTDIR)$(DATADIR)/wayland-sessions"
install -m 0644 session/kara.desktop "$(DESTDIR)$(DATADIR)/wayland-sessions/kara.desktop"
install -d "$(DESTDIR)$(DATADIR)/licenses/kara"
install -m 0644 LICENSE "$(DESTDIR)$(DATADIR)/licenses/kara/LICENSE"
@mkdir -p "$(HOME)/.config/kara"
@if [ -f "$(HOME)/.config/kara/kara-gate.conf" ]; then \
echo "Config exists: ~/.config/kara/kara-gate.conf (not overwriting)"; \
else \
install -m 0644 example/kara-gate.conf "$(HOME)/.config/kara/kara-gate.conf"; \
echo "Installed config: ~/.config/kara/kara-gate.conf"; \
fi
uninstall:
rm -f "$(DESTDIR)$(BINDIR)/$(TARGET)"
rm -f "$(DESTDIR)$(BINDIR)/kara-summon"
rm -f "$(DESTDIR)$(BINDIR)/kara-glimpse"
rm -f "$(DESTDIR)$(BINDIR)/kara-whisper"
rm -f "$(DESTDIR)$(APPDIR)/kara-gate.conf.example"
rm -f "$(DESTDIR)$(DATADIR)/wayland-sessions/kara.desktop"
rm -f "$(DESTDIR)$(DATADIR)/licenses/kara/LICENSE"
pkg:
makepkg -fs
srcinfo:
makepkg --printsrcinfo > .SRCINFO
reload:
pkill -USR1 -x $(TARGET) || true
clean:
$(CARGO) clean