11.7Srin$NetBSD: README.mknative,v 1.7 2020/10/09 23:44:46 rin Exp $
21.1Snathanw
31.1SnathanwThis file describes how to use the cross-compiler to generate the
41.1Snathanwnative files for GDB on a target platform.
51.1Snathanw
61.1SnathanwNOTE:  DO NOT RUN "mknative" BY HAND!  It requires the Makefile in this
71.1Snathanwdirectory to set up certain environments first.
81.1Snathanw
91.1SnathanwSince libc's features change over time, the config.h files can change as a
101.1Snathanwresult; thus the instructions below are the same no matter whether
111.1Snathanwbootstrapping on a cross or native host.  This is important: even on a
121.1Snathanw"native" host, you should bootstrap the toolchain by building from an
131.1Snathanwup-to-date source tree to a $DESTDIR using the exact same instructions.
141.1Snathanw
151.1SnathanwIn these notes, MACHINE is the $MACHINE of the target.  These files can be
161.1Snathanwcross-generated.  Though a $MACHINE_ARCH all uses the same config files, you
171.1Snathanwmust pick a specific $MACHINE so that building the requisite bits below will
181.1Snathanwwork.
191.1Snathanw
201.1Snathanw1. Set MKMAINTAINERTOOLS=yes in mk.conf.  (Needed so that src/tools/gettext
211.1Snathanw   gets built, eliciting proper HAVE_*GETTEXT* defns in config.h files.)
221.1Snathanw
231.6Smaya2. Build and install a cross toolchain (via "build.sh -U -m MACHINE tools").
241.1Snathanw
251.6Smaya3. At top level, do "nbmake-MACHINE obj do-distrib-dirs includes".
261.1Snathanw
271.6Smaya4. At top level, do "nbmake-MACHINE -C lib build_install".
281.1Snathanw
291.6Smaya5. In src/tools/gdb, do "nbmake-MACHINE obj native-gdb".
301.1Snathanw
311.1Snathanw   This will do a full configury in ${.OBJDIR}/.native that is a "Canadian"
321.1Snathanw   cross toolchain (--build reflects the host platform, but --host and
331.1Snathanw   --target are the target).  The result is a tree that would build a
341.1Snathanw   native-to-NetBSD GDB on a cross host, and mknative pulls glue data
351.1Snathanw   from this.
361.1Snathanw
371.7Srin   NOTE: this step writes files under src/external/gpl3/gdb/lib, so you
381.4Suwe   need to do it in a writable src tree!
391.4Suwe
401.6Smaya6. Try out a full build using "nbmake-MACHINE" in
411.7Srin   src/external/gpl3/gdb; the result should include a native GDB.
421.1Snathanw
431.6Smaya7. If all is well, commit the glue files and directories added to
441.7Srin   src/external/gpl3/gdb/lib.
45