summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-10-11 03:31:18 +0000
committerRoland McGrath <roland@gnu.org>1995-10-11 03:31:18 +0000
commitefb25c01a56ed71c3cc4d699e1eadcf6aa27f8b5 (patch)
treef0c3bfa77c23f3ca9a2eed2b4e8be0fcc6cb50ca
parente0455278de43f40c946268c10fa3e30168216091 (diff)
(rpath): New variable.
($(target)): Use it in link command. ($(libname).so): Likewise. Use $^ instead of $+.
-rw-r--r--Makeconf11
1 files changed, 9 insertions, 2 deletions
diff --git a/Makeconf b/Makeconf
index 8648d475..15664353 100644
--- a/Makeconf
+++ b/Makeconf
@@ -159,8 +159,15 @@ libsubst=$(basename ${lib})$(_libext)
libsubst-override=${$(notdir $(basename ${lib}))-libsubst}
_libsubst=${libsubst$(patsubst %,-override,${libsubst-override})}
+# Direct the linker where to find shared objects specified in the
+# dependencies of other shared objects it encounters.
+rpath := -Wl,-rpath-link=.:$(subst $. ,:,$(dir $(wildcard ../lib*/lib*.so)))
+
$(target): %: $(_objs) $(OTHERLIBS)
- $(CC) $(CFLAGS) $($@-CFLAGS) $(LDFLAGS) $($@-LDFLAGS) -o $@ '-Wl,-(' $(filter %.o,$^) $(foreach lib,$(filter-out %.o,$+),${_libsubst}) '-Wl,-)'
+ $(CC) $(rpath) $(CFLAGS) $($@-CFLAGS) $(LDFLAGS) $($@-LDFLAGS) -o $@ \
+ '-Wl,-(' $(filter %.o,$^) \
+ $(foreach lib,$(filter-out %.o,$+),${_libsubst}) \
+ '-Wl,-)'
ifeq ($(makemode),library)
$(libname).a: $(OBJS)
@@ -170,7 +177,7 @@ $(libname).a: $(OBJS)
$(libname).so: $(patsubst %.o,%_pic.o,$(OBJS))
$(CC) -shared -Wl,-soname=$(libname).so -o $(libname).so \
- $(CFLAGS) $(LDFLAGS) $($@-LDFLAGS) $+
+ $(rpath) $(CFLAGS) $(LDFLAGS) $($@-LDFLAGS) $^
endif
# Making a snapshot