From 9d5ac81f3255179bab5a8c084daae13da8c86617 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 23 Jul 2013 14:10:36 +0200 Subject: Makefile: add install{,-udevrule} and uninstall This is supposed to help distro packagers of ltunify. --- Makefile | 20 +++++++++++++++++++- README.txt | 14 +++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d93022f..9afbb54 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,14 @@ override CFLAGS := -g -O2 -Wall -Wextra -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=4 $(CFLAGS) +# for install-home BINDIR ?= $(HOME)/bin +# for install and uninstall +DESTDIR ?= +bindir ?= /usr/local/bin +udevrulesdir ?= /etc/udev/rules.d + +udevrule = 42-logitech-unify-permissions.rules + %: %.c $(CC) $(CFLAGS) -o $(OUTDIR)$@ $< @@ -10,9 +18,19 @@ read-dev-usbmon: read-dev-usbmon.c hidraw.c ltunify: ltunify.c hidpp20.c -.PHONY: all clean install-home +.PHONY: all clean install-home install install-udevrule uninstall clean: rm -f ltunify read-dev-usbmon hidraw install-home: 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) diff --git a/README.txt b/README.txt index 8dc25dc..645eac2 100644 --- a/README.txt +++ b/README.txt @@ -33,7 +33,19 @@ Usage of USB debugger: Pairing tool (ltunify) 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: -- cgit v1.2.1