commit b04ca5bfa7925cbc2b02ffc44b1e7da120696239
parent 91a4aa839eb9121bed3fcb46b28c9f24c0445590
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 25 Oct 2013 00:59:13 -0700
Install versioned .so
Diffstat:
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
@@ -3,8 +3,11 @@
.PHONY: all
all: build
-SUBDIRS := launch libswc protocol
-CLEAN_FILES :=
+VERSION_MAJOR := 0
+VERSION_MINOR := 0
+
+SUBDIRS := launch libswc protocol
+CLEAN_FILES :=
include config.mk
include $(SUBDIRS:%=%/Makefile.local)
diff --git a/libswc/Makefile.local b/libswc/Makefile.local
@@ -2,12 +2,20 @@
dir := libswc
+LIBSWC_LINK := libswc.so
+LIBSWC_SO := $(LIBSWC_LINK).$(VERSION_MAJOR)
+LIBSWC_LIB := $(LIBSWC_SO).$(VERSION_MINOR)
+
ifneq ($(ENABLE_STATIC), 0)
$(dir)_TARGETS += $(dir)/libswc.a
endif
ifneq ($(ENABLE_SHARED), 0)
-$(dir)_TARGETS += $(dir)/libswc.so
+$(dir)_SHARED_TARGETS := \
+ $(dir)/$(LIBSWC_LIB) \
+ $(dir)/$(LIBSWC_SO) \
+ $(dir)/$(LIBSWC_LINK)
+$(dir)_TARGETS += $(dir)/$(LIBSWC_LINK)
endif
SWC_SOURCES = \
@@ -60,16 +68,22 @@ $(dir)/drm.c $(dir)/drm_buffer.c: protocol/wayland-drm-server-protocol.h
$(dir)/libswc.a: $(SWC_STATIC_OBJECTS)
$(call quiet,AR) cru $@ $^
-$(dir)/libswc.so: $(SWC_SHARED_OBJECTS)
- $(link) -shared $(SWC_PACKAGE_LIBS)
+$(dir)/$(LIBSWC_LIB): $(SWC_SHARED_OBJECTS)
+ $(link) -shared -Wl,-soname,$(LIBSWC_SO) $(SWC_PACKAGE_LIBS)
+
+$(dir)/$(LIBSWC_SO): $(dir)/$(LIBSWC_LIB)
+ $(call quiet,SYM,ln -sf) $(notdir $<) $@
+
+$(dir)/$(LIBSWC_LINK): $(dir)/$(LIBSWC_SO)
+ $(call quiet,SYM,ln -sf) $(notdir $<) $@
.PHONY: install-libswc.a
install-libswc.a: $(dir)/libswc.a | $(DESTDIR)$(LIBDIR)
install -m0644 $< "$(DESTDIR)$(LIBDIR)"
-.PHONY: install-libswc.so
-install-libswc.so: $(dir)/libswc.so | $(DESTDIR)$(LIBDIR)
- install -m0755 $< "$(DESTDIR)$(LIBDIR)"
+.PHONY: install-$(LIBSWC_LINK)
+install-$(LIBSWC_LINK): $($(dir)_SHARED_TARGETS) | $(DESTDIR)$(LIBDIR)
+ install -m0755 $^ "$(DESTDIR)$(LIBDIR)"
check-dependencies-libswc:
$(call check_deps,libswc,$(SWC_PACKAGES))