about summary refs log tree commit diff
path: root/Makefile.lib
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-23T23·49+0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-11-23T23·49+0000
commitf267ff16b4527ca6c083014b93b4568d89221f49 (patch)
tree74e5cc5beddc6c1845e1ec98a7653eabded66331 /Makefile.lib
parentabb5bd66dee7afe9560b3a132da42b71d4801274 (diff)
Allow libraries to set an actual name different from the symbolic name
Diffstat (limited to 'Makefile.lib')
-rw-r--r--Makefile.lib13
1 files changed, 7 insertions, 6 deletions
diff --git a/Makefile.lib b/Makefile.lib
index 16fd20c773b3..38370c2fec1f 100644
--- a/Makefile.lib
+++ b/Makefile.lib
@@ -51,6 +51,7 @@ endif
 libs_list :=
 
 define LIBS_template =
+  $(1)_NAME ?= $(1)
   _d := $$(strip $$($(1)_DIR))
   _srcs := $$(foreach src, $$($(1)_SOURCES), $$(_d)/$$(src))
   $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
@@ -65,16 +66,16 @@ define LIBS_template =
       $(1)_LDFLAGS += -z defs
     endif
 
-    $(1)_PATH := $$(_d)/$(1).so
+    $(1)_PATH := $$(_d)/$$($(1)_NAME).so
 
     $$($(1)_PATH): $$($(1)_OBJS) $$(_libs)
 	$(QUIET) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
 
-    $(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $(1)))
+    $(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
 
     $(1)_INSTALL_DIR := $$(pkglibdir)
 
-    $(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$(1).so
+    $(1)_INSTALL_PATH := $$($(1)_INSTALL_DIR)/$$($(1)_NAME).so
 
     _libs_final := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_INSTALL_PATH))
 
@@ -82,18 +83,18 @@ define LIBS_template =
 	install -d $$($(1)_INSTALL_DIR)
 	$(QUIET) $(CXX) -o $$@ -shared $(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE_INSTALLED))
 
-    $(1)_LDFLAGS_USE_INSTALLED += -L$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $(1)))
+    $(1)_LDFLAGS_USE_INSTALLED += -L$$($(1)_INSTALL_DIR) -Wl,-rpath,$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
 
   else
 
-    $(1)_PATH := $$(_d)/$(1).a
+    $(1)_PATH := $$(_d)/$$($(1)_NAME).a
 
     $$($(1)_PATH): $$($(1)_OBJS)
 	$(QUIET) ar crs $$@ $$?
 
     $(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)
 
-    $(1)_INSTALL_PATH := $$(pkglibdir)/$(1).a
+    $(1)_INSTALL_PATH := $$(pkglibdir)/$$($(1)_NAME).a
 
   endif