aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitrij D. Czarkoff <czarkoff@gmail.com>2015-12-25 15:29:12 +0100
committerDmitrij D. Czarkoff <czarkoff@gmail.com>2015-12-25 15:29:12 +0100
commit77827c838e36e39471f2f23338f76e5ace2404c4 (patch)
tree13bc4fd9649255e7cc6e5472afa14116cdc676dc
parent6de6b358e81251bcf9c978b04452d2390d46a388 (diff)
downloadimv-77827c838e36e39471f2f23338f76e5ace2404c4.tar.gz
Make installation locations more configurable
This might be desired when platform has its own, custom layout (eg. OpenBSD or Solaris), or when user wants to install the program to his home directory.
-rw-r--r--Makefile9
-rw-r--r--README.md6
2 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index f002847..fb3d07e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,9 @@
.PHONY: clean check install uninstall
PREFIX ?= /usr
+BINPREFIX ?= $(PREFIX)/bin
+MANPREFIX ?= $(PREFIX)/share/man
+DATAPREFIX ?= $(PREFIX)/share
CFLAGS ?= -W -Wall -Wpedantic
CFLAGS += -std=gnu11 $(shell sdl2-config --cflags)
@@ -41,9 +44,9 @@ clean:
@$(RM) $(TARGET) $(OBJECTS) $(TESTS)
install: $(TARGET)
- install -D -m 0755 $(TARGET) $(DESTDIR)$(PREFIX)/bin/imv
- install -D -m 0644 doc/imv.1 $(DESTDIR)$(PREFIX)/share/man/man1/imv.1
- install -D -m 0644 files/imv.desktop $(DESTDIR)$(PREFIX)/share/applications/imv.desktop
+ install -D -m 0755 $(TARGET) $(DESTDIR)$(BINPREFIX)/imv
+ install -D -m 0644 doc/imv.1 $(DESTDIR)$(MANPREFIX)/man1/imv.1
+ install -D -m 0644 files/imv.desktop $(DESTDIR)$(DATAPREFIX)/applications/imv.desktop
uninstall:
$(RM) $(DESTDIR)$(PREFIX)/bin/imv
diff --git a/README.md b/README.md
index 2a08f31..5c9c87b 100644
--- a/README.md
+++ b/README.md
@@ -64,6 +64,12 @@ Installation
$ make
# make install
+Macro `PREFIX` controls installation prefix. If more control over installation
+paths is required, macros `BINPREFIX`, `MANPREFIX` and `DATAPREFIX` are
+available. Eg. to install `imv` to home directory, run:
+
+ $ BINPREFIX=~/bin PREFIX=~/.local make install
+
Tests
-----