]> git.sesse.net Git - bmusb/commitdiff
Make UDEVDIR configurable.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 11 Apr 2020 12:17:20 +0000 (14:17 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 11 Apr 2020 12:17:20 +0000 (14:17 +0200)
This makes the udev directory overridable on the command line.
If none is given, it defaults to getting the directory from pkg-config,
if you have the udev development package installed, and failing that,
hard-codes /lib/udev as before.

All of this is based on research and suggestions from speps.

Makefile

index 0fb94ba182c136b164bed48086ec921e7d049814..892c2ba74c1957a3ecd4aebc76e5f557d802261e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,8 @@ RANLIB := ranlib
 INSTALL := install
 PREFIX := /usr/local
 LIBDIR := $(PREFIX)/lib
+UDEVDIR ?= $(shell $(PKG_CONFIG) --variable udevdir udev)
+UDEVDIR ?= /lib/udev
 LIB := libbmusb.a
 SODEV := libbmusb.so
 SONAME := libbmusb.so.6
@@ -40,11 +42,11 @@ install: all
                $(DESTDIR)$(LIBDIR) \
                $(DESTDIR)$(LIBDIR)/pkgconfig \
                $(DESTDIR)$(PREFIX)/include/bmusb \
-               $(DESTDIR)/lib/udev/rules.d
+               $(DESTDIR)$(UDEVDIR)/rules.d
        $(INSTALL) -m 755 -o root -g root $(LIB) $(SOLIB) $(DESTDIR)$(LIBDIR)
        $(LN) -sf $(SOLIB) $(DESTDIR)$(LIBDIR)/$(SONAME)
        $(LN) -sf $(SOLIB) $(DESTDIR)$(LIBDIR)/$(SODEV)
        $(INSTALL) -m 755 -o root -g root bmusb/bmusb.h bmusb/fake_capture.h $(DESTDIR)$(PREFIX)/include/bmusb
        $(INSTALL) -m 644 -o root -g root bmusb.pc $(DESTDIR)$(LIBDIR)/pkgconfig
-       $(INSTALL) -m 644 -o root -g root 70-bmusb.rules $(DESTDIR)/lib/udev/rules.d
+       $(INSTALL) -m 644 -o root -g root 70-bmusb.rules $(DESTDIR)$(UDEVDIR)/rules.d