aboutsummaryrefslogtreecommitdiff
path: root/mk/libraries.mk
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-14 01:47:06 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-12-14 01:47:06 +0100
commit14955c297de82e964ea5bf44f8aaf543d4cae33a (patch)
tree264740d66d805dbbb82c03146830a2a022569d88 /mk/libraries.mk
parent68b47178730a95871eba4aa4df19a845c8e5a947 (diff)
parent36c67860363c93eb00cf5b8e2ad34f6f775e6901 (diff)
Merge commit '36c67860363c93eb00cf5b8e2ad34f6f775e6901'
Diffstat (limited to 'mk/libraries.mk')
-rw-r--r--mk/libraries.mk21
1 files changed, 13 insertions, 8 deletions
diff --git a/mk/libraries.mk b/mk/libraries.mk
index 3b91c699e..766f7ccf7 100644
--- a/mk/libraries.mk
+++ b/mk/libraries.mk
@@ -45,9 +45,9 @@ endif
# built, otherwise a static library.
define build-library
$(1)_NAME ?= $(1)
- _d := $$(strip $$($(1)_DIR))
+ _d := $(buildprefix)$$(strip $$($(1)_DIR))
_srcs := $$(sort $$(foreach src, $$($(1)_SOURCES), $$(src)))
- $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
+ $(1)_OBJS := $$(addprefix $(buildprefix), $$(addsuffix .o, $$(basename $$(_srcs))))
_libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
$(1)_INSTALL_DIR ?= $$(libdir)
@@ -76,9 +76,12 @@ define build-library
$(1)_PATH := $$(_d)/$$($(1)_NAME).$(SO_EXT)
$$($(1)_PATH): $$($(1)_OBJS) $$(_libs) | $$(_d)/
- $$(trace-ld) $(CXX) -o $$@ -shared $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE))
+ $$(trace-ld) $(CXX) -o $$(abspath $$@) -shared $$(GLOBAL_LDFLAGS) $$($(1)_OBJS) $$($(1)_LDFLAGS) $$($(1)_LDFLAGS_PROPAGATED) $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_LDFLAGS_USE)) $$($(1)_LDFLAGS_UNINSTALLED)
- $(1)_LDFLAGS_USE += -L$$(_d) -Wl,-rpath,$$(abspath $$(_d)) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
+ ifneq ($(OS), Darwin)
+ $(1)_LDFLAGS_USE += -Wl,-rpath,$$(abspath $$(_d))
+ endif
+ $(1)_LDFLAGS_USE += -L$$(_d) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
$(1)_INSTALL_PATH := $(DESTDIR)$$($(1)_INSTALL_DIR)/$$($(1)_NAME).$(SO_EXT)
@@ -90,10 +93,12 @@ define build-library
$$(trace-ld) $(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$$(DESTDIR)$$($(1)_INSTALL_DIR) -l$$(patsubst lib%,%,$$(strip $$($(1)_NAME)))
- ifeq ($(SET_RPATH_TO_LIBS), 1)
- $(1)_LDFLAGS_USE_INSTALLED += -Wl,-rpath,$$($(1)_INSTALL_DIR)
- else
- $(1)_LDFLAGS_USE_INSTALLED += -Wl,-rpath-link,$$($(1)_INSTALL_DIR)
+ ifneq ($(OS), Darwin)
+ ifeq ($(SET_RPATH_TO_LIBS), 1)
+ $(1)_LDFLAGS_USE_INSTALLED += -Wl,-rpath,$$($(1)_INSTALL_DIR)
+ else
+ $(1)_LDFLAGS_USE_INSTALLED += -Wl,-rpath-link,$$($(1)_INSTALL_DIR)
+ endif
endif
ifdef $(1)_FORCE_INSTALL