summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gmail.com>2011-03-02 11:10:26 +0000
committerDavid Howells <dhowells@redhat.com>2011-03-02 11:10:26 +0000
commit7a9c34345d8f8208668b698b0421826b28436fdb (patch)
tree6542348b129aaa42178584785ff0260840804bbe /Makefile
parent5577756c11d47d38c9856908cffd5b406d853dce (diff)
downloadkeyutils-7a9c34345d8f8208668b698b0421826b28436fdb.tar.gz
Fix linkage of utilities in the Makefile.
First of all, rpath was being set to NULL, which makes it unsafe (empty rpath is the same as ".", letting the loader look for libraries in the current work directory); the obvious mistake here was to use $(LIB) rather than $(LIBDIR) (did it change over time?). But make RPATH optional, by moving it to its own macro definition, this allows for packagers to not use rpath at all, as it's usually not necessary when installing in the default library paths (such as /lib). Also, move the -L. flag at the top of the link command, so that user-provide library search paths won't cause another libkeyutils to be linked against. Cc: Robin Johnson <robbat2@gentoo.org> Signed-off-by: Diego Elio Pettenò <flameeyes@gmail.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 4 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 8e84b77..7b63052 100644
--- a/Makefile
+++ b/Makefile
@@ -45,6 +45,8 @@ USRLIBDIR := /usr/lib64
endif
endif
+RPATH = -Wl,-rpath,$(LIBDIR)
+
ifeq ($(NO_ARLIB),0)
all: $(ARLIB)
$(ARLIB): keyutils.o
@@ -73,10 +75,10 @@ keyutils.os: keyutils.c keyutils.h Makefile
keyctl: keyctl.c keyutils.h Makefile
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L. -lkeyutils -Wl,-rpath,$(LIB)
+ $(CC) -L. $(CFLAGS) $(LDFLAGS) $(RPATH) -o $@ $< -lkeyutils
request-key: request-key.c keyutils.h Makefile
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L. -lkeyutils -Wl,-rpath,$(LIB)
+ $(CC) -L. $(CFLAGS) $(LDFLAGS) $(RPATH) -o $@ $< -lkeyutils
MAN1 := $(DESTDIR)/usr/share/man/man1