1 # $NetBSD: Makefile,v 1.11 2011/09/25 04:32:47 christos Exp $
5 TOP
= ${NETBSDSRCDIR}/external
/gpl3
/binutils
7 .
include "${.CURDIR}/../common/Makefile.inc"
8 .
include "${.CURDIR}/arch/${MACHINE_ARCH}/defs.mk"
10 SCRIPTSDIR
= /usr
/libdata
13 SRCS
= ${G_OFILES
:.o
=.c
}
14 CPPFLAGS
+= -I
${.CURDIR
}/arch
/${MACHINE_ARCH} \
16 -DDEFAULT_EMULATION
=\"${G_EMUL}\" \
17 -DSCRIPTDIR
=\"${SCRIPTSDIR}\" \
18 -DTARGET
=\"${G_target_alias}\" \
19 -DBINDIR
=\"/usr
/bin
\" \
20 -DTOOLBINDIR
=\"/usr
/bin
\" \
26 COPTS.ldgram.c
= -Wno-stack-protector
28 BFDOBJ
!= cd
${TOP}/${BFDSUBDIR}/libbfd
&& ${PRINTOBJDIR}
29 LDADD
+= -L
${BFDOBJ} -lbfd
30 .if
${MKPICLIB} != "no"
31 DPADD
+= ${BFDOBJ}/libbfd_pic.a
33 DPADD
+= ${BFDOBJ}/libbfd.a
36 IBERTYOBJ
!= cd
${TOP}/${BFDSUBDIR}/libiberty
&& ${PRINTOBJDIR}
37 LDADD
+= -L
${IBERTYOBJ} -liberty
38 DPADD
+= ${IBERTYOBJ}/libiberty.a
40 TEXINFO
= ${G_TEXINFOS}
41 COMMONOBJDIR
!= cd
${TOP}/usr.bin
/common
&& ${PRINTOBJDIR}
42 INFOFLAGS
= -I
${COMMONOBJDIR} -I
${DIST}/ld -I
${DIST}/bfd
/doc
-I
${DIST}/libiberty
44 FILESDIR
= ${SCRIPTSDIR}/ldscripts
46 .PATH
: ${COMMONOBJDIR} ${DIST}/ld ${DIST}/ld/emulparams \
47 ${DIST}/ld/emultempl
${DIST}/ld/scripttempl ldscripts
49 BUILDSYMLINKS
+= ${G_STRINGIFY} stringify.sed
50 BUILDSYMLINKS
+= gen-doc.texi configdoc.texi
52 ${PROG}.
info: configdoc.texi bfdver.texi
54 .for f in
${G_EMULATION_OFILES
:S
/^e
//:R
}
55 .if exists
(.depend.
${f}) && !(make
(clean) || make
(cleandir
))
56 .
include ".depend.${f}"
61 (srcdir=${DIST}/ld EMULATION_NAME
=$f .
${>:M
*.sh
} && \
62 if
[ x
"$$TEMPLATE_NAME" != x
]; then \
63 temp_name
=$$TEMPLATE_NAME.em
; \
67 if
[ x
"$$SCRIPT_NAME" != x
]; then \
68 script
=$$SCRIPT_NAME.sc
; \
72 echo
"e${f}.c: $$temp_name $$script" \
75 DPSRCS
+= .depend.
${f} e
${f}.c
76 CLEANFILES
+= .depend.
${f} e
${f}.c
79 . if
(${MACHINE_ARCH} == "x86_64" && \
80 ("${f}" == "elf_i386" ||
"${f}" == "i386nbsd"))
81 EMUL_LIB_PATH.
${f}=/usr
/lib
/i386
82 . elif
(${MACHINE_ARCH} == "sparc64" && \
83 ("${f}" == "elf32_sparc" ||
"${f}" == "sparcnbsd"))
84 EMUL_LIB_PATH.
${f}=/usr
/lib
/sparc
85 . elif
${MACHINE_ARCH} == "mips64el"
86 . if
"${f}" == "elf32ltsmip" ||
"${f}" == "elf32btsmip"
87 EMUL_LIB_PATH.
${f}:=/usr
/lib
/o32
88 . elif
"${f}" == "elf64ltsmip" ||
"${f}" == "elf64btsmip"
89 EMUL_LIB_PATH.
${f}:=/usr
/lib
/64
91 EMUL_LIB_PATH.
${f}=/usr
/lib
94 EMUL_LIB_PATH.
${f}=/usr
/lib
97 #GENSCRIPTS = LIB_PATH='${LIB_PATH}' $(SHELL) $(srcdir)/genscripts.sh "${srcdir}" "${libdir}" "${prefix}" "${exec_prefix}" @host@ @target@ @ta rget_alias@ "@EMULATION_LIBPATH@" "@NATIVE_LIB_DIRS@" @use_sysroot@
99 e
${f}.c
: ${DIST}/ld/genscripts.sh
${.CURDIR
}/Makefile stringify.sed
101 unset MACHINE || true
; \
102 LIB_PATH
=${EMUL_LIB_PATH.
${f}} NATIVE
=yes \
103 ${HOST_SH} ${DIST}/ld/genscripts.sh
${DIST}/ld ${LIBDIR} "/usr" "/usr/bin" \
104 ${G_target_alias} ${G_target_alias} ${G_target_alias} \
105 ${G_EMUL} ${LIBDIR} yes
${f} "${G_target_alias}"
107 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "sparc64" || \
108 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb"
109 FILES
+= ${f}.x
${f}.xbn
${f}.xn
${f}.xr
${f}.xu
111 # XXX hack to find out if .xs/.xc exists - slow!
112 HAS_XS
!= grep
'^GENERATE_SHLIB_SCRIPT' ${DIST}/ld/emulparams
/${f}.sh || echo
114 #HAS_XC!= grep '^GENERATE_COMBRELOC_SCRIPT' ${DIST}/ld/emulparams/${f}.sh || echo
116 FILES
+= ${f}.xc
${f}.xd
${f}.xdc
${f}.xdw
${f}.xs
${f}.xsc
${f}.xsw
${f}.xw
117 # only do this if we don't have GENERATE_SHLIB_SCRIPT
118 .elif
${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb"
119 FILES
+= ${f}.xc
${f}.xs
${f}.xsc
${f}.xsw
${f}.xw
121 .
endif # x64_64 || sparc64 || mips64
125 .
include <bsd.prog.mk
>
126 .
include <bsd.
info.mk
>
127 .
include <bsd.subdir.mk
>
129 # Make sure we use the pre-generated C files
133 cleanprog
: __cleanldscripts
135 -rm -rf ldscripts tmpdir