From 5b9e4ac4057f5693f53c321eeb5bfb387f6b69fb Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Mon, 15 Nov 2021 16:05:41 -0500 Subject: [PATCH] Add libtool-compatible library versioning We start at 1:0:0 since the Debian package has been using 0:0:0 prior to the constants::version -> frobby_version interface change. --- Makefile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 36a3778d..0fba4ea1 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,15 @@ GMP_INC_DIR=/usr/local/include ldflags_for_gmp=-L/usr/local/lib -lgmpxx -lgmp - +# shared library version +# bump if interfaces added, removed, or changed +FROBBY_CURRENT = 1 +# bump at every release, set to 0 if any interfaces added, removed, or changed +FROBBY_REVISION = 0 +# bump if interfaces added, set to 0 if removed or changed +FROBBY_AGE = 0 +FROBBY_SOVERSION := $(shell expr $(FROBBY_CURRENT) - $(FROBBY_AGE)) +FROBBY_VERSION := $(FROBBY_SOVERSION).$(FROBBY_AGE).$(FROBBY_REVISION) rawSources := main.cpp Action.cpp IOParameters.cpp \ IrreducibleDecomAction.cpp fplllIO.cpp IOHandler.cpp fourti2.cpp \ @@ -225,8 +233,12 @@ library: bin/$(library) bin/$(library): $(objs) | bin/ rm -f bin/$(library) ifeq ($(MODE), shared) - $(CXX) -shared -o bin/$(library) $(ldflags) \ + $(CXX) -shared -Wl,-soname,$(library).$(FROBBY_SOVERSION) \ + -o bin/$(library).$(FROBBY_VERSION) $(ldflags) \ $(patsubst $(outdir)main.o,,$(objs)) -lgmp -lgmpxx + cd bin && ln -s $(library).$(FROBBY_VERSION) \ + $(library).$(FROBBY_SOVERSION) && \ + ln -s $(library).$(FROBBY_VERSION) $(library) else ar crs bin/$(library) $(patsubst $(outdir)main.o,,$(objs)) $(RANLIB) bin/$(library)