Moved versioning to premake and new Makefile

This commit is contained in:
Bob Polis 2021-12-21 09:39:21 +01:00
parent 393db176f0
commit 387c07210e
2 changed files with 20 additions and 6 deletions

View File

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

View File

@ -1 +1,5 @@
LDLIBS := -lscerror -lm
MAJOR := 1
MINOR := 0
PATCH := 0