
Only pass -rpath $(libdir) on the link line when linking libraries,
not programs.

--- subversion-0.31.0/build/generator/gen_base.py.rpath
+++ subversion-0.31.0/build/generator/gen_base.py
@@ -421,6 +421,9 @@
     tfile = '%s-%s%s' % (name, cfg.version, extmap['lib', 'target'])
     self.filename = os.path.join(self.path, tfile)
 
+    ### hmm. this is Makefile-specific
+    self.link_cmd = '$(LINK_LIB)'
+
 class TargetApacheMod(TargetLib):
 
   def __init__(self, name, options, cfg, extmap):
--- subversion-0.31.0/Makefile.in.rpath
+++ subversion-0.31.0/Makefile.in
@@ -127,7 +127,8 @@
 COMPILE_SWIG_JAVA = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_JAVA_INCLUDES) $(INCLUDES) -o $@ -c
 COMPILE_SWIG_PL = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(SWIG_PL_INCLUDES) $(INCLUDES) -o $@ -c
 
-LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(libdir)
+LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS)
+LINK_LIB = $(LINK) -rpath $(libdir)
 
 # special link rule for mod_dav_svn
 LINK_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(APACHE_LIBEXECDIR) -avoid-version -module
