The DESTDIR feature is orthogonal to the existing --prefix option
to configure, and the GNU make manual strongly recommends to support
the feature, so this patch implements it.
The feature works as follows. The content of the DESTDIR make variable
is prepended to each installed target file. It is not set at all in
the Makefile, so files are installed into their expected locations by
default. For example, with the patch applied, one may say
make DESTDIR=/tmp/stage install
to install in /tmp/stage/usr/local.
Other than that, specifying DESTDIR has no effect and the value is
not included in any file contents.
$(Q) rm -f GPATH GRTAGS GSYMS GTAGS
install: all man
- $(MKDIR_P) $(bindir) $(mandir)
+ $(MKDIR_P) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)
$(INSTALL) -s --strip-program $(STRIP) -m 755 \
- $(prefixed_executables) $(bindir)
- $(INSTALL) -m 644 $(man_pages) $(mandir)
- $(MKDIR_P) $(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain
+ $(prefixed_executables) $(DESTDIR)$(bindir)
+ $(INSTALL) -m 644 $(man_pages) $(DESTDIR)$(mandir)
+ $(MKDIR_P) $(DESTDIR)$(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain
$(tarball):
$(Q) rm -rf $(tarball) $(tarball_pfx)