speakersafetyd/Makefile
Andreas Henriksson f069160e33 build: split install and install-data targets
This allows only installing the data files in case the build is done
separately (like for example when using debcargo/dh-cargo which uses
rustc --target option and thus the speakersafetyd ends up in a different
path which includes the target).

While at it also mark all targets as PHONY, since none of them are
backed by an actual file with the same name.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2023-12-11 21:57:40 +10:00

30 lines
1.1 KiB
Makefile

# SPDX-Licence-Identifier: MIT
# Copyright The Asahi Linux Contributors
BINDIR ?= /usr/bin
UNITDIR ?= /lib/systemd/system
UDEVDIR ?= /lib/udev/rules.d
SHAREDIR ?= /usr/share/
VARDIR ?= /var/
all:
cargo build --release
install: install-data
install -dDm0755 $(DESTDIR)/$(BINDIR)
install -pm0755 target/release/speakersafetyd $(DESTDIR)/$(BINDIR)/speakersafetyd
install-data:
install -dDm0755 $(DESTDIR)/$(UNITDIR)
install -pm0644 speakersafetyd.service $(DESTDIR)/$(UNITDIR)/speakersafetyd.service
install -dDm0755 $(DESTDIR)/$(UDEVDIR)
install -pm0644 95-speakersafetyd.rules $(DESTDIR)/$(UDEVDIR)/95-speakersafetyd.rules
install -dDm0755 $(DESTDIR)/$(SHAREDIR)/speakersafetyd/apple
install -pm0644 -t $(DESTDIR)/$(SHAREDIR)/speakersafetyd/apple $(wildcard conf/apple/*)
install -dDm0755 $(DESTDIR)/$(VARDIR)/speakersafetyd/blackbox
uninstall:
rm -f $(DESTDIR)/$(BINDIR)/speakersafetyd $(DESTDIR)/$(UNITDIR)/speakersafetyd.service $(DESTDIR)/$(UDEVDIR)/95-speakersafetyd.rules
rm -rf $(DESTDIR)/$(SHAREDIR)/speakersafetyd
.PHONY: all install install-data uninstall