Copyright © NetHack PC Development Team 1990-2002.
NetHack may be freely redistributed. See license for details.
Instructions for compiling and installing
NetHack 3.4 on a DOS system
(or, How to make PC NetHack 3.4)
Last revision: $Date: 2003/06/13 19:57:52 $
Credit for a runnable full PC NetHack 3.4 goes to the PC Development team
of Paul Winner, Kevin Smolkowski, Michael Allison, Yitzhak Sapir, Bill Dyer,
Timo Hakulinen, Yamamoto Keizo, Mike Threepoint, Mike Stephenson,
Stephen White, Ken Washikita and Janet Walz. The present port is based
on the previous effort of Pierre Martineau, Stephen Spackman, Steve Creps, Mike
Threepoint, Mike Stephenson, Norm Meluch and Don Kneller.
There has been very little port-specific maintenance for NetHack on DOS since
I. Dispelling the Myths
II. Compiling on a DOS machine
Appendix A - Building the "official binary"
Appendix B - DJGPP Compiler (gcc ported to msdos) notes
Appendix C - Additional Notes
Appendix D - Contacting Us
I. Dispelling the Myths:
Compiling NetHack is not as easy as it sounds, nor as hard as it looks,
however it will behoove you to read this entire file through before
beginning the task.
We have provided a proper Makefile for building NetHack using the
djgpp V2.03 or later
For specific details concerning the djgpp compiler, please see the
The makefile named Makefile.GCC is for use with GNU Make that
If you want to build a copy of NetHack that is identical to the
"official binary", please see appendix A.
The unsupported sys/msdos/Makefile.MSC was for the old 16 bit
Microsoft Visual C 1.52c compiler and has not been made compliant
You may find it useful to obtain copies of lex (flex) and yacc (bison
or byacc). While not strictly necessary to compile nethack, they are
required should you desire to make any changes to the level and dungeon
compilers. Flex and Bison are included with the DJGPP distribution and
are also available on many archive sites.
Also be sure to pick up djgpp v2gnu/fil41b.zip to get ls.exe and
touch.exe, since the Makefile uses them by default.
II. To compile your copy of NetHack on a DOS machine:
(or "just follow these few 'simple' steps outlined below.")
1. It almost goes without saying that you should make sure that your tools
are set up and running correctly.
2. Make sure all the NetHack files are in the appropriate directory
structure. You should have a main directory with subdirectories
dat, doc, include, src, sys\share, sys\msdos, util, win\tty and
win\share. Other subdirectories may also be included in your
distribution, but they are not necessary for use with DOS. You can
delete them to save space.
Required Source Directories for DOS NetHack:
| | | | | | |
util dat doc include src sys win
| | | |
share msdos tty share
Check the file "Files" in your top level directory for an exact
listing of what files are in which directory. In order for the
Makefiles to work, all the source files must be in the proper
If you downloaded or ftp'd the sources from a UNIX system, the lines
will probably end in UNIX-style newlines, instead of the carriage
return and line feed pairs used by DOS. Some programs have trouble
with them, so you may need to convert them (with a utility like
Rahul Dhesi's "flip").
3. Go to the sys/msdos directory and ensure that the file setup.bat
has MSDOS style end-of-line characters rather than UNIX style
end-of-line characters. You can do that using a utility like
Rahul Dhesi's "flip", or by invoking the MSDOS edit utility on
setup.bat and saving the file without making any changes. Failure to
do this will prevent the bat file from executing completely, yet no
warning message will be given.
Run the setup.bat batch file with the following as the argument:
GCC For djgpp and GNU MAKE.
The appropriate and necessary Makefile movement will be accomplished
for you, as well as verifying a few files and fixing a few file names
on FAT systems with long file name support.
4. Now go to the include subdirectory to check a couple of the header
files there. Things *should* work as they are, but since you have
probably set up your system in some sort of custom configuration
it doesn't hurt to check out the following:
First check config.h according to the comments to match your system and
desired set of features. Mostly you need to check the WIZARD option,
and check TERMLIB and COMPRESS. Also be sure to leave DLB support
commented out in config.h. MSDOS has support for DLB, but it must be
done through the Makefile, rather than config.h, to ensure that the
necessary packaging steps are done.
We've managed to enable all the special features. You may include all
or as few of them as you wish. To conserve disk space, you may wish
to disable LOGFILE and NEWS.
Also check pcconf.h, which should not need much editing (if you are
including random.c, and if you do not require termcap for screen
management). If you are not including random.c you will need to
comment out RANDOM.
If using DJGPP, you can choose between SCREEN_BIOS
and SCREEN_DJGPPFAST. Never, never, ever choose both. Bad things
will happen. We are not kidding.
5. If you want to change the high score list behavior, examine the top of
topten.c, in the src directory. You may want to change the definitions of
PERSMAX, POINTSMIN, and ENTRYMAX. We set POINTSMIN to 51 and ENTRYMAX to
50 to keep the size of the score list down.
6. Go to the src directory and edit the top of your Makefile. Be sure the
directory you want the game installed in (GAMEDIR) actually exists.
7. Now that everything is set up,
Go to the src directory, and using the GNU Make utility,
Depending on your particular machine and compiler, you can either
grab a cup of coffee or go home for the day. Your computer will be
occupied for quite some time. If all goes well, you will get an
9. If you chose DLB support (recommended), make sure that the file nhdat
got copied into the game directory.
If you didn't choose DLB support, make sure the support files --
data, rumors, cmdhelp, opthelp, help, hh,history, guidebook.txt
license, and all the *.lev files -- were copied to the game directory.
If not, move them there from the dat directory yourself. rumors can
be created manually be entering "makedefs -r", data by entering
Make sure the files NetHack1.tib and NetHacko.tib made it to your game
directory. Copy them from src to the game directory yourself if
Make sure the files defaults.nh and termcap made it to your game
directory. If not, go to sys\share and copy NetHack.cnf to
your game directory as defaults.nh. The name in previous versions was
nethack.cnf, but the CNF extension conflicted with the MS Windows
speed-dialer, making the file hidden on many machines.
If you changed your build settings to include TERMCAP support, copy
termcap to your game directory.
Also, make sure the file msdoshlp.txt made it to your game directory.
If it didn't, move it from sys\msdos to your game directory
10. In your game directory, review the settings in defaults.nh and adjust
them according to your style of play.
11. Play NetHack. If it works, you're done!
Appendix A - Building the "official binary"
If you wish to build a copy of NetHack identical to the one that
the pc team distributes, simply do the following:
The 32-bit Protected Mode DPMI version built with 32-bit djgpp
compiler V2.03 or greater, make no changes to any of the defines and use
the Makefile.GCC as distributed, and as moved in step 3.
Paths below are relative to the top of your unpacked
NetHack source distribution:
md \nethack\binary (must match Makefile)
Make sure the following files have been converted from the
unix style "^J" end of line, to the msdos style "^M^J":
Place all the files in a clean directory and test.
Appendix B - DJGPP Compiler (gcc ported to msdos)
If you have a 386 or better machine, you are in luck. You can compile
NetHack without spending money on a compiler. DJGPP is available free
from many archive sites.
At the time of this release in April 2002, the URL http://www.delorie.com/djgpp/zip-picker.html/
had information on how to obtain djgpp and what pieces to get.
Be sure to pick up djgpp v2gnu/fil41b.zip to get ls.exe and
touch.exe, since the Makefile uses them by default (or change
the Makefile to use alternatives).
Special note for Windows 2000 / Windows XP users: You must have a
recent djgpp distribution for the build process, and the generated
executables to work properly on those platforms.
Setting up DJGPP is more than adequately explained in the documentation
that comes with it. Be sure to pick up the yacc and flex built with
DJGPP if you intend to do any modification of the special levels or
dungeon compilers. They should be available at the same place you got
The latest version of djgpp, V2.03 with the most recent refresh
will produce a binary that will run under Microsoft Windows, or any
other DPMI provider. djgpp also comes with a DPMI provider called CWSDPMI.
Place CWSDPMI.EXE in your path and it will be used in the absence of any
other DPMI provider.
If you want to use the built-in DJGPP screen routines, uncomment
SCREEN_DJGPPFAST in pcconf.h (the default for djgpp).
Appendix C - Additional Notes
1) Save files and bones files from versions of NetHack prior to 3.4.0 will not
work with this NetHack. Don't bother trying to keep them.
2) To install an update of NetHack after changing something, type 'make'
for DJGPP from the src directory. If you add, delete, or reorder monsters or
objects, or you change the format of saved level files, delete any save
and bones files. (Trying to use such files sometimes produces amusing
confusions on the game's part, but usually crashes.)
Appendix D - Contacting the Development Team
If you discover a bug and wish to report it, or if you have comments
or suggestions we recommend using
our "Contact Us" web page at: http://www.nethack.org/common/contact.html
If you don't have access to the web, or you want to send us a patch
to the NetHack source code feel free to drop us a line c/o:
DevTeam (at) nethack.org
nethack-3.4.3/sys/msdos/Makefile.BC 0100644 0000000 0000000 00000177310 07764735041 015551 0 ustar root root # SCCS Id: @(#)Makefile.BC 3.4 2002/03/17
# Copyright © Yitzhak Sapir, 1999-2002.
# NetHack may be freely distributed. See license for details.
# PC NetHack 3.4 Makefile for Borland C++ 3.1 and 4.5.
# Nota Bene: Before you get to here you should have already read
# the Install.dos file located in the sys/msdos directory.
# Additionally, you should run this makefile with the -N
# Microsoft Compatibility option.
# This Makefile is for use with Borland C++ version 3.1 and 4.5, but might
# also work with more up to date versions.
# This Makefile is specific to Borland's MAKE which is supplied with the
# compiler. It supports only one overlay management facility - VROOMM.
# (This Makefile won't work with make45l or NDMAKE)