No empty .Rs/.Re
[netbsd-mini2440.git] / tools / binutils / mknative-binutils
blob5208f25c4da90b64e6cee4c534abb290f503428f
1 #!/bin/sh
2 # $NetBSD: mknative-binutils,v 1.6 2009/11/08 15:33:29 skrll Exp $
4 # Shell script for generating all the constants needed for a native
5 # platform build of src/external/gpl3/binutils
8 # initialise
10 _TMPDIR=$2
11 _TOP=$3
12 _PLATFORM=$4
13 _VPATH=`grep VPATH ${_TMPDIR}/Makefile | sed 's,^.*=[ ]*,,'`
15 . $_TOP/tools/gcc/mknative.common
17 ##### external/gpl3/binutils/lib/libbfd #####
19 get_libbfd () {
20 mkdir -p $_TOP/external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH
23 getvars bfd/Makefile \
24 libbfd_la_DEPENDENCIES libbfd_la_OBJECTS DEFS \
25 INCLUDES TDEFAULTS
26 } | write_mk external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/defs.mk
28 write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfd.h <$_TMPDIR/bfd/bfd.h
29 write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfdver.h <$_TMPDIR/bfd/bfdver.h
30 write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/bfd_stdint.h <$_TMPDIR/bfd/bfd_stdint.h
33 cat $_TMPDIR/bfd/config.h
34 } | write_c external/gpl3/binutils/lib/libbfd/arch/$MACHINE_ARCH/config.h
37 ##### external/gpl3/binutils/lib/libopcodes #####
39 get_libopcodes () {
40 mkdir -p $_TOP/external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH
43 getvars opcodes/Makefile \
44 archdefs BFD_MACHINES libopcodes_la_SOURCES
45 } | write_mk external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH/defs.mk
48 cat $_TMPDIR/opcodes/config.h
49 } | write_c external/gpl3/binutils/lib/libopcodes/arch/$MACHINE_ARCH/config.h
52 ##### external/gpl3/binutils/lib/libiberty #####
54 get_libiberty () {
55 mkdir -p $_TOP/external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH
57 getvars libiberty/Makefile \
58 ALLOCA EXTRA_OFILES LIBOBJS REQUIRED_OFILES \
59 | write_mk external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH/defs.mk
61 write_c external/gpl3/binutils/lib/libiberty/arch/$MACHINE_ARCH/config.h \
62 <$_TMPDIR/libiberty/config.h
65 ##### external/gpl3/binutils/usr.bin #####
67 get_binutils () {
68 ### common
70 mkdir -p $_TOP/external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH
73 getvars binutils/Makefile \
74 VERSION DEFS INCLUDES PROGRAMS
75 getvars binutils/doc/Makefile \
76 man_MANS TEXINFOS
77 getvars bfd/doc/Makefile \
78 PKGVERSION | sed 's,\\\(.\),\1,'
79 getvars bfd/doc/Makefile \
80 REPORT_BUGS_TEXI
82 for f in `getvars binutils/Makefile PROGRAMS | sed 'y,-,_,;s,^[^=]*=,,'`; do
83 getvars binutils/Makefile ${f}_OBJECTS ${f}_DEPENDENCIES
84 done
85 } | write_mk external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH/defs.mk
87 write_c external/gpl3/binutils/usr.bin/common/arch/$MACHINE_ARCH/config.h \
88 <$_TMPDIR/binutils/config.h
90 ### gas
92 mkdir -p $_TOP/external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH
94 getvars gas/Makefile \
95 DEFS INCLUDES OBJS \
96 | write_mk external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH/defs.mk
98 for f in config itbl-cpu obj-format targ-cpu targ-env; do
99 write_c external/gpl3/binutils/usr.bin/gas/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/gas/$f.h
100 done
102 ### gprof
104 mkdir -p $_TOP/external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH
106 getvars gprof/Makefile \
107 DEFS gprof_OBJECTS INCLUDES TEXINFOS \
108 | write_mk external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH/defs.mk
110 write_c external/gpl3/binutils/usr.bin/gprof/arch/$MACHINE_ARCH/gconfig.h <$_TMPDIR/gprof/gconfig.h
112 ### ld
114 mkdir -p $_TOP/external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH
117 getvars ld/Makefile \
118 DEFS EMUL EMULATION_OFILES INCLUDES OFILES STRINGIFY TEXINFOS
119 getvars ld/Makefile \
120 target_alias | sed 's,[\._0-9A-Z]*$,,'
121 } | write_mk external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH/defs.mk
123 for f in config ldemul-list; do
124 write_c external/gpl3/binutils/usr.bin/ld/arch/$MACHINE_ARCH/$f.h <$_TMPDIR/ld/$f.h
125 done
128 ##### main #####
130 case $1 in
131 all|binutils) # everything (uses "canadian cross" temp environment)
132 get_binutils
133 get_libbfd
134 get_libopcodes
135 get_libiberty
136 exit 0
139 *) echo invalid arguments; exit 1;;
140 esac