-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (38 loc) · 1.69 KB
/
Copy pathMakefile
File metadata and controls
52 lines (38 loc) · 1.69 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
# lowtech — minimal Logitech HID++ tool. Run `make help` for targets.
CARGO ?= cargo
BIN := lowtech
UDEV_RULE := linux/42-logitech-hidpp.rules
UDEV_DEST := /etc/udev/rules.d/
.PHONY: help build release install uninstall install-udev uninstall-udev deps fmt clippy check test clean
help:
@echo "lowtech — make targets:"
@echo " build build the release binary (target/release/$(BIN))"
@echo " install install via cargo (to ~/.cargo/bin)"
@echo " uninstall remove the cargo-installed binary"
@echo " install-udev [Linux] install udev rule for non-root device access"
@echo " uninstall-udev [Linux] remove the udev rule"
@echo " deps show the binary dynamic-library dependencies"
@echo " fmt clippy check test clean usual cargo wrappers"
build release:
$(CARGO) build --release
install:
$(CARGO) install --path .
uninstall:
$(CARGO) uninstall $(BIN)
# The working counterpart to Solaar's broken `make install_udev` (Linux only).
install-udev:
@if [ "$$(uname -s)" = "Linux" ]; then sudo cp $(UDEV_RULE) $(UDEV_DEST) && sudo udevadm control --reload-rules && sudo udevadm trigger && echo "Installed - replug the receiver."; else echo "install-udev is Linux-only (macOS uses Input Monitoring, not udev)."; fi
uninstall-udev:
@if [ "$$(uname -s)" = "Linux" ]; then sudo rm -f $(UDEV_DEST)$(notdir $(UDEV_RULE)) && sudo udevadm control --reload-rules && sudo udevadm trigger; else echo "install-udev is Linux-only."; fi
deps: build
@if [ "$$(uname -s)" = "Darwin" ]; then otool -L target/release/$(BIN); else ldd target/release/$(BIN); fi
fmt:
$(CARGO) fmt
clippy:
$(CARGO) clippy --release
check:
$(CARGO) check
test:
$(CARGO) test
clean:
$(CARGO) clean