# HG changeset patch # User Tormod Volden # Date 1370483829 21600 # Node ID 776a076d1afa5252f0cfb88e3346c7811ad3a43d # Parent d9d02dbf76a6061bae9da3cb1994ad13dd5bb418 Makefile: Allow DESTDIR for distribution package creation Build infrastructures for distribution package management like Debian and Redhat use DESTDIR to designate a virtual root directory for the package contents, as per the GNU convention: http://www.gnu.org/prep/standards/html_node/DESTDIR.html To specify a simple installation directory target, use INSTALLDIR instead. Also use "install" to create the directory if needed. Signed-off-by: Tormod Volden diff -r d9d02dbf76a6 -r 776a076d1afa Makefile --- a/Makefile Wed Jun 05 10:55:18 2013 -0600 +++ b/Makefile Wed Jun 05 19:57:09 2013 -0600 @@ -7,7 +7,11 @@ #PROGSUFFIX := .exe #BUILDTPREFIX=i586-mingw32msvc- -DESTDIR ?= /usr/local/bin +ifneq ($(DESTDIR),) +INSTALLDIR = $(DESTDIR)/usr/bin +else +INSTALLDIR ?= /usr/local/bin +endif # this are probably pointless but they will make sure # the variables are set without overriding the environment @@ -134,8 +138,8 @@ .PHONY: install install: - mkdir -p $(DESTDIR) - cp $(MAIN_TARGETS) $(DESTDIR) + install -d $(INSTALLDIR) + install $(MAIN_TARGETS) $(INSTALLDIR) .PHONY: test test: all test/runtests