changeset 275:776a076d1afa

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 <debian.tormod@gmail.com>
author Tormod Volden <debian.tormod@gmail.com>
date Wed, 05 Jun 2013 19:57:09 -0600
parents d9d02dbf76a6
children 49010c6653e7
files Makefile
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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