commit b04ca5b

Michael Forney  ·  2013-10-25 07:59:13 +0000 UTC
parent 91a4aa8
Install versioned .so
2 files changed,  +25, -8
+5, -2
 1@@ -3,8 +3,11 @@
 2 .PHONY: all
 3 all: build
 4 
 5-SUBDIRS     := launch libswc protocol
 6-CLEAN_FILES :=
 7+VERSION_MAJOR   := 0
 8+VERSION_MINOR   := 0
 9+
10+SUBDIRS         := launch libswc protocol
11+CLEAN_FILES     :=
12 
13 include config.mk
14 include $(SUBDIRS:%=%/Makefile.local)
+20, -6
 1@@ -2,12 +2,20 @@
 2 
 3 dir := libswc
 4 
 5+LIBSWC_LINK := libswc.so
 6+LIBSWC_SO   := $(LIBSWC_LINK).$(VERSION_MAJOR)
 7+LIBSWC_LIB  := $(LIBSWC_SO).$(VERSION_MINOR)
 8+
 9 ifneq ($(ENABLE_STATIC), 0)
10 $(dir)_TARGETS += $(dir)/libswc.a
11 endif
12 
13 ifneq ($(ENABLE_SHARED), 0)
14-$(dir)_TARGETS += $(dir)/libswc.so
15+$(dir)_SHARED_TARGETS :=            \
16+    $(dir)/$(LIBSWC_LIB)            \
17+    $(dir)/$(LIBSWC_SO)             \
18+    $(dir)/$(LIBSWC_LINK)
19+$(dir)_TARGETS += $(dir)/$(LIBSWC_LINK)
20 endif
21 
22 SWC_SOURCES =                       \
23@@ -60,16 +68,22 @@ $(dir)/drm.c $(dir)/drm_buffer.c: protocol/wayland-drm-server-protocol.h
24 $(dir)/libswc.a: $(SWC_STATIC_OBJECTS)
25 	$(call quiet,AR) cru $@ $^
26 
27-$(dir)/libswc.so: $(SWC_SHARED_OBJECTS)
28-	$(link) -shared $(SWC_PACKAGE_LIBS)
29+$(dir)/$(LIBSWC_LIB): $(SWC_SHARED_OBJECTS)
30+	$(link) -shared -Wl,-soname,$(LIBSWC_SO) $(SWC_PACKAGE_LIBS)
31+
32+$(dir)/$(LIBSWC_SO): $(dir)/$(LIBSWC_LIB)
33+	$(call quiet,SYM,ln -sf) $(notdir $<) $@
34+
35+$(dir)/$(LIBSWC_LINK): $(dir)/$(LIBSWC_SO)
36+	$(call quiet,SYM,ln -sf) $(notdir $<) $@
37 
38 .PHONY: install-libswc.a
39 install-libswc.a: $(dir)/libswc.a | $(DESTDIR)$(LIBDIR)
40 	install -m0644 $< "$(DESTDIR)$(LIBDIR)"
41 
42-.PHONY: install-libswc.so
43-install-libswc.so: $(dir)/libswc.so | $(DESTDIR)$(LIBDIR)
44-	install -m0755 $< "$(DESTDIR)$(LIBDIR)"
45+.PHONY: install-$(LIBSWC_LINK)
46+install-$(LIBSWC_LINK): $($(dir)_SHARED_TARGETS) | $(DESTDIR)$(LIBDIR)
47+	install -m0755 $^ "$(DESTDIR)$(LIBDIR)"
48 
49 check-dependencies-libswc:
50 	$(call check_deps,libswc,$(SWC_PACKAGES))