Makefile: add install{,-udevrule} and uninstall

This is supposed to help distro packagers of ltunify.
This commit is contained in:
Peter Wu
2013-07-23 14:10:36 +02:00
parent 137bd026ce
commit 9d5ac81f32
2 changed files with 32 additions and 2 deletions

View File

@@ -1,6 +1,14 @@
override CFLAGS := -g -O2 -Wall -Wextra -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=4 $(CFLAGS) override CFLAGS := -g -O2 -Wall -Wextra -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=4 $(CFLAGS)
# for install-home
BINDIR ?= $(HOME)/bin BINDIR ?= $(HOME)/bin
# for install and uninstall
DESTDIR ?=
bindir ?= /usr/local/bin
udevrulesdir ?= /etc/udev/rules.d
udevrule = 42-logitech-unify-permissions.rules
%: %.c %: %.c
$(CC) $(CFLAGS) -o $(OUTDIR)$@ $< $(CC) $(CFLAGS) -o $(OUTDIR)$@ $<
@@ -10,9 +18,19 @@ read-dev-usbmon: read-dev-usbmon.c hidraw.c
ltunify: ltunify.c hidpp20.c ltunify: ltunify.c hidpp20.c
.PHONY: all clean install-home .PHONY: all clean install-home install install-udevrule uninstall
clean: clean:
rm -f ltunify read-dev-usbmon hidraw rm -f ltunify read-dev-usbmon hidraw
install-home: ltunify install-home: ltunify
install -m755 -D ltunify $(BINDIR)/ltunify install -m755 -D ltunify $(BINDIR)/ltunify
# System-wide installation
install: ltunify install-udevrule
install -m755 -D ltunify $(DESTDIR)$(bindir)/ltunify
install-udevrule: udev/$(udevrule)
install -m644 -D udev/$(udevrule) $(DESTDIR)$(udevrulesdir)/$(udevrule)
uninstall:
$(RM) $(DESTDIR)$(bindir)/ltunify $(DESTDIR)$(udevrulesdir)/$(udevrule)

View File

@@ -33,7 +33,19 @@ Usage of USB debugger:
Pairing tool (ltunify) Pairing tool (ltunify)
ltunify allows you to pair new devices, unpair existing devices or view ltunify allows you to pair new devices, unpair existing devices or view
information for those devices. Run `ltunify --help` for available options. information for those devices. In order to build the ltunify binary and install
it to `$HOME/bin/ltunify`:
make ltunify
make install-home
If you intend to package ltunify or otherwise install it system-wide with a
udevrule, you can use:
make ltunify
make install DESTDIR=$pkgdir bindir=/usr/bin udevrulesdir=/lib/udev/rules.d
Once installed, run `ltunify --help` for available options.
Usage of the pairing tool is pretty straight-forward. Example session: Usage of the pairing tool is pretty straight-forward. Example session: