]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - libexec/rtld-elf/Makefile
Include FreeBSD ABI tag note in the ELF runtime loader.
[FreeBSD/FreeBSD.git] / libexec / rtld-elf / Makefile
1 # $FreeBSD$
2
3 # Use the following command to build local debug version of dynamic
4 # linker:
5 # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all
6
7 RTLD_ELF_DIR:=  ${.PARSEDIR}
8
9 .include <src.opts.mk>
10 PACKAGE=        clibs
11 MK_PIE=         no # Always position independent using local rules
12 MK_SSP=         no
13
14 CONFS=          libmap.conf
15 PROG?=          ld-elf.so.1
16 .if (${PROG:M*ld-elf32*} != "")
17 TAGS+=          lib32
18 .endif
19 SRCS= \
20         crtbrand.S \
21         rtld_start.S \
22         reloc.c \
23         rtld.c \
24         rtld_lock.c \
25         rtld_malloc.c \
26         rtld_printf.c \
27         map_object.c \
28         xmalloc.c \
29         debug.c \
30         libmap.c
31 MAN?=           rtld.1
32 CSTD?=          gnu99
33 ACFLAGS+=       -DLOCORE
34 CFLAGS+=        -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding
35 CFLAGS+=        -I${SRCTOP}/lib/csu/common
36 .if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH})
37 RTLD_ARCH=      ${MACHINE_ARCH}
38 .else
39 RTLD_ARCH=      ${MACHINE_CPUARCH}
40 .endif
41 CFLAGS+=        -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR}
42
43 NO_WCAST_ALIGN= yes
44 WARNS?=         6
45 INSTALLFLAGS=   -C -b
46 PRECIOUSPROG=
47 BINDIR=         /libexec
48 SYMLINKS=       ../..${BINDIR}/${PROG} ${LIBEXECDIR}/${PROG}
49 MLINKS?=        rtld.1 ld-elf.so.1.1 \
50                 rtld.1 ld.so.1
51
52 CFLAGS+=        -fpic -DPIC $(DEBUG)
53
54 LDFLAGS+=       -shared -Wl,-Bsymbolic -Wl,-z,defs -nostdlib -e ${RTLD_ENTRY}
55 # Pull in the dependencies that we use from libc
56 .include "rtld-libc/Makefile.inc"
57 .if ${MK_TOOLCHAIN} == "no"
58 LDFLAGS+=       -L${LIBCDIR}
59 .endif
60
61 VERSION_DEF=    ${LIBCSRCDIR}/Versions.def
62 SYMBOL_MAPS=    ${RTLD_ELF_DIR}/Symbol.map
63 VERSION_MAP=    Version.map
64 LDFLAGS+=       -Wl,--version-script=${VERSION_MAP}
65
66 .if exists(${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map)
67 SYMBOL_MAPS+=   ${RTLD_ELF_DIR}/${RTLD_ARCH}/Symbol.map
68 .endif
69
70 .sinclude "${RTLD_ELF_DIR}/${RTLD_ARCH}/Makefile.inc"
71 RTLD_ENTRY?=    .rtld_start
72
73 # Since moving rtld-elf to /libexec, we need to create a symlink.
74 # Fixup the existing binary that's there so we can symlink over it.
75 beforeinstall:
76 .if exists(${DESTDIR}/usr/libexec/${PROG}) && ${MK_STAGING} == "no"
77         -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG}
78 .endif
79
80 .PATH: ${RTLD_ELF_DIR}/${RTLD_ARCH} ${SRCTOP}/lib/csu/common
81
82 .if ${.CURDIR} == ${RTLD_ELF_DIR}
83 HAS_TESTS=
84 SUBDIR.${MK_TESTS}+= tests
85 .endif
86
87 .include <bsd.prog.mk>
88 ${PROG_FULL}:   ${VERSION_MAP}
89 .include <bsd.symver.mk>
90
91 .if ${COMPILER_TYPE} == "gcc"
92 # GCC warns about redeclarations even though they have __exported
93 # and are therefore not identical to the ones from the system headers.
94 CFLAGS+=        -Wno-redundant-decls
95 .endif