add an optional deploy-to-dosbox target for msdos cross-compile

The WANT_DEBUG=1 will cause the cross-compile to include line
number information in the NetHack executable, useful for
backtraces and gdb debugging sessions.

How a developer can use the optional deploy-to-dosbox target:
    make CROSS_TO_MSDOS=1 WANT_DEBUG=1 dosbox=/mnt/c/dosbox deploy-to-dosbox

where dosbox= points to the directory which will be mounted for
your drive in dosbox

THe deploy-to-dosbox recipe ensures that a target copy of gdb.exe
ends up alongside nethack.exe at the target, including:
  - placing the source code that gdb requires on the target
    in the nhsrc subfolder.
  - an nhgdb.bat that supplies the right switches to gdb
    for locating the NetHack sources.
This commit is contained in:
nhmall
2024-12-15 10:26:49 -05:00
parent fd7c314e9e
commit 69600c3f38
2 changed files with 79 additions and 0 deletions

View File

@@ -134,6 +134,26 @@ override TARGET_CXX = $(TOOLTOP1)/i586-pc-msdosdjgpp-g++
override TARGET_AR = $(TOOLTOP1)/i586-pc-msdosdjgpp-gcc-ar
override TARGET_STUBEDIT = ../lib/djgpp/i586-pc-msdosdjgpp/bin/stubedit
#
ifdef DOSBOX
dosbox=$(DOSBOX)
endif
ifdef dosbox
dosboxgameid=NH370
dosboxtop=$(dosbox)
dosboxnhfolder=$(dosboxtop)/$(dosboxgameid)
dosboxnhsrc=$(dosboxnhfolder)/NHSRC
dosboxconfigfile=NETHACK.CNF
dosgdburl=http://www.mirrorservice.org/sites/ftp.delorie.com/pub/djgpp/current/v2gnu/gdb801b.zip
ifdef MAKEFILE_SRC
FLDR=../
endif
ifdef MAKEFILE_TOP
FLDR=
endif
WANT_DEBUG=1
DEPLOY=deploytodosbox
endif # dosbox
#
ifeq "$(WANT_DEBUG)" "1"
DBGFLAGS = -g
else