From 40580c0409449f1a02664649e97bd397ed9eb171 Mon Sep 17 00:00:00 2001 From: Palmer Dabbelt Date: Wed, 13 May 2015 14:52:19 -0700 Subject: [PATCH] Change the behavior of the DESTDIR make variable DESTDIR is a common make idiom. As per the GNU coding standards https://www.gnu.org/prep/standards/html_node/DESTDIR.html "DESTDIR is a variable prepended to each installed target file, like this: $(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo $(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a The DESTDIR variable is specified by the user on the make command line as an absolute file name. For example: make DESTDIR=/tmp/stage install DESTDIR should be supported only in the install* and uninstall* targets, as those are the only targets where it is useful. If your installation step would normally install /usr/local/bin/foo and /usr/local/lib/libfoo.a, then an installation invoked as in the example above would install /tmp/stage/usr/local/bin/foo and /tmp/stage/usr/local/lib/libfoo.a instead." The current Makefile.in uses DESTDIR, but has a slightly non-standard behavior: the target install location doesn't include "$prefix". This breaks package managers, because stuff ends up getting installed to the wrong location. Unfortunately the only way I can think of to fix this involves silently changing the behavior of DESTDIR. Hopefully nobody is using it...? [port of 8a2088b59162fe16c16d26ddc1cfcaaaa8c4156f in riscv-fesvr] --- Makefile.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index d9841e2..1d8d9b2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -55,14 +55,14 @@ enable_stow := @enable_stow@ ifeq ($(enable_stow),yes) stow_pkg_dir := $(prefix)/pkgs - DESTDIR ?= $(stow_pkg_dir)/$(project_name)-$(project_ver) + INSTALLDIR ?= $(DESTDIR)/$(stow_pkg_dir)/$(project_name)-$(project_ver) else - DESTDIR ?= $(prefix) + INSTALLDIR ?= $(DESTDIR)/$(prefix) endif -install_hdrs_dir := $(DESTDIR)/include/$(project_name) -install_libs_dir := $(DESTDIR)/lib -install_exes_dir := $(DESTDIR)/bin +install_hdrs_dir := $(INSTALLDIR)/include/$(project_name) +install_libs_dir := $(INSTALLDIR)/lib +install_exes_dir := $(INSTALLDIR)/bin #------------------------------------------------------------------------- # List of subprojects -- 2.30.2