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 rtld_printf.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" 20CFLAGS+= -mcall-aixdesc 21LDFLAGS+= -nostdlib -e _rtld_start 22.else 23LDFLAGS+= -nostdlib -e .rtld_start 24.endif 25WARNS?= 2 26INSTALLFLAGS= -C -b 27PRECIOUSPROG= 28BINDIR= /libexec 29SYMLINKS= ${BINDIR}/${PROG} /usr/libexec/${PROG} 30MLINKS= rtld.1 ld-elf.so.1.1 \ 31 rtld.1 ld.so.1 32 33.if ${MACHINE_CPUARCH} == "sparc64" 34CFLAGS+= -fPIC 35.else 36CFLAGS+= -fpic 37.endif 38CFLAGS+= -DPIC $(DEBUG) 39LDFLAGS+= -shared -Wl,-Bsymbolic 40DPADD= ${LIBC_PIC} 41LDADD= -lc_pic -lssp_nonshared 42 43.if ${MK_SYMVER} == "yes" 44LIBCDIR= ${.CURDIR}/../../lib/libc 45VERSION_DEF= ${LIBCDIR}/Versions.def 46SYMBOL_MAPS= ${.CURDIR}/Symbol.map 47VERSION_MAP= Version.map 48LDFLAGS+= -Wl,--version-script=${VERSION_MAP} 49 50${PROG}: ${VERSION_MAP} 51 52.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map) 53SYMBOL_MAPS+= ${.CURDIR}/${RTLD_ARCH}/Symbol.map 54.endif 55.endif 56 57.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc" 58 59# Since moving rtld-elf to /libexec, we need to create a symlink. 60# Fixup the existing binary that's there so we can symlink over it. 61beforeinstall: 62.if exists(${DESTDIR}/usr/libexec/${PROG}) 63 -chflags noschg ${DESTDIR}/usr/libexec/${PROG} 64.endif 65 66.PATH: ${.CURDIR}/${RTLD_ARCH} 67 68.include <bsd.symver.mk> 69.include <bsd.prog.mk> 70