From 90418566e363d8cef63fc9d9fcad73a7290927cf Mon Sep 17 00:00:00 2001 From: Lucas Ramage Date: Sat, 1 Feb 2020 10:10:25 -0500 Subject: [PATCH] Respect PREFIX variable for copy-install (#294) --- Makefile | 24 ++++++++++++------------ README.md | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 0f955d7..f8b6985 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SHELL=/bin/sh - +PREFIX?=/usr/local PKGNAME=stack_blackbox BASEDIR?=$(HOME) OUTPUTDIR?="$(BASEDIR)/debbuild-${PKGNAME}" @@ -9,9 +9,9 @@ all: @echo ' make update Update any generated files' @echo ' make packages-rpm Make RPM packages' @echo ' make packages-deb Make DEB packages' - @echo ' make symlinks-install Make symlinks in /usr/local/bin/' - @echo ' make copy-install Copy "bin" files to /usr/local/bin/' - @echo ' make usrlocal-uninstall Remove blackbox files from /usr/local/bin/' + @echo ' make symlinks-install Make symlinks in ${PREFIX}/bin/' + @echo ' make copy-install Copy "bin" files to ${PREFIX}/bin/' + @echo ' make copy-uninstall Remove blackbox files from ${PREFIX}/bin/' @echo ' make test Run tests' install: @@ -55,8 +55,8 @@ unlock-rpm: # Manual install # symlinks-install: - @echo 'Symlinking files from ./bin to /usr/local/bin' - @cd bin && for f in `find . -type f -iname "*" ! -iname "Makefile"`; do ln -fs `pwd`/$$f /usr/local/bin/$$f; done + @echo "Symlinking files from ./bin to ${PREFIX}/bin" + @cd bin && for f in `find . -type f -iname "*" ! -iname "Makefile"`; do ln -fs `pwd`/$$f $(PREFIX)/bin/$$f; done @echo 'Done.' manual-install: @@ -67,13 +67,13 @@ manual-install: $(MAKE) symlinks-install copy-install: - @echo 'Copying files from ./bin to /usr/local/bin' - @cd bin && for f in `find . -type f -iname "*" ! -iname "Makefile"`; do cp `pwd`/$$f /usr/local/bin/$$f; done + @echo "Copying files from ./bin to ${PREFIX}/bin" + @cd bin && for f in `find . -type f -iname "*" ! -iname "Makefile"`; do cp `pwd`/$$f $(PREFIX)/bin/$$f; done @echo 'Done.' -usrlocal-uninstall: - @echo 'Removing blackbox files from /usr/local/bin' - @cd bin && for f in `find . -type f -iname "*" ! -iname "Makefile"`; do rm /usr/local/bin/$$f; done +copy-uninstall: + @echo "Removing blackbox files from ${PREFIX}/bin" + @cd bin && for f in `find . -type f -iname "*" ! -iname "Makefile"`; do rm $(PREFIX)/bin/$$f; done @echo 'Done.' # @@ -142,6 +142,6 @@ test: confidence confidence: @if [ -e ~/.gnupg ]; then echo ERROR: '~/.gnupg should not exist. If it does, bugs may polute your .gnupg configuration. If the code has no bugs everything will be fine. Do you feel lucky?'; false ; fi @if which >/dev/null gpg-agent ; then pkill gpg-agent ; rm -rf /tmp/tmp.* ; fi - @export PATH="$(PWD)/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin:$(PATH)" ; tools/auto_system_test + @export PATH="$(PWD)/bin:$(PREFIX)/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin:$(PATH)" ; tools/auto_system_test @if which >/dev/null gpg-agent ; then pkill gpg-agent ; fi @if [ -e ~/.gnupg ]; then echo ERROR: '~/.gnupg was created which means the scripts might be poluting GnuPG configuration. Fix this bug.'; false ; fi diff --git a/README.md b/README.md index d974e7a..0045998 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,8 @@ Installation Instructions ========================= - *The hard way (manual)*: Copy all the files in "bin" to your "bin". -- *The hard way (automatic)*: `make copy-install` will copy the bin files into /usr/local/bin (uninstall with `make usrlocal-uninstall`). -- *The symlinks way*: `make symlinks-install` will make symlinks of the bin files into /usr/local/bin (uninstall with `make usrlocal-uninstall`) (useful when doing development) +- *The hard way (automatic)*: `make copy-install` will copy the bin files into $PREFIX/bin, default is /usr/local (uninstall with `make copy-uninstall`). +- *The symlinks way*: `make symlinks-install` will make symlinks of the bin files into $PREFIX/bin, default is /usr/local (uninstall with `make copy-uninstall`) (useful when doing development) - *The MacPorts Way*: `sudo port install vcs_blackbox` - *The Homebrew Way*: `brew install blackbox` - *The RPM way*: Check out the repo and make an RPM via `make packages-rpm`; now you can distribute the RPM via local methods. (Requires [fpm](https://github.com/jordansissel/fpm).)