]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - libexec/rtld-elf/Makefile
Remove spurious newline
[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 .include <src.opts.mk>
8 PACKAGE=        clibs
9 MK_PIE=         no # Always position independent using local rules
10 MK_SSP=         no
11
12 CONFS=          libmap.conf
13 PROG?=          ld-elf.so.1
14 .if (${PROG:M*ld-elf32*} != "")
15 TAGS+=          lib32
16 .endif
17 SRCS= \
18         rtld_start.S \
19         reloc.c \
20         rtld.c \
21         rtld_lock.c \
22         rtld_malloc.c \
23         rtld_printf.c \
24         map_object.c \
25         xmalloc.c \
26         debug.c \
27         libmap.c
28 MAN=            rtld.1
29 CSTD?=          gnu99
30 CFLAGS+=        -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding
31 CFLAGS+=        -I${SRCTOP}/lib/csu/common
32 .if exists(${.CURDIR}/${MACHINE_ARCH})
33 RTLD_ARCH=      ${MACHINE_ARCH}
34 .else
35 RTLD_ARCH=      ${MACHINE_CPUARCH}
36 .endif
37 CFLAGS+=        -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
38 .if ${MACHINE_ARCH} == "powerpc64"
39 LDFLAGS+=       -nostdlib -e _rtld_start
40 .else
41 LDFLAGS+=       -nostdlib -e .rtld_start
42 .endif
43
44 NO_WCAST_ALIGN= yes
45 WARNS?=         6
46 INSTALLFLAGS=   -C -b
47 PRECIOUSPROG=
48 BINDIR=         /libexec
49 SYMLINKS=       ../..${BINDIR}/${PROG} ${LIBEXECDIR}/${PROG}
50 MLINKS=         rtld.1 ld-elf.so.1.1 \
51                 rtld.1 ld.so.1
52
53 .if ${MACHINE_CPUARCH} == "sparc64"
54 CFLAGS+=        -fPIC
55 .else
56 CFLAGS+=        -fpic
57 .endif
58 CFLAGS+=        -DPIC $(DEBUG)
59 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
60 CFLAGS+=        -fvisibility=hidden
61 .endif
62 .if ${MACHINE_CPUARCH} == "mips"
63 CFLAGS.reloc.c+=-fno-jump-tables
64 .endif
65 LDFLAGS+=       -shared -Wl,-Bsymbolic -Wl,-z,defs
66 LIBADD=         c_nossp_pic
67 .if ${MK_TOOLCHAIN} == "no"
68 LDFLAGS+=       -L${LIBCDIR}
69 .endif
70
71 .if ${MACHINE_CPUARCH} == "arm"
72 # Some of the required math functions (div & mod) are implemented in
73 # libcompiler_rt on ARM. The library also needs to be placed first to be
74 # correctly linked. As some of the functions are used before we have
75 # shared libraries.
76 LIBADD+=        compiler_rt
77 .endif
78
79
80
81 .if ${MK_SYMVER} == "yes"
82 VERSION_DEF=    ${LIBCSRCDIR}/Versions.def
83 SYMBOL_MAPS=    ${.CURDIR}/Symbol.map
84 VERSION_MAP=    Version.map
85 LDFLAGS+=       -Wl,--version-script=${VERSION_MAP}
86
87 .if exists(${.CURDIR}/${RTLD_ARCH}/Symbol.map)
88 SYMBOL_MAPS+=   ${.CURDIR}/${RTLD_ARCH}/Symbol.map
89 .endif
90 .endif
91
92 .sinclude "${.CURDIR}/${RTLD_ARCH}/Makefile.inc"
93
94 # Since moving rtld-elf to /libexec, we need to create a symlink.
95 # Fixup the existing binary that's there so we can symlink over it.
96 beforeinstall:
97 .if exists(${DESTDIR}/usr/libexec/${PROG}) && ${MK_STAGING} == "no"
98         -chflags -h noschg ${DESTDIR}/usr/libexec/${PROG}
99 .endif
100
101 .PATH: ${.CURDIR}/${RTLD_ARCH}
102
103 HAS_TESTS=
104 SUBDIR.${MK_TESTS}+= tests
105
106 .include <bsd.prog.mk>
107 ${PROG_FULL}:   ${VERSION_MAP}
108 .include <bsd.symver.mk>
109
110 .if ${COMPILER_TYPE} == "gcc"
111 # GCC warns about redeclarations even though they have __exported
112 # and are therefore not identical to the ones from the system headers.
113 CFLAGS+=        -Wno-redundant-decls
114 .if ${COMPILER_VERSION} < 40300
115 # Silence -Wshadow false positives in ancient GCC
116 CFLAGS+=        -Wno-shadow
117 .endif
118 .endif