1# $FreeBSD$ 2 3.include <bsd.own.mk> 4MK_SSP= no 5 6PROG?= ld-elf.so.1 7SRCS= rtld_start.S \ 8 reloc.c rtld.c rtld_lock.c map_object.c \ 9 malloc.c xmalloc.c debug.c libmap.c 10MAN= rtld.1 11CSTD?= gnu99 12CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD 13.if exists(${.CURDIR}/${MACHINE_ARCH}) 14RTLD_ARCH= ${MACHINE_ARCH} 15.else 16RTLD_ARCH= ${MACHINE_CPUARCH} 17.endif 18CFLAGS+= -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR} 19.if ${MACHINE_ARCH} == "powerpc64" 20LDFLAGS+= -nostdlib -e _rtld_start 21.else 22LDFLAGS+= -nostdlib -e .rtld_start 23.endif 24WARNS?= 2 25INSTALLFLAGS= -C -b 26PRECIOUSPROG= 27BINDIR= /libexec 28SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG} 29MLINKS= rtld.1 ld-elf.so.1.1 \ 30 rtld.1 ld.so.1 31 32.if ${MACHINE_CPUARCH} == "sparc64" 33CFLAGS+= -fPIC 34.else 35CFLAGS+= -fpic 36.endif 37CFLAGS+= -DPIC $(DEBUG) 38LDFLAGS+= -shared -Wl,-Bsymbolic 39DPADD= ${LIBC_PIC} 40LDADD= -lc_pic -lssp_nonshared 41 42.if ${MK_SYMVER} == "yes" 43LIBCDIR= ${.CURDIR}/../../lib/libc 44VERSION_DEF= ${LIBCDIR}/Versions.def 45SYMBOL_MAPS= ${.CURDIR}/Symbol.map 46VERSION_MAP= Version.map 47LDFLAGS+= -Wl,--version-script=${VERSION_MAP} 48 49${PROG}: ${VERSION_MAP} 50 51.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map) 52SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map 53.endif 54.endif 55 56.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" 57 58# Since moving rtld-elf to /libexec, we need to create a symlink. 59# Fixup the existing binary that's there so we can symlink over it. 60beforeinstall: 61.if exists(${DESTDIR}/usr/libexec/${PROG}) 62 -chflags noschg ${DESTDIR}/usr/libexec/${PROG} 63.endif 64 65.PATH: ${.CURDIR}/${RTLD_ARCH} 66 67.include <bsd.symver.mk> 68.include <bsd.prog.mk> 69