added OpenBSD support

This commit is contained in:
Bob Polis 2021-12-20 18:05:25 +01:00
parent e7979589ee
commit 3023219601

View File

@ -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