coverity appeasement - redundant check
[minix.git] / external / gpl3 / binutils / usr.bin / ld / Makefile
blob8e1c248e83abc5cddb8909c8f5215ac02c7a992b
1 # $NetBSD: Makefile,v 1.11 2011/09/25 04:32:47 christos Exp $
3 .include <bsd.own.mk>
5 TOP= ${NETBSDSRCDIR}/external/gpl3/binutils
7 .include "${.CURDIR}/../common/Makefile.inc"
8 .include "${.CURDIR}/arch/${MACHINE_ARCH}/defs.mk"
10 SCRIPTSDIR= /usr/libdata
12 PROG= ld
13 SRCS= ${G_OFILES:.o=.c}
14 CPPFLAGS+= -I${.CURDIR}/arch/${MACHINE_ARCH} \
15 -I${DIST}/ld \
16 -DDEFAULT_EMULATION=\"${G_EMUL}\" \
17 -DSCRIPTDIR=\"${SCRIPTSDIR}\" \
18 -DTARGET=\"${G_target_alias}\" \
19 -DBINDIR=\"/usr/bin\" \
20 -DTOOLBINDIR=\"/usr/bin\" \
21 -DENABLE_PLUGINS
23 LDADD= -lintl
24 DPADD= ${LIBINTL}
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
32 .else
33 DPADD+= ${BFDOBJ}/libbfd.a
34 .endif
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}"
57 .endif
59 .depend.${f}: ${f}.sh
60 ${_MKTARGET_CREATE}
61 (srcdir=${DIST}/ld EMULATION_NAME=$f . ${>:M*.sh} && \
62 if [ x"$$TEMPLATE_NAME" != x ]; then \
63 temp_name=$$TEMPLATE_NAME.em; \
64 else \
65 temp_name=; \
66 fi; \
67 if [ x"$$SCRIPT_NAME" != x ]; then \
68 script=$$SCRIPT_NAME.sc; \
69 else \
70 script=; \
71 fi; \
72 echo "e${f}.c: $$temp_name $$script" \
73 ) >$@
75 DPSRCS+= .depend.${f} e${f}.c
76 CLEANFILES+= .depend.${f} e${f}.c
78 # XXX super hack
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
90 . else
91 EMUL_LIB_PATH.${f}=/usr/lib
92 . endif
93 . else
94 EMUL_LIB_PATH.${f}=/usr/lib
95 . endif
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
100 ${_MKTARGET_CREATE}
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
113 # XXX
114 #HAS_XC!= grep '^GENERATE_COMBRELOC_SCRIPT' ${DIST}/ld/emulparams/${f}.sh || echo
115 .if !empty(HAS_XS)
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
120 .endif
121 .endif # x64_64 || sparc64 || mips64
123 .endfor
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
130 .l.c .y.c .y.h:
131 @true
133 cleanprog: __cleanldscripts
134 __cleanldscripts:
135 -rm -rf ldscripts tmpdir