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:
@@ -79,6 +79,65 @@ $(LUABIN):
|
|||||||
dodata:
|
dodata:
|
||||||
( cd .. && make dlb && cd src)
|
( cd .. && make dlb && cd src)
|
||||||
|
|
||||||
|
ifdef dosbox
|
||||||
|
# make CROSS_TO_MSDOS=1 dosbox=~/dosbox deploy-to-dosbox
|
||||||
|
ifdef MAKEFILE_TOP
|
||||||
|
deploy-to-dosbox:
|
||||||
|
( cd src; make $(DEPLOY); cd .. )
|
||||||
|
endif
|
||||||
|
.PHONY: deploytodosbox
|
||||||
|
|
||||||
|
deploytodosbox: ../targets/msdos/NH370DOS.ZIP $(dosboxnhfolder) $(dosboxnhsrc) \
|
||||||
|
$(dosboxnhsrc)/src $(dosboxnhsrc)/include \
|
||||||
|
$(dosboxnhsrc)/sys/msdos $(dosboxnhsrc)/sys/share \
|
||||||
|
$(dosboxnhsrc)/win/share $(dosboxnhsrc)/win/curses \
|
||||||
|
$(dosboxnhsrc)/win/tty $(dosboxnhsrc)/util \
|
||||||
|
$(dosboxnhfolder)/NETHACK.EXE \
|
||||||
|
$(dosboxnhfolder)/GDB.EXE $(dosboxnhfolder)/nhgdb.bat
|
||||||
|
@echo DOS NetHack deployed to dosbox at $(dosboxnhfolder)
|
||||||
|
|
||||||
|
$(dosboxnhfolder):
|
||||||
|
mkdir -p $@
|
||||||
|
$(dosboxnhsrc): $(dosboxnhfolder)
|
||||||
|
mkdir -p $@
|
||||||
|
$(dosboxnhsrc)/src: $(dosboxnhsrc)
|
||||||
|
mkdir -p $@
|
||||||
|
cp --preserve=timestamps $(FLDR)src/*.c $(dosboxnhsrc)/src
|
||||||
|
$(dosboxnhsrc)/include: $(dosboxnhsrc)
|
||||||
|
mkdir -p $@
|
||||||
|
cp --preserve=timestamps $(FLDR)include/*.h $(dosboxnhsrc)/include
|
||||||
|
$(dosboxnhsrc)/sys/msdos: $(dosboxnhsrc)
|
||||||
|
mkdir -p $@
|
||||||
|
cp --preserve=timestamps $(FLDR)sys/msdos/*.c $(dosboxnhsrc)/sys/msdos
|
||||||
|
cp --preserve=timestamps $(FLDR)sys/msdos/*.h $(dosboxnhsrc)/sys/msdos
|
||||||
|
$(dosboxnhsrc)/sys/share: $(dosboxnhsrc)
|
||||||
|
mkdir -p $@
|
||||||
|
cp --preserve=timestamps $(FLDR)sys/share/*.c $(dosboxnhsrc)/sys/share
|
||||||
|
$(dosboxnhsrc)/win/share: $(dosboxnhsrc)
|
||||||
|
mkdir -p $@
|
||||||
|
cp --preserve=timestamps $(FLDR)win/share/*.c $(dosboxnhsrc)/win/share
|
||||||
|
$(dosboxnhsrc)/win/curses: $(dosboxnhsrc)
|
||||||
|
mkdir -p $@
|
||||||
|
cp --preserve=timestamps $(FLDR)win/curses/*.c $(dosboxnhsrc)/win/curses
|
||||||
|
cp --preserve=timestamps $(FLDR)win/curses/*.h $(dosboxnhsrc)/win/curses
|
||||||
|
$(dosboxnhsrc)/win/tty: $(dosboxnhsrc)
|
||||||
|
mkdir -p $@
|
||||||
|
cp --preserve=timestamps $(FLDR)win/tty/*.c $(dosboxnhsrc)/win/tty
|
||||||
|
$(dosboxnhsrc)/util: $(dosboxnhsrc)
|
||||||
|
mkdir -p $@
|
||||||
|
cp --preserve=timestamps $(FLDR)util/*.c $(dosboxnhsrc)/util
|
||||||
|
cp --preserve=timestamps $(FLDR)util/*.h $(dosboxnhsrc)/util
|
||||||
|
$(dosboxnhfolder)/NETHACK.EXE: $(TARGETPFX)NH370DOS.ZIP
|
||||||
|
unzip -o $(TARGETPFX)NH370DOS.ZIP -d $(dosboxnhfolder)
|
||||||
|
find $(dosboxnhfolder) -type f -name "$(dosboxconfigfile)" \
|
||||||
|
| xargs sed -i 's/#OPTIONS=video:autodetect/OPTIONS=video:autodetect/g'
|
||||||
|
$(dosboxnhfolder)/GDB.EXE: $(dosboxnhfolder)
|
||||||
|
curl --output gdb801b.zip $(dosgdburl)
|
||||||
|
unzip -p gdb801b.zip bin/gdb.exe >$@
|
||||||
|
rm gdb801b.zip
|
||||||
|
$(dosboxnhfolder)/nhgdb.bat: $(FLDR)src/Makefile
|
||||||
|
echo "gdb -ex 'directory nhsrc/src nhsrc/include nhsrc/sys/msdos nhsrc/sys/share nhsrc/win/share nhsrc/win/curses nhsrc/win/tty nhsrc/util' NETHACK.EXE"> $@
|
||||||
|
endif # dosbox
|
||||||
endif # CROSS_TO_MSDOS
|
endif # CROSS_TO_MSDOS
|
||||||
|
|
||||||
ifdef CROSS_TO_WASM
|
ifdef CROSS_TO_WASM
|
||||||
|
|||||||
@@ -134,6 +134,26 @@ override TARGET_CXX = $(TOOLTOP1)/i586-pc-msdosdjgpp-g++
|
|||||||
override TARGET_AR = $(TOOLTOP1)/i586-pc-msdosdjgpp-gcc-ar
|
override TARGET_AR = $(TOOLTOP1)/i586-pc-msdosdjgpp-gcc-ar
|
||||||
override TARGET_STUBEDIT = ../lib/djgpp/i586-pc-msdosdjgpp/bin/stubedit
|
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"
|
ifeq "$(WANT_DEBUG)" "1"
|
||||||
DBGFLAGS = -g
|
DBGFLAGS = -g
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user