From 3023219601f569b575ca846f1c8f9a846d87aede Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Mon, 20 Dec 2021 18:05:25 +0100 Subject: [PATCH] added OpenBSD support --- Makefile | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 182ed3d..a4d8177 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ LIBNAME := $(shell basename $$(pwd)) MAJOR := 1 -MINOR := 0.0 +MINOR := 0 +PATCH := 0 UNAME_S := $(shell uname -s) @@ -8,10 +9,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 PREFIX ?= /usr/local @@ -45,7 +50,11 @@ all: $(REALNAME) $(REALNAME): $(OBJS) $(DEPS) ifeq ($(UNAME_S),Darwin) $(CXX) -dynamiclib -o $(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(OBJS) -else +endif +ifeq ($(UNAME_S),OpenBSD) + $(CXX) -g -shared -Wl,-soname,$(REALNAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) +endif +ifeq ($(UNAME_S),Linux) $(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) endif @@ -74,7 +83,8 @@ install: $(REALNAME) $(LIBNAME).hpp $(INSTALL) -m 644 $(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