From 7d282bf25e6b11c1e594164cdccb56460a34b42d Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 11 Apr 2020 14:17:20 +0200 Subject: [PATCH] Make UDEVDIR configurable. 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0fb94ba..892c2ba 100644 --- 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 -- 2.39.2