comparison Makefile @ 270:35b6787a5b39

Allow make install destination to be overridden Instead of hard coding /usr/local/bin as the installation location for make install, allow it to be overridden with DESTDIR. This is based on a patch submitted by Tormod Volden <debian.tormod@gmail.com> with minor modifications - notably that there is no need to silence the echoing of the commands for make install.
author William Astle <lost@l-w.ca>
date Sun, 07 Apr 2013 01:18:31 -0600
parents 1c70570e3d42
children f6acfc659dd9
comparison
equal deleted inserted replaced
269:1c70570e3d42 270:35b6787a5b39
4 # PROGSUFFIX: suffix added to binaries 4 # PROGSUFFIX: suffix added to binaries
5 # BUILDTPREFIX: prefix added to build utilities (cc, etc.) for xcompile 5 # BUILDTPREFIX: prefix added to build utilities (cc, etc.) for xcompile
6 # can also set them when invoking "make" 6 # can also set them when invoking "make"
7 #PROGSUFFIX := .exe 7 #PROGSUFFIX := .exe
8 #BUILDTPREFIX=i586-mingw32msvc- 8 #BUILDTPREFIX=i586-mingw32msvc-
9
10 DESTDIR ?= /usr/local/bin
9 11
10 # C compiler 12 # C compiler
11 CC := $(BUILDTPREFIX)cc 13 CC := $(BUILDTPREFIX)cc
12 14
13 # ar 15 # ar
125 print-%: 127 print-%:
126 @echo $* = $($*) 128 @echo $* = $($*)
127 129
128 .PHONY: install 130 .PHONY: install
129 install: 131 install:
130 cp $(MAIN_TARGETS) /usr/local/bin/ 132 mkdir -p $(DESTDIR)
133 cp $(MAIN_TARGETS) $(DESTDIR)
131 134
132 .PHONY: test 135 .PHONY: test
133 test: all test/runtests 136 test: all test/runtests
134 @test/runtests 137 @test/runtests
135 138