aboutsummaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-11 23:40:22 +0000
committerRoy Marples <roy@marples.name>2008-01-11 23:40:22 +0000
commitd4404ea9c7a5f37e148d22dbe05d804f2df93b11 (patch)
tree8ffa13fc17ccb32f344d9fbef9b982b22d35522a /mk
parent0ec43dfe47c462fdf268635d30627d80c8b0b5de (diff)
Ensure we link against libraries in /lib instead of anywhere else and always use the linker in /libexec instead of anywhere else.
Diffstat (limited to 'mk')
-rw-r--r--mk/lib.mk2
-rw-r--r--mk/prog.mk11
2 files changed, 9 insertions, 4 deletions
diff --git a/mk/lib.mk b/mk/lib.mk
index 43856bf2..825af96d 100644
--- a/mk/lib.mk
+++ b/mk/lib.mk
@@ -25,6 +25,8 @@ lib${LIB}.a: ${OBJS} ${STATICOBJS}
${SHLIB_NAME}: ${VERSION_MAP}
LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
+# We need to ensure we use libraries in /lib
+LDFLAGS+= -L/${LIBNAME} -Wl,-rpath=/${LIBNAME}
${SHLIB_NAME}: ${SOBJS}
@${ECHO} building shared library $@
diff --git a/mk/prog.mk b/mk/prog.mk
index cf1ea0a9..4e27becd 100644
--- a/mk/prog.mk
+++ b/mk/prog.mk
@@ -8,11 +8,14 @@ OBJS+= ${SRCS:.c=.o}
include ${MK}/sys.mk
# Some systems don't include /lib in their standard link path
# so we should embed it if different
-_RPATH_SH= if test "${SHLIBDIR}" != "/usr/${LIBNAME}"; then \
- echo "-Wl,-rpath=/${LIBNAME}"; \
+# This is currently hardcoded for NetBSD which has two dynamic linkers
+# and we need to use the one in /libexec instead of /usr/libexec
+_DYNLINK_SH= if test -e /libexec/ld.elf_so; then \
+ echo "-Wl,-dynamic-linker=/libexec/ld.elf_so"; \
fi
-_RPATH!= ${_RPATH_SH}
-LDFLAGS+= ${_RPATH}$(shell ${_RPATH_SH})
+_DYNLINK!= ${_DYNLINK_SH}
+LDFLAGS+= ${_DYNLINK}$(shell ${_DYNLINK_SH})
+LDFLAGS+= -Wl,-rpath=/${LIBNAME} -L/${LIBNAME}
LDFLAGS+= ${PROGLDFLAGS}
all: depend ${PROG}