From b8aff4def1361dc2711ae2aabbeb5a8d7c658599 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 7 Nov 2008 10:52:19 +0100 Subject: [PATCH] Better solution to linking binaries with shared libraries Now, libraries do not contain absolute path to _compiled/lib directory. --- snippets/linux | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snippets/linux b/snippets/linux index a5153a0..64387b4 100644 --- a/snippets/linux +++ b/snippets/linux @@ -280,7 +280,7 @@ USER_SOURCES += $$($(1)_SOURCES) $(2)/$(1)$(3): $$($(1)_OBJS) @$(QUIET_CMD_ECHO) " LINK $$@" $(Q) $$(if $$(filter %.cc,$$($(1)_SOURCES:%.cxx=%.cc)),$$(CXX),$$(CC)) \ - $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) $$(LOADLIBES) $$(LDFLAGS) -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $$@ + $$($(1)_OBJS) $$($(1)_LIBS:%=-l%) $$(LOADLIBES) $$(LDFLAGS) -Wl,-rpath-link,$(USER_LIB_DIR) -Wl,-Map,$(USER_OBJS_DIR)/$(1).exe.map -o $$@ @echo "$(2)/$(1)$(3): \\" >$(USER_OBJS_DIR)/$(1).exe.d @sed -n -e 's|^LOAD \(.*\)$$$$| \1 \&|p' $(USER_OBJS_DIR)/$(1).exe.map|tr '&' '\134' >>$(USER_OBJS_DIR)/$(1).exe.d @echo >>$(USER_OBJS_DIR)/$(1).exe.d @@ -387,7 +387,7 @@ $(1)_shared_libs = $$(patsubst %,$(USER_LIB_DIR)/lib%.$(SOLIB_EXT),$$(filter $$( #$$(warning $(1)_shared_libs = $$($(1)_shared_libs)) $(USER_LIB_DIR)/lib$(1).$(SOLIB_EXT): $$($(1)_shared_libs) $$($(1)_objslo) @$(QUIET_CMD_ECHO) " LINK $$@" - $(Q)LD_RUN_PATH=$(USER_LIB_DIR) $(CC) --shared -Xlinker -soname=lib$(1).$(SOLIB_EXT) -o $$@ $$($(1)_objslo) $$(LOADLIBES) $$($(1)_libs:%=-l%) + $(Q)$(CC) --shared -Xlinker -soname=lib$(1).$(SOLIB_EXT) -o $$@ $$($(1)_objslo) $$(LOADLIBES) $$($(1)_libs:%=-l%) endef -include $(shell find $(USER_BUILD_DIR) -name 'lib*.omkvar') -- 2.39.2