The three separate packages, binutils
, GCC and GDB are all taken
from a common source tree. GCC and GDB both use many libraries
from binutils
. It is convenient to reassemble that source tree and
make a single build of all the tools together.
The easiest way to achieve this is to link all the top level directories in each package into a single unified directory, leaving out any duplicated files or directories.
The following bash script will take unpacked distributions of
binutils
GCC and GDB and link them into a single directory,
srcw
.
#!/bin/bash component_dirs='binutils-2.18.50 gcc-4.2.2 gdb-6.8' unified_src=srcw cd ${unified_src} ignore_list=". .. CVS .svn" for srcdir in ${component_dirs} do echo "Component: $srcdir" case srcdir in /* | [A-Za-z]:[\\/]*) ;; *) srcdir="../${srcdir}" ;; esac files=`ls -a ${srcdir}` for f in ${files} do found= for i in ${ignore_list} do if [ "$f" = "$i" ] then found=yes fi done if [ -z "${found}" ] then echo "$f ..linked" ln -s ${srcdir}/$f . fi done ignore_list="${ignore_list} ${files}" done cd ..
The entire tool chain can then be configured and built in a separate
directory. The configure
script understands to
pass on top level arguments to subsidiary configuration scripts. For
example to configure to build a C only tool chain for the 32-bit
OpenRISC 1000 architecture to be installed in
/opt/or32-elf
, the following would be
appropriate.
mkdir build cd build ../src/configure --target=or32-elf --enable-languages=c --prefix=/opt/or32-elf cd ..
Each tool can be built with its own specific target within that build directory
cd build make all-build all-binutils all-gas all-ld all-gcc all-gdb cd ..
Note | |
---|---|
The initial make target, |
Similarly the tools can be installed using the following:
cd build make install-build install-binutils install-gas install-ld install-gcc \ install-gdb cd ..