aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-07-04 22:38:04 +0100
committerRichard van der Hoff <richard@matrix.org>2016-07-05 23:21:22 +0100
commit06cdb3f75e27aae06c16b10e936ddd908ea4e5c5 (patch)
tree4615b80cf590a1e8223806085dc5c59a242e750a
parentd8b24acb779db5314cc6c1f2e35da27b7b655c29 (diff)
Specify the soname in the library and its name
This provides users of this library the guarantee that the ABI will stay stable when MAJOR will reach 1, and will stay backwards compatible for the entire duration of the 1.x.y branch. It does require the maintainers to always update the version in the Makefile at every ABI change.
-rw-r--r--Makefile22
1 files changed, 18 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 0d5ddd6..accc760 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,9 @@
#!/usr/bin/make -f
+MAJOR := 0
+MINOR := 1
+PATCH := 0
+VERSION := $(MAJOR).$(MINOR).$(PATCH)
BUILD_DIR := build
RELEASE_OPTIMIZE_FLAGS ?= -g -O3
DEBUG_OPTIMIZE_FLAGS ?= -g -O0
@@ -9,8 +13,10 @@ CC = gcc
EMCC = emcc
AFL_CC = afl-gcc
AFL_CXX = afl-g++
-RELEASE_TARGET := $(BUILD_DIR)/libolm.so
-DEBUG_TARGET := $(BUILD_DIR)/libolm_debug.so
+RELEASE_TARGET := $(BUILD_DIR)/libolm.so.$(VERSION)
+RELEASE_SYMLINKS := $(BUILD_DIR)/libolm.so.$(MAJOR) $(BUILD_DIR)/libolm.so
+DEBUG_TARGET := $(BUILD_DIR)/libolm_debug.so.$(VERSION)
+DEBUG_SYMLINKS := $(BUILD_DIR)/libolm_debug.so.$(MAJOR) $(BUILD_DIR)/libolm_debug.so
JS_TARGET := javascript/olm.js
JS_EXPORTED_FUNCTIONS := javascript/exported_functions.json
@@ -87,22 +93,30 @@ $(JS_TARGET): LDFLAGS += $(JS_OPTIMIZE_FLAGS)
### top-level targets
-lib: $(RELEASE_TARGET)
+lib: $(RELEASE_TARGET) $(RELEASE_SYMLINKS)
.PHONY: lib
$(RELEASE_TARGET): $(RELEASE_OBJECTS)
$(CXX) $(LDFLAGS) --shared -fPIC \
+ -Wl,-soname,libolm.so.$(MAJOR) \
-Wl,--version-script,version_script.ver \
$(OUTPUT_OPTION) $(RELEASE_OBJECTS)
-debug: $(DEBUG_TARGET)
+$(RELEASE_SYMLINKS):
+ ln -s libolm.so.$(VERSION) $@
+
+debug: $(DEBUG_TARGET) $(DEBUG_SYMLINKS)
.PHONY: debug
$(DEBUG_TARGET): $(DEBUG_OBJECTS)
$(CXX) $(LDFLAGS) --shared -fPIC \
+ -Wl,-soname,libolm_debug.so.$(MAJOR) \
-Wl,--version-script,version_script.ver \
$(OUTPUT_OPTION) $(DEBUG_OBJECTS)
+$(DEBUG_SYMLINKS):
+ ln -s libolm_debug.so.$(VERSION) $@
+
js: $(JS_TARGET)
.PHONY: js