Makefile revision 265420
150476Speter# $FreeBSD: head/libexec/rtld-elf/Makefile 265420 2014-05-06 04:22:01Z imp $
238410Sbde
3156813Sru.include <src.opts.mk>
4156813SruMK_SSP=		no
537535Sdes
685093SdesPROG?=		ld-elf.so.1
760924SdesSRCS=		rtld_start.S \
860924Sdes		reloc.c rtld.c rtld_lock.c rtld_printf.c map_object.c \
960924Sdes		malloc.c xmalloc.c debug.c libmap.c
1074870SruMAN=		rtld.1
1160924SdesCSTD?=		gnu99
1237535SdesTOPSRCDIR=	${.CURDIR}/../..
13160737SyarCFLAGS+=	-Wall -DFREEBSD_ELF -DIN_RTLD
14160737SyarCFLAGS+=	-I${TOPSRCDIR}/lib/csu/common
15160737Syar.if exists(${.CURDIR}/${MACHINE_ARCH})
16160737SyarRTLD_ARCH=	${MACHINE_ARCH}
17156813Sru.else
18110165SmarkmRTLD_ARCH=	${MACHINE_CPUARCH}
19240496Sdes.endif
20240496SdesCFLAGS+=	-I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
21202613Sdes.if ${MACHINE_ARCH} == "powerpc64"
22202623SdesCFLAGS+=	-mcall-aixdesc
23202623SdesLDFLAGS+=	-nostdlib -e _rtld_start
2497930Sru.else
2597930SruLDFLAGS+=	-nostdlib -e .rtld_start
26169960Sdes.endif
27169960SdesWARNS?=		2
28114420SdesINSTALLFLAGS=	-C -b
29106068SfennerPRECIOUSPROG=
30195767SkensmithBINDIR=		/libexec
3137535SdesSYMLINKS=	${BINDIR}/${PROG} /usr/libexec/${PROG}
32174767SruMLINKS=		rtld.1 ld-elf.so.1.1 \
33174588Sdes		rtld.1 ld.so.1
34174767Sru
3537535Sdes.if ${MACHINE_CPUARCH} == "sparc64"
3637535SdesCFLAGS+=	-fPIC
3740975Sdes.else
3840975SdesCFLAGS+=	-fpic
3937535Sdes.endif
4040975SdesCFLAGS+=	-DPIC $(DEBUG)
4137535SdesLDFLAGS+=	-shared -Wl,-Bsymbolic
4237535SdesDPADD=		${LIBC_PIC}
43174767SruLDADD=		-lc_pic
44174588Sdes
45174767Sru.if ${MACHINE_CPUARCH} == "arm" && ${MK_ARM_EABI} != "no"
4637535Sdes# Some of the required math functions (div & mod) are implemented in
4737535Sdes# libcompiler_rt on ARM. The library also needs to be placed first to be
4840975Sdes# correctly linked. As some of the functions are used before we have
4940975Sdes# shared libraries.
5037535SdesDPADD+=		${LIBCOMPILER_RT}
5141820SdesLDADD+=		-lcompiler_rt
5237535Sdes.endif
5337535Sdes
5485093Sdes
5585093Sdes
5685093Sdes.if ${MK_SYMVER} == "yes"
5785093SdesLIBCDIR=	${TOPSRCDIR}/lib/libc
5885093SdesVERSION_DEF=	${LIBCDIR}/Versions.def
5985093SdesSYMBOL_MAPS=	${.CURDIR}/Symbol.map
6085093SdesVERSION_MAP=	Version.map
6185093SdesLDFLAGS+=	-Wl,--version-script=${VERSION_MAP}
6285093Sdes
6385093Sdes${PROG}:	${VERSION_MAP}
6485093Sdes
6585093Sdes.if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map)
6685093SdesSYMBOL_MAPS+=	${.CURDIR}/${RTLD_ARCH}/Symbol.map
6785093Sdes.endif
6885093Sdes.endif
6985093Sdes
7085093Sdes.sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc"
7185093Sdes
7285093Sdes# Since moving rtld-elf to /libexec, we need to create a symlink.
7385093Sdes# Fixup the existing binary that's there so we can symlink over it.
7485093Sdesbeforeinstall:
7585093Sdes.if exists(${DESTDIR}/usr/libexec/${PROG})
7685093Sdes	-chflags -h noschg ${DESTDIR}/usr/libexec/${PROG}
7785093Sdes.endif
7885093Sdes
7985093Sdes.PATH: ${.CURDIR}/${RTLD_ARCH}
8085093Sdes
8185093Sdes.include <bsd.symver.mk>
8267809Sobrien.include <bsd.prog.mk>
8337535Sdes