From e05e959565222307569723cc96c4a3410c56866a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Wed, 12 Jul 2017 12:11:38 +0200 Subject: [PATCH] Fix "make install" and "make uninstall" for distribution * Linux distributions requires "sudo make install" by the user to allow the automatic build system to create a package as an unprivileged user. So the Makefile should not use "sudo" by default. * Add $PREFIX for "make install" to allow distribution systems to compile against /usr and install into a temporary package directory to build a distribution package. This is used under ArchLinux: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=persosim_driver --- de.persosim.driver.linux/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/de.persosim.driver.linux/Makefile b/de.persosim.driver.linux/Makefile index fe47f2c..40b57f6 100644 --- a/de.persosim.driver.linux/Makefile +++ b/de.persosim.driver.linux/Makefile @@ -24,12 +24,14 @@ clean: rm -f *.o $(LIBNAME) $(DEPENDFILE) *Test install: $(LIBNAME) - sudo cp reader.conf /etc/reader.conf.d/persoSim - sudo cp $(LIBNAME) /usr/lib/pcsc/drivers/serial/ + mkdir -p $(PREFIX)/etc/reader.conf.d/ + cp reader.conf $(PREFIX)/etc/reader.conf.d/persoSim + mkdir -p $(PREFIX)/usr/lib/pcsc/drivers/serial/ + cp $(LIBNAME) $(PREFIX)/usr/lib/pcsc/drivers/serial/ uninstall: - sudo rm -f /etc/reader.conf.d/persoSim - sudo rm -f /usr/lib/pcsc/drivers/serial/$(LIBNAME) + rm -f $(PREFIX)/etc/reader.conf.d/persoSim + rm -f $(PREFIX)/usr/lib/pcsc/drivers/serial/$(LIBNAME) tests: hexStringTest