diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-07-04 22:38:05 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-07-05 23:21:28 +0100 |
commit | c8d00665b37af44e1c62b56407ed8e2e84fee830 (patch) | |
tree | c67424caab2ec43b96374d884fbf527414a3b77c | |
parent | 06cdb3f75e27aae06c16b10e936ddd908ea4e5c5 (diff) |
Add an install and an install-debug targets
This makes the user able to use the familiar `make install` syntax, and
allows overriding of the default directories using the DESTDIR and
PREFIX variables, for example:
make DESTDIR=packaging PREFIX=/usr install
-rw-r--r-- | Makefile | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -4,6 +4,7 @@ MAJOR := 0 MINOR := 1 PATCH := 0 VERSION := $(MAJOR).$(MINOR).$(PATCH) +PREFIX ?= /usr/local BUILD_DIR := build RELEASE_OPTIMIZE_FLAGS ?= -g -O3 DEBUG_OPTIMIZE_FLAGS ?= -g -O0 @@ -145,6 +146,22 @@ $(JS_EXPORTED_FUNCTIONS): $(PUBLIC_HEADERS) all: test js lib debug .PHONY: all +install-debug: debug + test -d $(DESTDIR)$(PREFIX) || mkdir -p $(DESTDIR)$(PREFIX) + test -d $(DESTDIR)$(PREFIX)/lib || mkdir $(DESTDIR)$(PREFIX)/lib + install -Dm755 $(DEBUG_TARGET) $(DESTDIR)$(PREFIX)/lib/libolm_debug.so.$(VERSION) + ln -s libolm_debug.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libolm_debug.so.$(MAJOR) + ln -s libolm_debug.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libolm_debug.so +.PHONY: install-debug + +install: lib + test -d $(DESTDIR)$(PREFIX) || mkdir -p $(DESTDIR)$(PREFIX) + test -d $(DESTDIR)$(PREFIX)/lib || mkdir $(DESTDIR)$(PREFIX)/lib + install -Dm755 $(RELEASE_TARGET) $(DESTDIR)$(PREFIX)/lib/libolm.so.$(VERSION) + ln -s libolm.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libolm.so.$(MAJOR) + ln -s libolm.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libolm.so +.PHONY: install + clean:; rm -rf $(BUILD_DIR) .PHONY: clean |