1 # $NetBSD: Makefile,v 1.92 2009/12/13 09:01:45 mrg Exp $
3 # NOTE: when changing ld.so, ensure that ldd still compiles.
8 # This needs to be before bsd.init.mk
9 .if defined
(BSD_MK_COMPAT_FILE
)
10 .
include <${BSD_MK_COMPAT_FILE}>
13 # We are not building this with PIE
16 .
include <bsd.init.mk
> # for OBJECT_FMT definition
17 .
include <bsd.shlib.mk
> # for SHLINKINSTALLDIR definition
19 .if defined
(LDELFSO_MACHINE_CPU
) && !empty
(LDELFSO_MACHINE_CPU
) && \
20 exists
(${.CURDIR
}/arch
/${LDELFSO_MACHINE_CPU})
21 ARCHSUBDIR
= ${LDELFSO_MACHINE_CPU}
23 ARCHSUBDIR
= ${MACHINE_CPU}
25 M
= ${.CURDIR
}/arch
/${ARCHSUBDIR}
27 .if
((${MACHINE_ARCH} == "alpha") || \
28 (${MACHINE_CPU} == "arm") || \
29 (${MACHINE_ARCH} == "hppa") || \
30 (${MACHINE_ARCH} == "i386") || \
31 (${MACHINE_ARCH} == "m68k") || \
32 (${MACHINE_CPU} == "mips") || \
33 (${MACHINE_ARCH} == "powerpc") || \
34 (${MACHINE_CPU} == "sh3") || \
35 (${MACHINE_ARCH} == "sparc") || \
36 (${MACHINE_ARCH} == "sparc64") || \
37 (${MACHINE_ARCH} == "x86_64") || \
38 (${MACHINE_ARCH} == "vax")) && \
39 ${OBJECT_FMT} == "ELF" && ${MKPIC} != "no"
41 LDFLAGS
+= -shared
-symbolic
-nostartfiles
44 # Adds SRCS, CPPFLAGS, LDFLAGS, etc. Must go first so MD startup source
46 .if exists
($M/Makefile.inc
)
47 .
include "$M/Makefile.inc"
50 # Support compat ld.elf_so.
52 PROG
= ld.elf_so-
${MLIBDIR}
53 CPPFLAGS
+= -DRTLD_ARCH_SUBDIR
=\"${MLIBDIR}\"
58 CLIBOBJ
!= cd
${NETBSDSRCDIR}/lib
/libc
&& ${PRINTOBJDIR}
60 SRCS
+= rtld.c reloc.c symbol.c xmalloc.c xprintf.c debug.c \
61 map_object.c load.c search.c headers.c paths.c expand.c
63 .if
${USE_FORT} == "yes"
64 .PATH.c
: ${NETBSDSRCDIR}/lib
/libc
/misc
65 SRCS
+= stack_protector.c
68 .PATH.c
: ${NETBSDSRCDIR}/lib
/libc
/stdlib
71 BINDIR
= ${SHLINKINSTALLDIR}
73 CPPFLAGS
+= -DLIBDIR
=\"${LIBDIR}\" -D_PATH_RTLD
=\"${BINDIR}/${PROG}\"
74 CPPFLAGS
+= -I
${.CURDIR
}
75 CPPFLAGS
+= -DRTLD_LOADER
76 CPPFLAGS
+= -D_RTLD_SOURCE
77 CPPFLAGS
+= -DCOMBRELOC
79 #CPPFLAGS+= -DRTLD_DEBUG
80 #CPPFLAGS+= -DRTLD_DEBUG_RELOC
82 DBG
= -O3
-fomit-frame-pointer
84 .if
${SHLIBDIR} != ${LIBDIR}
85 CPPFLAGS
+= -DRTLD_DEFAULT_LIBRARY_PATH
=\"${SHLIBDIR}:${LIBDIR}\"
88 LDADD
+= -L
${CLIBOBJ} -L
${DESTDIR}${LIBDIR}
89 .if
${MKPICLIB} != "no"
91 .if
${MKPICINSTALL} != "no"
94 DPADD
+= ${CLIBOBJ}/libc_pic.a
97 DPADD
+= ${CLIBOBJ}/libc.a
104 ${PROG}: ${OBJS} ${DPADD}
105 ${_MKMSG_LINK} ${PROG}
106 ${CC} ${LDFLAGS} -o
${PROG} ${OBJS} ${LDADD}
108 .if
${SHLINKINSTALLDIR} != "/usr/libexec"
109 SYMLINKS
+= ${SHLINKINSTALLDIR}/${PROG} /usr
/libexec
/${PROG}
112 .
include <bsd.prog.mk
>
117 .
include <bsd.man.mk
>