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.
This commit is contained in:
parent
d8b24acb77
commit
06cdb3f75e
1 changed files with 18 additions and 4 deletions
22
Makefile
22
Makefile
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
MAJOR := 0
|
||||||
|
MINOR := 1
|
||||||
|
PATCH := 0
|
||||||
|
VERSION := $(MAJOR).$(MINOR).$(PATCH)
|
||||||
BUILD_DIR := build
|
BUILD_DIR := build
|
||||||
RELEASE_OPTIMIZE_FLAGS ?= -g -O3
|
RELEASE_OPTIMIZE_FLAGS ?= -g -O3
|
||||||
DEBUG_OPTIMIZE_FLAGS ?= -g -O0
|
DEBUG_OPTIMIZE_FLAGS ?= -g -O0
|
||||||
|
@ -9,8 +13,10 @@ CC = gcc
|
||||||
EMCC = emcc
|
EMCC = emcc
|
||||||
AFL_CC = afl-gcc
|
AFL_CC = afl-gcc
|
||||||
AFL_CXX = afl-g++
|
AFL_CXX = afl-g++
|
||||||
RELEASE_TARGET := $(BUILD_DIR)/libolm.so
|
RELEASE_TARGET := $(BUILD_DIR)/libolm.so.$(VERSION)
|
||||||
DEBUG_TARGET := $(BUILD_DIR)/libolm_debug.so
|
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_TARGET := javascript/olm.js
|
||||||
|
|
||||||
JS_EXPORTED_FUNCTIONS := javascript/exported_functions.json
|
JS_EXPORTED_FUNCTIONS := javascript/exported_functions.json
|
||||||
|
@ -87,22 +93,30 @@ $(JS_TARGET): LDFLAGS += $(JS_OPTIMIZE_FLAGS)
|
||||||
|
|
||||||
### top-level targets
|
### top-level targets
|
||||||
|
|
||||||
lib: $(RELEASE_TARGET)
|
lib: $(RELEASE_TARGET) $(RELEASE_SYMLINKS)
|
||||||
.PHONY: lib
|
.PHONY: lib
|
||||||
|
|
||||||
$(RELEASE_TARGET): $(RELEASE_OBJECTS)
|
$(RELEASE_TARGET): $(RELEASE_OBJECTS)
|
||||||
$(CXX) $(LDFLAGS) --shared -fPIC \
|
$(CXX) $(LDFLAGS) --shared -fPIC \
|
||||||
|
-Wl,-soname,libolm.so.$(MAJOR) \
|
||||||
-Wl,--version-script,version_script.ver \
|
-Wl,--version-script,version_script.ver \
|
||||||
$(OUTPUT_OPTION) $(RELEASE_OBJECTS)
|
$(OUTPUT_OPTION) $(RELEASE_OBJECTS)
|
||||||
|
|
||||||
debug: $(DEBUG_TARGET)
|
$(RELEASE_SYMLINKS):
|
||||||
|
ln -s libolm.so.$(VERSION) $@
|
||||||
|
|
||||||
|
debug: $(DEBUG_TARGET) $(DEBUG_SYMLINKS)
|
||||||
.PHONY: debug
|
.PHONY: debug
|
||||||
|
|
||||||
$(DEBUG_TARGET): $(DEBUG_OBJECTS)
|
$(DEBUG_TARGET): $(DEBUG_OBJECTS)
|
||||||
$(CXX) $(LDFLAGS) --shared -fPIC \
|
$(CXX) $(LDFLAGS) --shared -fPIC \
|
||||||
|
-Wl,-soname,libolm_debug.so.$(MAJOR) \
|
||||||
-Wl,--version-script,version_script.ver \
|
-Wl,--version-script,version_script.ver \
|
||||||
$(OUTPUT_OPTION) $(DEBUG_OBJECTS)
|
$(OUTPUT_OPTION) $(DEBUG_OBJECTS)
|
||||||
|
|
||||||
|
$(DEBUG_SYMLINKS):
|
||||||
|
ln -s libolm_debug.so.$(VERSION) $@
|
||||||
|
|
||||||
js: $(JS_TARGET)
|
js: $(JS_TARGET)
|
||||||
.PHONY: js
|
.PHONY: js
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue