xref: /netbsd-src/tools/gdb/README.mknative (revision 547879b380e1830b49a3d66cb85e2a6effebf12c)
1*547879b3Srin$NetBSD: README.mknative,v 1.7 2020/10/09 23:44:46 rin Exp $
2fd8e3777Snathanw
3fd8e3777SnathanwThis file describes how to use the cross-compiler to generate the
4fd8e3777Snathanwnative files for GDB on a target platform.
5fd8e3777Snathanw
6fd8e3777SnathanwNOTE:  DO NOT RUN "mknative" BY HAND!  It requires the Makefile in this
7fd8e3777Snathanwdirectory to set up certain environments first.
8fd8e3777Snathanw
9fd8e3777SnathanwSince libc's features change over time, the config.h files can change as a
10fd8e3777Snathanwresult; thus the instructions below are the same no matter whether
11fd8e3777Snathanwbootstrapping on a cross or native host.  This is important: even on a
12fd8e3777Snathanw"native" host, you should bootstrap the toolchain by building from an
13fd8e3777Snathanwup-to-date source tree to a $DESTDIR using the exact same instructions.
14fd8e3777Snathanw
15fd8e3777SnathanwIn these notes, MACHINE is the $MACHINE of the target.  These files can be
16fd8e3777Snathanwcross-generated.  Though a $MACHINE_ARCH all uses the same config files, you
17fd8e3777Snathanwmust pick a specific $MACHINE so that building the requisite bits below will
18fd8e3777Snathanwwork.
19fd8e3777Snathanw
20fd8e3777Snathanw1. Set MKMAINTAINERTOOLS=yes in mk.conf.  (Needed so that src/tools/gettext
21fd8e3777Snathanw   gets built, eliciting proper HAVE_*GETTEXT* defns in config.h files.)
22fd8e3777Snathanw
23874624a3Smaya2. Build and install a cross toolchain (via "build.sh -U -m MACHINE tools").
24fd8e3777Snathanw
25874624a3Smaya3. At top level, do "nbmake-MACHINE obj do-distrib-dirs includes".
26fd8e3777Snathanw
27874624a3Smaya4. At top level, do "nbmake-MACHINE -C lib build_install".
28fd8e3777Snathanw
29874624a3Smaya5. In src/tools/gdb, do "nbmake-MACHINE obj native-gdb".
30fd8e3777Snathanw
31fd8e3777Snathanw   This will do a full configury in ${.OBJDIR}/.native that is a "Canadian"
32fd8e3777Snathanw   cross toolchain (--build reflects the host platform, but --host and
33fd8e3777Snathanw   --target are the target).  The result is a tree that would build a
34fd8e3777Snathanw   native-to-NetBSD GDB on a cross host, and mknative pulls glue data
35fd8e3777Snathanw   from this.
36fd8e3777Snathanw
37*547879b3Srin   NOTE: this step writes files under src/external/gpl3/gdb/lib, so you
384e48d716Suwe   need to do it in a writable src tree!
394e48d716Suwe
40874624a3Smaya6. Try out a full build using "nbmake-MACHINE" in
41*547879b3Srin   src/external/gpl3/gdb; the result should include a native GDB.
42fd8e3777Snathanw
43874624a3Smaya7. If all is well, commit the glue files and directories added to
44*547879b3Srin   src/external/gpl3/gdb/lib.
45