From c8d00665b37af44e1c62b56407ed8e2e84fee830 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 4 Jul 2016 22:38:05 +0100 Subject: 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 --- Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Makefile b/Makefile index accc760..18230f7 100644 --- a/Makefile +++ b/Makefile @@ -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 -- cgit v1.2.3