1 # $NetBSD: Makefile,v 1.7 2009/12/13 09:38:22 mrg 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
\"
25 COPTS.ldgram.c
= -Wno-stack-protector
27 BFDOBJ
!= cd
${TOP}/${BFDSUBDIR}/libbfd
&& ${PRINTOBJDIR}
28 LDADD
+= -L
${BFDOBJ} -lbfd
29 .if
${MKPICLIB} != "no"
30 DPADD
+= ${BFDOBJ}/libbfd_pic.a
32 DPADD
+= ${BFDOBJ}/libbfd.a
35 IBERTYOBJ
!= cd
${TOP}/${BFDSUBDIR}/libiberty
&& ${PRINTOBJDIR}
36 LDADD
+= -L
${IBERTYOBJ} -liberty
37 DPADD
+= ${IBERTYOBJ}/libiberty.a
39 TEXINFO
= ${G_TEXINFOS}
40 COMMONOBJDIR
!= cd
${TOP}/usr.bin
/common
&& ${PRINTOBJDIR}
41 INFOFLAGS
= -I
${COMMONOBJDIR} -I
${DIST}/ld -I
${DIST}/bfd
/doc
-I
${DIST}/libiberty
43 FILESDIR
= ${SCRIPTSDIR}/ldscripts
45 .PATH
: ${COMMONOBJDIR} ${DIST}/ld ${DIST}/ld/emulparams \
46 ${DIST}/ld/emultempl
${DIST}/ld/scripttempl ldscripts
48 BUILDSYMLINKS
+= ${G_STRINGIFY} stringify.sed
49 BUILDSYMLINKS
+= gen-doc.texi configdoc.texi
51 ${PROG}.
info: configdoc.texi bfdver.texi
53 .for f in
${G_EMULATION_OFILES
:S
/^e
//:R
}
54 .if exists
(.depend.
${f})
55 .
include ".depend.${f}"
60 (srcdir=${DIST}/ld EMULATION_NAME
=$f .
${>:M
*.sh
} && \
61 if
[ x
"$$TEMPLATE_NAME" != x
]; then \
62 temp_name
=$$TEMPLATE_NAME.em
; \
66 if
[ x
"$$SCRIPT_NAME" != x
]; then \
67 script
=$$SCRIPT_NAME.sc
; \
71 echo
"e${f}.c: $$temp_name $$script" \
74 DPSRCS
+= .depend.
${f} e
${f}.c
75 CLEANFILES
+= .depend.
${f} e
${f}.c
78 . if
(${MACHINE_ARCH} == "x86_64" && \
79 ("${f}" == "elf_i386" ||
"${f}" == "i386nbsd"))
80 EMUL_LIB_PATH.
${f}=/usr
/lib
/i386
81 . elif
(${MACHINE_ARCH} == "sparc64" && \
82 ("${f}" == "elf32_sparc" ||
"${f}" == "sparcnbsd"))
83 EMUL_LIB_PATH.
${f}=/usr
/lib
/sparc
84 . elif
${MACHINE_ARCH} == "mips64el"
85 . if
"${f}" == "elf32ltsmip" ||
"${f}" == "elf32btsmip"
86 EMUL_LIB_PATH.
${f}:=/usr
/lib
/o32
87 . elif
"${f}" == "elf64btsmip" ||
"${f}" == "elf64btsmip"
88 EMUL_LIB_PATH.
${f}:=/usr
/lib
/64
90 EMUL_LIB_PATH.
${f}=/usr
/lib
93 EMUL_LIB_PATH.
${f}=/usr
/lib
96 #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@
98 e
${f}.c
: ${DIST}/ld/genscripts.sh
${.CURDIR
}/Makefile stringify.sed
100 unset MACHINE || true
; \
101 LIB_PATH
=${EMUL_LIB_PATH.
${f}} NATIVE
=yes \
102 ${HOST_SH} ${DIST}/ld/genscripts.sh
${DIST}/ld ${LIBDIR} "/usr" "/usr/bin" \
103 ${G_target_alias} ${G_target_alias} ${G_target_alias} \
104 ${G_EMUL} ${LIBDIR} yes
${f} "${G_target_alias}"
106 .if
${MACHINE_ARCH} == "x86_64" ||
${MACHINE_ARCH} == "sparc64" || \
107 ${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb"
108 FILES
+= ${f}.x
${f}.xbn
${f}.xn
${f}.xr
${f}.xu
110 # XXX hack to find out if .xs/.xc exists - slow!
111 HAS_XS
!= grep
'^GENERATE_SHLIB_SCRIPT' ${DIST}/ld/emulparams
/${f}.sh || echo
113 #HAS_XC!= grep '^GENERATE_COMBRELOC_SCRIPT' ${DIST}/ld/emulparams/${f}.sh || echo
115 FILES
+= ${f}.xc
${f}.xd
${f}.xdc
${f}.xdw
${f}.xs
${f}.xsc
${f}.xsw
${f}.xw
116 # only do this if we don't have GENERATE_SHLIB_SCRIPT
117 .elif
${MACHINE_ARCH} == "mips64el" ||
${MACHINE_ARCH} == "mips64eb"
118 FILES
+= ${f}.xc
${f}.xs
${f}.xsc
${f}.xsw
${f}.xw
120 .
endif # x64_64 || sparc64 || mips64
124 .
include <bsd.prog.mk
>
125 .
include <bsd.
info.mk
>
126 .
include <bsd.subdir.mk
>
128 # Make sure we use the pre-generated C files
132 cleanprog
: __cleanldscripts
134 -rm -rf ldscripts tmpdir