1# $FreeBSD$ 2 3PROG?= ld-elf.so.1 4SRCS= rtld_start.S \ 5 reloc.c rtld.c rtld_lock.c map_object.c \ 6 malloc.c xmalloc.c debug.c libmap.c 7MAN= rtld.1 8CSTD?= gnu99 9CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD 10CFLAGS+= -I${.CURDIR}/${MACHINE_ARCH} -I${.CURDIR} 11LDFLAGS+= -nostdlib -e .rtld_start 12INSTALLFLAGS= -C -b 13PRECIOUSPROG= 14BINDIR= /libexec 15SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG} 16MLINKS= rtld.1 ld-elf.so.1.1 \ 17 rtld.1 ld.so.1 18 19.if exists(${.CURDIR}/${MACHINE_ARCH}/Makefile.inc) 20.include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc" 21.endif 22 23# If LDSCRIPT is defined, we build the dynamic linker as an 24# executable. Otherwise we build it as a shared object. We ignore 25# LDSCRIPT if the running kernel is too old to support it. 26.if defined(LDSCRIPT) 27KERN_OSRELDATE!= /sbin/sysctl -n kern.osreldate 2>/dev/null || echo 0 28.if ${KERN_OSRELDATE} >= 400001 29LDSO_IS_EXECUTABLE= 30.endif 31.endif 32 33.ifdef LDSO_IS_EXECUTABLE 34OBJS+= dyn_hack.so 35LDFLAGS+= -Wl,-T,${LDSCRIPT} -Wl,-E -Wl,-Bstatic 36DPADD= ${LIBC} 37LDADD= -lc 38.else 39CFLAGS+= -fpic -DPIC 40LDFLAGS+= -shared -Wl,-Bsymbolic 41DPADD= ${LIBC_PIC} 42LDADD= -lc_pic 43.endif 44 45dyn_hack.so: 46 ${CC} -shared -nostdlib -o dyn_hack.so -x c /dev/null 47 48# Since moving rtld-elf to /libexec, we need to create a symlink. 49# Fixup the existing binary that's there so we can symlink over it. 50beforeinstall: 51.if exists(${DESTDIR}/usr/libexec/${PROG}) 52 -chflags noschg ${DESTDIR}/usr/libexec/${PROG} 53.endif 54 55.PATH: ${.CURDIR}/${MACHINE_ARCH} 56 57.include <bsd.prog.mk> 58