From 387c07210e0c7908adf14412e90feeabf6887e13 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Tue, 21 Dec 2021 09:39:21 +0100 Subject: [PATCH] Moved versioning to premake and new Makefile --- Makefile | 22 ++++++++++++++++------ premake.make | 4 ++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0add70b..122cbd5 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ include premake.make LIBNAME := $(shell basename $$(pwd)) -MAJOR := 1 -MINOR := 0.0 +MAJOR ?= 1 +MINOR ?= 0 +PATCH ?= 0 UNAME_S := $(shell uname -s) @@ -10,10 +11,14 @@ ifeq ($(UNAME_S),Darwin) LINKERNAME := $(LIBNAME).dylib SONAME := $(LIBNAME).$(MAJOR).dylib REALNAME := $(LINKERNAME) -else +endif +ifeq ($(UNAME_S),OpenBSD) + REALNAME := $(LIBNAME).so.$(MAJOR).$(MINOR) +endif +ifeq ($(UNAME_S),Linux) LINKERNAME := $(LIBNAME).so SONAME := $(LINKERNAME).$(MAJOR) - REALNAME := $(SONAME).$(MINOR) + REALNAME := $(SONAME).$(MINOR).$(PATCH) endif STATICLIB := $(LIBNAME).a @@ -61,7 +66,11 @@ prebuild: $(OUTDIR)$(REALNAME): $(OBJS) $(DEPS) ifeq ($(UNAME_S),Darwin) $(CXX) -dynamiclib -o $(OUTDIR)$(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS)) -else +endif +ifeq ($(UNAME_S),OpenBSD) + $(CXX) -g -shared -Wl,-soname,$(REALNAME) -o $(OUTDIR)$(REALNAME) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS)) +endif +ifeq ($(UNAME_S),Linux) $(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(OUTDIR)$(REALNAME) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS)) endif @@ -98,7 +107,8 @@ install: $(OUTDIR)$(REALNAME) $(LIBNAME).hpp $(INSTALL) -m 644 build/$(LIBNAME).hpp $(INCLUDEDIR) ifeq ($(UNAME_S),Darwin) cd $(LIBDIR) && ln -sf $(REALNAME) $(SONAME) -else +endif +ifeq ($(UNAME_S),Linux) ldconfig cd $(LIBDIR) && ln -sf $(SONAME) $(LINKERNAME) endif diff --git a/premake.make b/premake.make index e6ec4a5..cb0ab6b 100644 --- a/premake.make +++ b/premake.make @@ -1 +1,5 @@ LDLIBS := -lscerror -lm + +MAJOR := 1 +MINOR := 0 +PATCH := 0