NetBSD/libexec/ld.elf_so/Makefile

81 lines
2.2 KiB
Makefile
Raw Normal View History

# $NetBSD: Makefile,v 1.66 2004/02/22 01:39:43 uwe Exp $
.include <bsd.own.mk> # for OBJECT_FMT definition
.include <bsd.shlib.mk> # for SHLINKINSTALLDIR definition
ARCHSUBDIR= ${MACHINE_CPU}
M= ${.CURDIR}/arch/${ARCHSUBDIR}
.if ((${MACHINE_ARCH} == "alpha") || \
2002-08-10 05:59:33 +04:00
(${MACHINE_ARCH} == "arm") || (${MACHINE_ARCH} == "armeb") || \
(${MACHINE_ARCH} == "hppa") || \
(${MACHINE_ARCH} == "i386") || \
(${MACHINE_ARCH} == "m68k") || \
(${MACHINE_ARCH} == "mipsel") || (${MACHINE_ARCH} == "mipseb") || \
(${MACHINE_ARCH} == "powerpc") || \
(${MACHINE_ARCH} == "sh3eb") || (${MACHINE_ARCH} == "sh3el") || \
(${MACHINE_ARCH} == "sh5eb") || (${MACHINE_ARCH} == "sh5el") || \
(${MACHINE_ARCH} == "sparc") || \
(${MACHINE_ARCH} == "sparc64") || \
(${MACHINE_ARCH} == "x86_64") || \
(${MACHINE_ARCH} == "vax")) && \
${OBJECT_FMT} == "ELF" && ${MKPIC} != "no"
PROG= ld.elf_so
CFLAGS+= -shared -symbolic -nostartfiles
LDFLAGS+= -non_shared
1997-10-22 09:45:08 +04:00
# Adds SRCS, CPPFLAGS, LDFLAGS, etc. Must go first so MD startup source
# is first.
.if exists($M/Makefile.inc)
.include "$M/Makefile.inc"
.endif
CLIBOBJ!= cd ${NETBSDSRCDIR}/lib/libc && ${PRINTOBJDIR}
SRCS+= rtld.c reloc.c symbol.c malloc.c xmalloc.c xprintf.c debug.c \
map_object.c load.c search.c headers.c paths.c
BINDIR=${SHLINKINSTALLDIR}
* Add user-controlled mk.conf variables - SHLIBDIR Location to install shared libraries if ${USE_SHLIBDIR} is "yes". Defaults to "/usr/lib". - USE_SHLIBDIR If "yes", install shared libraries in ${SHLIBDIR} instead of ${LIBDIR}. Defaults to "no". Sets ${_LIBSODIR} to the appropriate value. This may be set by individual Makefiles as well. - SHLINKDIR Location of shared linker. Defaults to "/usr/libexec". If != "/usr/libexec", change the dynamic-linker encoded in shared programs * Set USE_SHLIBDIR for libraries used by /bin and /sbin: libc libcrypt libcrypto libedit libipsec libkvm libm libmi387 libtermcap libutil libz * If ${_LIBSODIR} != ${LIBDIR}, add symlinks from ${LIBDIR}/${LIB}.so* to ${_LIBSODIR}/${LIB}.so* for compatibility. * Always install /sbin/init statically (for now) The net effect of these changes depends on how the variables are set: 1.) If nothing is set or changed, there is no change from the current behaviour: - Static /bin, /sbin, and bits of /usr/* - Dynamic rest - Shared linker is /usr/libexec/ld*so 2.) If the following make variables are set: LDSTATIC= SHLINKDIR=/lib SHLIBDIR=/lib Then the behaviour becomes: - Dynamic tools - .so libraries used by /bin and /sbin are installed to /lib, with symlinks from /usr/lib/lib*so to -> /lib/lib*so where appropriate - Shared linker is /lib/ld*so 3.) As per 2.), but add the following variable: USE_SHLIBDIR=yes This forces all .so's to be instaleld in /lib (with compat symlinks), not just those tagged by their Makefiles to be. Again, compat symlinks are installed
2001-12-28 04:32:37 +03:00
CPPFLAGS+= -DLIBDIR=\"${LIBDIR}\" -D_PATH_RTLD=\"${BINDIR}/${PROG}\"
CPPFLAGS+= -I${.CURDIR}
CPPFLAGS+= -DRTLD_LOADER
CPPFLAGS+= -D_RTLD_SOURCE
2002-10-05 19:52:15 +04:00
#CPPFLAGS+= -DDEBUG
#CPPFLAGS+= -DRTLD_DEBUG
#CPPFLAGS+= -DRTLD_DEBUG_RELOC
#DBG= -g
DBG= -O3 -fomit-frame-pointer
.if ${SHLIBDIR} != ${LIBDIR}
CPPFLAGS+= -DRTLD_DEFAULT_LIBRARY_PATH=\"${SHLIBDIR}:${LIBDIR}\"
.endif
LDADD+= -L${CLIBOBJ} -L${DESTDIR}${LIBDIR} -lc_pic
.if ${MKPICINSTALL} != "no"
DPADD+= ${LIBC_PIC}
.endif
DPADD+= ${CLIBOBJ}/libc_pic.a
STRIPFLAG=
.PATH: $M
${PROG}: ${OBJS} ${DPADD}
${_MKMSG_LINK} ${PROG}
${CC} ${CFLAGS} ${LDFLAGS:@F@-Wl,$F@} -o ${PROG} ${OBJS} ${LDADD}
.if ${SHLINKINSTALLDIR} != "/usr/libexec"
SYMLINKS+= ${SHLINKINSTALLDIR}/${PROG} /usr/libexec/${PROG}
.endif
.include <bsd.prog.mk>
.else
MAN= ld.elf_so.1
.include <bsd.man.mk>
.endif