Skip to content

Commit

Permalink
mk: add .so name versioning, resolves #32
Browse files Browse the repository at this point in the history
  • Loading branch information
sreimers committed Dec 8, 2020
1 parent 2bbcfb5 commit fe2e589
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
VER_MAJOR := 1
VER_MINOR := 1
VER_PATCH := 0
VER_ABI := 1

PROJECT := re
VERSION := $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
Expand Down Expand Up @@ -47,9 +48,14 @@ INCDIR := $(PREFIX)/include/re
MKDIR := $(PREFIX)/share/re
CFLAGS += -Iinclude

MODMKS := $(patsubst %,src/%/mod.mk,$(MODULES))
SHARED := libre$(LIB_SUFFIX)
STATIC := libre.a
MODMKS := $(patsubst %,src/%/mod.mk,$(MODULES))
SHARED := libre$(LIB_SUFFIX)
SHARED_SONAME := libre$(LIB_SUFFIX).$(VER_ABI)
STATIC := libre.a

ifeq ($(OS),linux)
SH_LFLAGS += -Wl,-soname,$(SHARED_SONAME)
endif

include $(MODMKS)

Expand Down Expand Up @@ -109,7 +115,12 @@ install: $(SHARED) $(STATIC) libre.pc
$(DESTDIR)$(INCDIR) $(DESTDIR)$(MKDIR)
$(INSTALL) -m 0644 $(shell find include -name "*.h") \
$(DESTDIR)$(INCDIR)
ifeq ($(OS),linux)
$(INSTALL) -m 0755 $(SHARED) $(DESTDIR)$(LIBDIR)/$(SHARED_SONAME)
cd $(DESTDIR)$(LIBDIR) && ln -sf $(SHARED_SONAME) $(SHARED)
else
$(INSTALL) -m 0755 $(SHARED) $(DESTDIR)$(LIBDIR)
endif
$(INSTALL) -m 0755 $(STATIC) $(DESTDIR)$(LIBDIR)
$(INSTALL) -m 0644 libre.pc $(DESTDIR)$(LIBDIR)/pkgconfig
$(INSTALL) -m 0644 $(MK) $(DESTDIR)$(MKDIR)
Expand All @@ -118,6 +129,7 @@ uninstall:
@rm -rf $(DESTDIR)$(INCDIR)
@rm -rf $(DESTDIR)$(MKDIR)
@rm -f $(DESTDIR)$(LIBDIR)/$(SHARED)
@rm -f $(DESTDIR)$(LIBDIR)/$(SHARED_SONAME)
@rm -f $(DESTDIR)$(LIBDIR)/$(STATIC)
@rm -f $(DESTDIR)$(LIBDIR)/pkgconfig/libre.pc

Expand Down

0 comments on commit fe2e589

Please sign in to comment.