Expand PMF_FN_* macros.
[netbsd-mini2440.git] / libexec / ld.elf_so / Makefile
blobc41986d59526a0f6d0f6cb3aff0fe6de5dcf8904
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.
6 WARNS?=4
8 # This needs to be before bsd.init.mk
9 .if defined(BSD_MK_COMPAT_FILE)
10 .include <${BSD_MK_COMPAT_FILE}>
11 .endif
13 # We are not building this with PIE
14 PIE_CFLAGS=
15 PIE_LDFLAGS=
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}
22 .else
23 ARCHSUBDIR= ${MACHINE_CPU}
24 .endif
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
42 LDFLAGS+= -Wl,-static
44 # Adds SRCS, CPPFLAGS, LDFLAGS, etc. Must go first so MD startup source
45 # is first.
46 .if exists($M/Makefile.inc)
47 .include "$M/Makefile.inc"
48 .endif
50 # Support compat ld.elf_so.
51 .if defined(MLIBDIR)
52 PROG= ld.elf_so-${MLIBDIR}
53 CPPFLAGS+= -DRTLD_ARCH_SUBDIR=\"${MLIBDIR}\"
54 .else
55 PROG= ld.elf_so
56 .endif
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
66 .endif
68 .PATH.c: ${NETBSDSRCDIR}/lib/libc/stdlib
69 SRCS+= exit.c
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
78 #CPPFLAGS+= -DDEBUG
79 #CPPFLAGS+= -DRTLD_DEBUG
80 #CPPFLAGS+= -DRTLD_DEBUG_RELOC
81 #DBG= -g
82 DBG= -O3 -fomit-frame-pointer
84 .if ${SHLIBDIR} != ${LIBDIR}
85 CPPFLAGS+= -DRTLD_DEFAULT_LIBRARY_PATH=\"${SHLIBDIR}:${LIBDIR}\"
86 .endif
88 LDADD+= -L${CLIBOBJ} -L${DESTDIR}${LIBDIR}
89 .if ${MKPICLIB} != "no"
90 LDADD+= -lc_pic
91 .if ${MKPICINSTALL} != "no"
92 DPADD+= ${LIBC_PIC}
93 .endif
94 DPADD+= ${CLIBOBJ}/libc_pic.a
95 .else
96 LDADD+= -lc
97 DPADD+= ${CLIBOBJ}/libc.a
98 .endif
100 STRIPFLAG=
102 .PATH: $M
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}
110 .endif
112 .include <bsd.prog.mk>
113 .else
115 MAN= ld.elf_so.1
117 .include <bsd.man.mk>
118 .endif