1999-03-17 03:46:35 +03:00
|
|
|
# $NetBSD: Makefile,v 1.11 1999/03/17 00:46:36 thorpej Exp $
|
1998-09-30 20:47:47 +04:00
|
|
|
|
1999-02-09 20:39:31 +03:00
|
|
|
# for OBJECT_FMT
|
1998-09-30 20:47:47 +04:00
|
|
|
.include <bsd.own.mk>
|
1998-08-28 00:47:21 +04:00
|
|
|
|
1999-03-17 03:46:35 +03:00
|
|
|
.if (${OBJECT_FMT} == "ELF") || defined(BOOTSTRAP_ELF)
|
|
|
|
ELF_PLEASE=
|
|
|
|
.endif
|
|
|
|
|
1999-02-09 20:39:31 +03:00
|
|
|
.if (${MACHINE_ARCH} == "alpha") || \
|
1999-03-17 03:46:35 +03:00
|
|
|
(${MACHINE_ARCH} == "i386" && defined(ELF_PLEASE)) || \
|
1999-02-09 20:39:31 +03:00
|
|
|
(${MACHINE_ARCH} == "mipseb") || \
|
|
|
|
(${MACHINE_ARCH} == "mipsel") || \
|
|
|
|
(${MACHINE_ARCH} == "powerpc") || \
|
1999-03-17 03:46:35 +03:00
|
|
|
(${MACHINE_ARCH} == "sparc" && defined(ELF_PLEASE)) || \
|
1999-02-09 20:39:31 +03:00
|
|
|
(${MACHINE_ARCH} == "sparc64")
|
1998-08-28 00:47:21 +04:00
|
|
|
PROG= ld
|
1999-02-09 20:39:31 +03:00
|
|
|
MAN= ld.1
|
1998-08-28 00:47:21 +04:00
|
|
|
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
|
1999-02-06 07:04:58 +03:00
|
|
|
DPSRCS= ldemul-list.h
|
1999-02-09 20:39:31 +03:00
|
|
|
.else
|
|
|
|
NOPROG=
|
|
|
|
.endif
|
1998-08-28 00:47:21 +04:00
|
|
|
|
|
|
|
CPPFLAGS+= -I. -I${.CURDIR} -I${BFDOBJ} -I${DIST}/ld \
|
|
|
|
-I${DIST}/bfd -I${DIST}/include \
|
1999-02-09 20:39:31 +03:00
|
|
|
-DDEFAULT_EMULATION='"${DEFAULT_EMUL.${MACHINE_ARCH}}"' \
|
1998-12-17 16:59:05 +03:00
|
|
|
-DSCRIPTDIR=\"${SCRIPTDIR}\" \
|
1998-08-28 00:47:21 +04:00
|
|
|
-DTARGET='"${MACHINE_GNU_ARCH}--netbsd"' \
|
|
|
|
-DEMULATION_LIST='${EMULS:S/^/\&ld_/:S/$/_emulation,/} 0'
|
1999-03-05 10:23:51 +03:00
|
|
|
LDADD+= -L${BFDOBJ} -lbfd -lgnumalloc
|
|
|
|
DPADD+= ${BFDOBJ}/libbfd_pic.a ${LIBGNUMALLOC}
|
1999-02-09 20:39:31 +03:00
|
|
|
YHEADER=1
|
1998-08-28 00:47:21 +04:00
|
|
|
|
|
|
|
DIST= ${.CURDIR}/../../dist
|
1999-02-09 20:59:36 +03:00
|
|
|
BFDOBJ!= cd ${.CURDIR}/../../lib/libbfd; ${MAKE} print-objdir
|
1999-02-09 20:39:31 +03:00
|
|
|
SCRIPTDIR= /usr/share/ldscripts
|
1998-08-28 00:47:21 +04:00
|
|
|
|
|
|
|
.PATH: ${DIST}/ld
|
|
|
|
|
1999-02-09 20:39:31 +03:00
|
|
|
##### alpha ######
|
|
|
|
EMULS.alpha= elf64alpha
|
|
|
|
DEFAULT_EMUL.alpha= elf64alpha
|
|
|
|
|
|
|
|
##### i386 #####
|
|
|
|
EMULS.i386= i386nbsd elf_i386
|
1999-03-17 03:46:35 +03:00
|
|
|
.if defined(ELF_PLEASE)
|
1999-02-09 20:39:31 +03:00
|
|
|
DEFAULT_EMUL.i386= elf_i386
|
|
|
|
.else
|
|
|
|
DEFAULT_EMUL.i386= i386nbsd
|
|
|
|
.endif
|
|
|
|
|
|
|
|
##### 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
|
1999-03-17 03:46:35 +03:00
|
|
|
.if defined(ELF_PLEASE)
|
1999-02-09 20:39:31 +03:00
|
|
|
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
|
1998-08-28 00:47:21 +04:00
|
|
|
e${_EMUL_}.c: ${DIST}/ld/genscripts.sh ${DIST}/ld/emulparams/${_EMUL_}.sh
|
1998-08-28 01:20:46 +04:00
|
|
|
sh ${DIST}/ld/genscripts.sh ${DIST}/ld ${LIBDIR} \
|
1998-08-28 00:47:21 +04:00
|
|
|
${MACHINE_GNU_ARCH}-netbsd ${MACHINE_GNU_ARCH}-netbsd \
|
1999-02-09 20:39:31 +03:00
|
|
|
${MACHINE_GNU_ARCH}-netbsd ${_EMUL_} \
|
1998-08-28 00:47:21 +04:00
|
|
|
"" ${_EMUL_}
|
|
|
|
.endfor
|
|
|
|
|
1999-02-09 20:39:31 +03:00
|
|
|
.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
|
1999-02-06 07:04:58 +03:00
|
|
|
@rm -f $@
|
|
|
|
@echo updating $@
|
|
|
|
@for emul in ${EMULS}; do \
|
|
|
|
echo "extern ld_emulation_xfer_type ld_$${emul}_emulation;" >>$@; \
|
|
|
|
done
|
1999-02-09 20:39:31 +03:00
|
|
|
.endif
|
1999-02-06 07:04:58 +03:00
|
|
|
|
1998-12-17 16:59:05 +03:00
|
|
|
afterinstall:
|
1999-02-14 16:01:09 +03:00
|
|
|
(cd ldscripts ; pax -rw . ${DESTDIR}${SCRIPTDIR})
|
|
|
|
chown -R ${BINOWN}:${BINGRP} ${DESTDIR}${SCRIPTDIR}
|
|
|
|
find ${DESTDIR}${SCRIPTDIR} -type f | xargs chmod a=rX
|
|
|
|
find ${DESTDIR}${SCRIPTDIR} -type d | xargs chmod u=rwX,go=rX
|
1998-12-17 16:59:05 +03:00
|
|
|
|
1998-08-28 00:47:21 +04:00
|
|
|
cleanprog: __cleanldscripts
|
|
|
|
__cleanldscripts:
|
|
|
|
rm -rf ldscripts
|
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|
1999-02-06 07:04:58 +03:00
|
|
|
|
|
|
|
${OBJS}: ldemul-list.h
|