NetBSD/tools/binutils/mknative-binutils

141 lines
3.8 KiB
Plaintext
Raw Normal View History

#!/bin/sh
2009-11-09 16:50:41 +03:00
# $NetBSD: mknative-binutils,v 1.7 2009/11/09 13:50:41 skrll Exp $
#
# Shell script for generating all the constants needed for a native
2009-11-08 18:33:29 +03:00
# platform build of src/external/gpl3/binutils
#
# initialise
_TMPDIR=$2
_TOP=$3
_PLATFORM=$4
_VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'`
. $_TOP/tools/gcc/mknative.common
2009-11-08 18:33:29 +03:00
##### external/gpl3/binutils/lib/libbfd #####
get_libbfd () {
2009-11-08 18:33:29 +03:00
mkdir -p $_TOP/external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH
{
getvars bfd/Makefile \
libbfd_la_DEPENDENCIES libbfd_la_OBJECTS DEFS \
INCLUDES TDEFAULTS
2009-11-08 18:33:29 +03:00
} | write_mk external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/defs.mk
2009-11-08 18:33:29 +03:00
write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfd.h <$_TMPDIR/bfd/bfd.h
write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfdver.h <$_TMPDIR/bfd/bfdver.h
write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfd_stdint.h <$_TMPDIR/bfd/bfd_stdint.h
{
cat $_TMPDIR/bfd/config.h
2009-11-08 18:33:29 +03:00
} | write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/config.h
}
2009-11-08 18:33:29 +03:00
##### external/gpl3/binutils/lib/libopcodes #####
get_libopcodes () {
2009-11-08 18:33:29 +03:00
mkdir -p $_TOP/external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH
{
getvars opcodes/Makefile \
archdefs BFD_MACHINES libopcodes_la_SOURCES
2009-11-08 18:33:29 +03:00
} | write_mk external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH/defs.mk
{
cat $_TMPDIR/opcodes/config.h
2009-11-08 18:33:29 +03:00
} | write_c external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH/config.h
}
2009-11-08 18:33:29 +03:00
##### external/gpl3/binutils/lib/libiberty #####
get_libiberty () {
2009-11-08 18:33:29 +03:00
mkdir -p $_TOP/external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH
getvars libiberty/Makefile \
ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
2009-11-08 18:33:29 +03:00
| write_mk external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH/defs.mk
2009-11-08 18:33:29 +03:00
write_c external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH/config.h \
<$_TMPDIR/libiberty/config.h
}
2009-11-08 18:33:29 +03:00
##### external/gpl3/binutils/usr.bin #####
get_binutils () {
### common
2009-11-08 18:33:29 +03:00
mkdir -p $_TOP/external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH
{
getvars binutils/Makefile \
VERSION DEFS INCLUDES PROGRAMS
getvars binutils/doc/Makefile \
man_MANS TEXINFOS
2009-11-09 16:50:41 +03:00
getvars bfd/doc/Makefile \
PKGVERSION | sed 's,\\\(.\),\1,'
getvars bfd/doc/Makefile \
REPORT_BUGS_TEXI
for f in `getvars binutils/Makefile PROGRAMS | sed 'y,-,_,;s,^[^=]*=,,'`; do
getvars binutils/Makefile ${f}_OBJECTS ${f}_DEPENDENCIES
done
2009-11-08 18:33:29 +03:00
} | write_mk external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH/defs.mk
2009-11-08 18:33:29 +03:00
write_c external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH/config.h \
<$_TMPDIR/binutils/config.h
### gas
2009-11-08 18:33:29 +03:00
mkdir -p $_TOP/external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH
getvars gas/Makefile \
DEFS INCLUDES OBJS \
2009-11-08 18:33:29 +03:00
| write_mk external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH/defs.mk
for f in config itbl-cpu obj-format targ-cpu targ-env; do
2009-11-08 18:33:29 +03:00
write_c external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gas/$f.h
done
### gprof
2009-11-08 18:33:29 +03:00
mkdir -p $_TOP/external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH
getvars gprof/Makefile \
DEFS gprof_OBJECTS INCLUDES TEXINFOS \
2009-11-08 18:33:29 +03:00
| write_mk external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH/defs.mk
2009-11-08 18:33:29 +03:00
write_c external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH/gconfig.h <$_TMPDIR/gprof/gconfig.h
### ld
2009-11-08 18:33:29 +03:00
mkdir -p $_TOP/external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH
{
getvars ld/Makefile \
DEFS EMUL EMULATION_OFILES INCLUDES OFILES STRINGIFY TEXINFOS
getvars ld/Makefile \
target_alias | sed 's,[\._0-9A-Z]*$,,'
2009-11-08 18:33:29 +03:00
} | write_mk external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH/defs.mk
for f in config ldemul-list; do
2009-11-08 18:33:29 +03:00
write_c external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/ld/$f.h
done
}
##### main #####
case $1 in
all|binutils) # everything (uses "canadian cross" temp environment)
get_binutils
get_libbfd
get_libopcodes
get_libiberty
exit 0
;;
*) echo invalid arguments; exit 1;;
esac