From b0a010b1539fe6409f398bb209b156187c959c41 Mon Sep 17 00:00:00 2001 From: Andreas Zwinkau Date: Thu, 16 Mar 2017 20:20:16 +0100 Subject: [PATCH] Support building as a static library Signed-off-by: Andreas Zwinkau --- Makefile | 8 ++++++++ README.rst | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/Makefile b/Makefile index f53be1f..b4ce87a 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,10 @@ CC = gcc EMCC = emcc AFL_CC = afl-gcc AFL_CXX = afl-g++ +AR = ar RELEASE_TARGET := $(BUILD_DIR)/libolm.so.$(VERSION) +STATIC_RELEASE_TARGET := $(BUILD_DIR)/libolm.a DEBUG_TARGET := $(BUILD_DIR)/libolm_debug.so.$(VERSION) JS_TARGET := javascript/olm.js @@ -120,6 +122,12 @@ $(DEBUG_TARGET): $(DEBUG_OBJECTS) $(OUTPUT_OPTION) $(DEBUG_OBJECTS) ln -sf libolm_debug.so.$(VERSION) $(BUILD_DIR)/libolm_debug.so.$(MAJOR) +static: $(STATIC_RELEASE_TARGET) +.PHONY: static + +$(STATIC_RELEASE_TARGET): $(RELEASE_OBJECTS) + $(AR) rcs $@ $^ + js: $(JS_TARGET) .PHONY: js diff --git a/README.rst b/README.rst index 0141aa2..6a2d938 100644 --- a/README.rst +++ b/README.rst @@ -46,6 +46,12 @@ To build the Xcode workspace for Objective-C bindings, run: pod install open OLMKit.xcworkspace +To build olm as a static library (which still needs libstdc++ dynamically) run: + +.. code:: bash + + make static + Release process ---------------