- Use the stuff in src/gnu/lib/libbfd

- Descend into ld.new on all systems to build ldscripts
- Build ld.new if (i386 || sparc) && ELF
- Merge separate _*.mk files into one Makefile
- Depend ldemul-list.h on Makefile
This commit is contained in:
tv 1999-02-09 17:39:31 +00:00
parent fb1e232640
commit 60ca409eed
7 changed files with 74 additions and 59 deletions

View File

@ -1,53 +1,111 @@
# $NetBSD: Makefile,v 1.6 1999/02/06 04:04:58 tv Exp $
# $NetBSD: Makefile,v 1.7 1999/02/09 17:39:31 tv Exp $
# XXX set MACHINE_GNU_ARCH for _<arch>.mk
# for OBJECT_FMT
.include <bsd.own.mk>
.if (${MACHINE_ARCH} == "alpha") || \
(${MACHINE_ARCH} == "i386" && ${OBJECT_FMT} == "ELF") || \
(${MACHINE_ARCH} == "mipseb") || \
(${MACHINE_ARCH} == "mipsel") || \
(${MACHINE_ARCH} == "powerpc") || \
(${MACHINE_ARCH} == "sparc" && ${OBJECT_FMT} == "ELF") || \
(${MACHINE_ARCH} == "sparc64")
PROG= ld
MAN= ld.1
SRCS= ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c ldmain.c ldmisc.c \
ldver.c ldwrite.c lexsup.c mri.c ldcref.c ldgram.y ldlex.l
DPSRCS= ldemul-list.h
MAN= ld.1
YHEADER=1
SCRIPTDIR= /usr/libdata
.else
NOPROG=
.endif
CPPFLAGS+= -I. -I${.CURDIR} -I${BFDOBJ} -I${DIST}/ld \
-I${DIST}/bfd -I${DIST}/include \
-DDEFAULT_EMULATION='"${DEFAULT_EMUL}"' \
-DDEFAULT_EMULATION='"${DEFAULT_EMUL.${MACHINE_ARCH}}"' \
-DSCRIPTDIR=\"${SCRIPTDIR}\" \
-DTARGET='"${MACHINE_GNU_ARCH}--netbsd"' \
-DEMULATION_LIST='${EMULS:S/^/\&ld_/:S/$/_emulation,/} 0'
# gets these from BFDOBJ since ld uses bfd internal headers
DPADD+= ${BFDOBJ}/libbfd_pic.a
LDADD+= -L${BFDOBJ} -lbfd
YHEADER=1
DIST= ${.CURDIR}/../../dist
BFDOBJ!= cd ${.CURDIR}/../../lib/bfd; ${MAKE} print-objdir
SCRIPTDIR= /usr/share/ldscripts
.PATH: ${DIST}/ld
.include "_${MACHINE_ARCH}.mk"
##### alpha ######
EMULS.alpha= elf64alpha
DEFAULT_EMUL.alpha= elf64alpha
LIB_PATH= ${LIBDIR} # passed to genscripts.sh
##### i386 #####
EMULS.i386= i386nbsd elf_i386
.if ${OBJECT_FMT} == "ELF"
DEFAULT_EMUL.i386= elf_i386
.else
DEFAULT_EMUL.i386= i386nbsd
.endif
.for _EMUL_ in ${EMULS}
SRCS+= e${_EMUL_}.c
CLEANFILES+= e${_EMUL_}.c
##### mipseb #####
EMULS.mipseb= elf32lmip elf32bmip
DEFAULT_EMUL.mipseb= elf32bmip
##### mipsel #####
EMULS.mipsel= elf32lmip elf32bmip
DEFAULT_EMUL.mipsel= elf32lmip
##### powerpc #####
EMULS.powerpc= elf32ppc
DEFAULT_EMUL.powerpc= elf32ppc
##### sparc #####
EMULS.sparc= sparcnbsd elf32_sparc sun4
.if ${OBJECT_FMT} == "ELF"
DEFAULT_EMUL.sparc= elf32_sparc
.else
DEFAULT_EMUL.sparc= sparcnbsd
.endif
##### sparc64 #####
EMULS.sparc64= elf64_sparc sparcnbsd elf32_sparc sun4
DEFAULT_EMUL.sparc64= elf64_sparc
ALL_EMULS!= (for i in ${EMULS.alpha} ${EMULS.i386} \
${EMULS.mipseb} ${EMULS.mipsel} ${EMULS.powerpc} \
${EMULS.sparc} ${EMULS.sparc64}; do echo $$i; done) | \
sort | uniq
LIB_PATH= ${LIBDIR} # passed to genscripts
# The ldscripts need to be generated even if we don't build ld.
.for _EMUL_ in ${ALL_EMULS}
CLEANFILES+= e${_EMUL_}.c
all: e${_EMUL_}.c
e${_EMUL_}.c: ${DIST}/ld/genscripts.sh ${DIST}/ld/emulparams/${_EMUL_}.sh
sh ${DIST}/ld/genscripts.sh ${DIST}/ld ${LIBDIR} \
${MACHINE_GNU_ARCH}-netbsd ${MACHINE_GNU_ARCH}-netbsd \
${MACHINE_GNU_ARCH}-netbsd ${DEFAULT_EMUL} \
${MACHINE_GNU_ARCH}-netbsd ${_EMUL_} \
"" ${_EMUL_}
.endfor
ldemul-list.h:
.if !defined(NOPROG)
#.if defined(UNIFIED_LD)
#EMULS= ${ALL_EMULS} # XXX not quite functional yet
#.else
EMULS= ${EMULS.${MACHINE_ARCH}}
#.endif
.for _EMUL_ in ${EMULS}
SRCS+= e${_EMUL_}.c
.endfor
ldemul-list.h: Makefile
@rm -f $@
@echo updating $@
@for emul in ${EMULS}; do \
echo "extern ld_emulation_xfer_type ld_$${emul}_emulation;" >>$@; \
done
.endif
afterinstall:
pax -rw ldscripts ${DESTDIR}${SCRIPTDIR}
@ -56,11 +114,6 @@ cleanprog: __cleanldscripts
__cleanldscripts:
rm -rf ldscripts
# Make sure no generated files exist in the src tree before depend or build.
# On a system where `.depend' is correct, this command does nothing.
beforedepend:
@rm -f ${DIST}/ld/ldgram.c ${DIST}/ld/ldgram.h ${DIST}/ld/ldlex.c
.include <bsd.prog.mk>
${OBJS}: ldemul-list.h

