chiark / gitweb /
Makefile: Support `DESTDIR` convention
authorNiels Thykier <niels@thykier.net>
Wed, 6 Nov 2024 11:26:36 +0000 (11:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Nov 2024 22:42:58 +0000 (22:42 +0000)
Removes the need for some work arounds in `debian/rules`

Makefile
debian/rules

index 486b98f4d2488bb2e0921b195dd2b992f2bc4a01..b8b80490b89b444208127fdd1ee14cb2f37a48b6 100644 (file)
--- 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 $<
index 579a34ac36c687f4d6243fb5631618c9a347fc9c..455537623320326059b7687c0741f4a9d606b2b8 100755 (executable)
@@ -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