From 65e2fab1f8822919db33f3837f05f8ad91bb3cf1 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Wed, 6 Nov 2024 11:26:36 +0000 Subject: [PATCH] Makefile: Support `DESTDIR` convention Removes the need for some work arounds in `debian/rules` --- Makefile | 23 ++++++++++++----------- debian/rules | 3 +-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 486b98f..b8b8049 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +DESTDIR ?= prefix=/usr/local bin_dir=$(prefix)/bin @@ -59,19 +60,19 @@ MANPAGES_8= authbind-helper.8 all: $(TARGETS) install: $(TARGETS) - $(INSTALL_DIR) $(bin_dir) $(lib_dir) $(man1_dir) $(man8_dir) - $(INSTALL_PROGRAM) $(BINTARGETS) $(bin_dir)/. - $(INSTALL_FILE) $(LIBTARGET) $(lib_dir)/. - $(STRIP) --strip-unneeded $(lib_dir)/$(LIBTARGET) - ln -sf $(LIBTARGET) $(lib_dir)/$(LIBCANON) - $(INSTALL_PROGRAM) $(HELPER) $(libexec_dir)/. - chmod u+s $(libexec_dir)/$(HELPER) - $(INSTALL_DIR) $(etc_dir) \ - $(etc_dir)/byport $(etc_dir)/byaddr $(etc_dir)/byuid + $(INSTALL_DIR) $(DESTDIR)$(bin_dir) $(DESTDIR)$(lib_dir) $(DESTDIR)$(man1_dir) $(DESTDIR)$(man8_dir) + $(INSTALL_PROGRAM) $(BINTARGETS) $(DESTDIR)$(bin_dir)/. + $(INSTALL_FILE) $(LIBTARGET) $(DESTDIR)$(lib_dir)/. + $(STRIP) --strip-unneeded $(DESTDIR)$(lib_dir)/$(LIBTARGET) + ln -sf $(LIBTARGET) $(DESTDIR)$(lib_dir)/$(LIBCANON) + $(INSTALL_PROGRAM) $(HELPER) $(DESTDIR)$(libexec_dir)/. + chmod u+s $(DESTDIR)$(libexec_dir)/$(HELPER) + $(INSTALL_DIR) $(DESTDIR)$(etc_dir) \ + $(DESTDIR)$(etc_dir)/byport $(DESTDIR)$(etc_dir)/byaddr $(DESTDIR)$(etc_dir)/byuid install_man: $(MANPAGES_1) $(MANPAGES_8) - $(INSTALL_FILE) $(MANPAGES_1) $(man1_dir)/. - $(INSTALL_FILE) $(MANPAGES_8) $(man8_dir)/. + $(INSTALL_FILE) $(MANPAGES_1) $(DESTDIR)$(man1_dir)/. + $(INSTALL_FILE) $(MANPAGES_8) $(DESTDIR)$(man8_dir)/. libauthbind.o: libauthbind.c authbind.h $(CC) -D_REENTRANT $(CFLAGS) $(CPPFLAGS) -c -o $@ -fPIC $< diff --git a/debian/rules b/debian/rules index 579a34a..4555376 100755 --- a/debian/rules +++ b/debian/rules @@ -50,8 +50,7 @@ override_dh_auto_build: override_dh_auto_install: - dh_auto_install -- prefix=debian/$(package)/usr etc_dir=debian/$(package)/etc/authbind \ - install install_man + dh_auto_install -- prefix=/usr install install_man execute_after_dh_fixperms: # Redo the setuid mode that `dh_fixperms` removes -- 2.30.2