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