View File

@ -1,4 +0,0 @@
# $NetBSD: _alpha.mk,v 1.2 1998/09/30 16:47:48 jonathan Exp $
EMULS= elf64alpha
DEFAULT_EMUL= elf64alpha

View File

@ -1,8 +0,0 @@
# $NetBSD: _i386.mk,v 1.2 1999/01/11 09:53:26 christos Exp $
EMULS= i386nbsd elf_i386
.if ${OBJECT_FMT} == "ELF"
DEFAULT_EMUL= elf_i386
.else
DEFAULT_EMUL= i386nbsd
.endif

View File

@ -1,10 +0,0 @@
# $NetBSD: _mips.mk,v 1.1 1998/09/30 16:47:48 jonathan Exp $
EMULS= elf32lmip elf32bmip
# Default emul depends on endian-ness
.if (${MACHINE_GNU_ARCH} == "mipsel")
DEFAULT_EMUL= elf32lmip
.else
DEFAULT_EMUL= elf32bmip
.endif

View File

@ -1,4 +0,0 @@
# $NetBSD: _powerpc.mk,v 1.1 1999/02/06 04:04:42 tv Exp $
EMULS= elf32ppc
DEFAULT_EMUL= elf32ppc

View File

@ -1,8 +0,0 @@
# $NetBSD: _sparc.mk,v 1.3 1999/01/31 21:16:46 christos Exp $
EMULS= sparcnbsd elf32_sparc sun4
.if ${OBJECT_FMT} == "ELF"
DEFAULT_EMUL= elf32_sparc
.else
DEFAULT_EMUL= sparcnbsd
.endif

View File

@ -1,4 +0,0 @@
# $NetBSD: _sparc64.mk,v 1.1 1998/11/23 09:44:35 mrg Exp $
EMULS= elf64_sparc
DEFAULT_EMUL= elf64_sparc