#	SCCS Id: @(#)Makefile.os2	3.4.3	1996/10/29
#	OS/2 NetHack 3.4.3 Makefile for OS/2 versions 2.x
#	Copyright (C) 1990, 1991, 1992, 1993, 1996 Timo Hakulinen
#
#	Several compilers exist for OS/2 but, currently only GCC emx is tested
#	and used for releases.  make programs other than dmake are not tested.
#
#	Supported compilers: GCC emx 0.9g
#
#	DMAKE is required.  Credit for the makefile improvements goes to 
#	Pekka Rousu.
#
#	Copy this file into $(SRC) directory, rename it to "makefile"
#	(important, many targets rely on it), compile and link inside
#	$(SRC).  If required, termcap library can be built from termcap
#	sources using makefile.lib in "sys\share" directory.
#
#	"GCC" refers to GCC emx only.  No other ports of GCC are supported.
#	Additional credits for honing GCC support for 3.2 go to Ronald
#	Van Iwaarden (ron@vaniwaarden.org) and Stefan Neis (neis@cs.uni-sb.de).
#
#	"OMF" is short for "Object Module Format" and refers to the
#	standard OS/2 object format, which e.g. link386 uses.  MSC and
#	CSet/2 always produce OMF object files, and GCC can be instructed
#	to produce them with proper switches (see below).
#
#	"a.out" refers to Unix object file format, which is used by GCC
#	in its default compilation mode.  These object files must be
#	linked using GCC's own linker to produce a proper OS/2 executable.
#	GDB debugger shipped with GCC can only be used with a.out object
#	format.
#
#	Note that the default setup in this makefile is my personal setup,
#	which you will have to adapt to your configuration.
#

#
#	Compiler and linker selection.
#

#format        = omf
format = a.out

.IF $(format) == a.out
with_x11 = yes
#debug = yes
.END


CC	= gcc		# GCC

.IF $(format) == a.out
LINK    = gcc
#LINK  = link386       # GCC OMF, CSet/2
.ELSE
LINK   = link386       # GCC OMF, CSet/2
LFLAGS = /noig /stack:40000
.END

.IF $(with_x11) == yes
WINX11OBJ01 = $(OBJ)/Window.o
WINX11OBJ02 = $(OBJ)/dialogs.o
WINX11OBJ03 = $(OBJ)/winX.o
WINX11OBJ04 = $(OBJ)/winmap.o
WINX11OBJ05 = $(OBJ)/winmenu.o
WINX11OBJ06 = $(OBJ)/winmesg.o
WINX11OBJ07 = $(OBJ)/winmisc.o
WINX11OBJ08 = $(OBJ)/winstat.o
WINX11OBJ09 = $(OBJ)/wintext.o
WINX11OBJ10 = $(OBJ)/winval.o
WINX11OBJ11 = $(OBJ)/tile.o
X11ROOT = e:/xfree86
WINX11CFLAGS = -DUSE_XPM -DX11_GRAPHICS \
            -I$(X11ROOT)/include -Zmtd
WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 -lXpm -L$(X11ROOT)/lib -lc_app
WINX11SRC = ../win/X11/Window.c ../win/X11/dialogs.c ../win/X11/winX.c \
       ../win/X11/winmap.c  ../win/X11/winmenu.c ../win/X11/winmesg.c \
       ../win/X11/winmisc.c ../win/X11/winstat.c ../win/X11/wintext.c \
       ../win/X11/winval.c tile.c
WINX11OBJ = $(WINX11OBJ01) $(WINX11OBJ02) $(WINX11OBJ03) $(WINX11OBJ04) \
       $(WINX11OBJ05) $(WINX11OBJ06) $(WINX11OBJ07) $(WINX11OBJ08) \
       $(WINX11OBJ09) $(WINX11OBJ10) $(WINX11OBJ11)
WINX11VARDAT=x11tiles pet_mark.xbm rip.xpm
X11ECHO        = $(CMD) @echo
.END




MAKEB	= dmake
CMD	= cmd /C
AB	= $(@:B).c
CB	= $$(@:B).c
BEG	= $(CMD) "
END	= "
SEP	= &
P	= %

#
#	Most makes execute actions automatically inside a subshell,
#	which makes even the shell internals work ok.
#

ECHO	= $(CMD) @echo
RM	= $(CMD) del
CP	= $(CMD) copy
CAT	= $(CMD) type

#
#	For those of us who have these on PC.
#

#YACC	= yacc
#LEX	= lex
YACC	= bison -y
LEX	= flex

#
#	For extracting NetHack icon.
#

UUDECODE = uudecode

#
#	For people with TeX and LaTeX.
#

LATEX	= latex

#
#	If you have TOUCH, some things become slightly easier.
#

TOUCH	= touch

#
#	Standard file naming for LEX and YACC output may vary in PC
#	installations.  These three are probably the most generally used
#	names.
#

YTABC	= y_tab.c
YTABH	= y_tab.h
LEXYYC	= lexyy.c

#
#	Source tree base directory.
#

NHSRC	= \nethack

#
#	Source directories.  Makedefs hardcodes these, don't change them.
#

INCL	= $(NHSRC)\include	# NetHack include files
DAT	= $(NHSRC)\dat		# NetHack data files
DOC	= $(NHSRC)\doc		# NetHack documentation files
UTIL	= $(NHSRC)\util		# Utility source
SRC	= $(NHSRC)\src		# Main source
WIN	= $(NHSRC)\win\tty	# Window system specific source
WINX11	= $(NHSRC)\win\x11	# Window system specific source
SYS	= $(NHSRC)\sys\os2	# System specific source
SSYS	= $(NHSRC)\sys\share	# Shared system files
WINSHARE= $(NHSRC)\win\share	# Shared system files

#
#	Modifiable directories.  Set these according to your setup and
#	preferences.  They must all be present prior to compilation.
#	OBJ, TEMP and GAMEDIR should all preferably be separate and,
#	in particular, not the same as any of the source directories.
#	Note that DMAKE may dislike drive designators in paths because
#	it misinterprets the colon as being part of a make rule.  In that
#	case, all directories have to reside on the same drive.
#

OBJ	= \tmp\obj		# Object files
TEMP	= \tmp\bin		# Temporary files during make process
GAMEDIR = \games\nh343x11	# Game directory
PLIBP	= c:\emx\lib		# Protected mode C libraries
RLIBP	= c:\emx\lib		# Possible real mode C libraries

#
#	The game name and description.
#

GAME	= nethack
GAMEDES = "NetHack 3.4.3"

#
#	The uppermost two lines for MSC, the middle two for GCC, and
#	the lowermost two for CSet/2.
#
#	GCC: compile only, compiler id, object format selection, warnings,
#	include file path, debug flags, ANSI conformance.
#

CFLAGS	= -c $(GCCO) $(WARN) -I$(INCL) $(CDFLAGS) $(STDC) $(WINX11CFLAGS)
#OPT	= -s -O -o
OPT	= -o

#
#	Compiler warning levels.  These are really for development, so
#	they are commented out in general distribution to save the user
#	from masses of benign warnings.  If any problems arise, however,
#	they may help in finding the trouble.
#
#	GCC: max. reasonable GCC warning levels.  Can't use -Wall, because then
#	it would whine about all the zillions of unused declarations etc.
#	Even with these switches you'll get a lot of warnings, but they should
#	all be benign.
#

WARN	= #-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN # GCC

#
#	GCC object format selection.  The upper line for standard OS/2 OMF
#	object format, the lower for Unix style a.out format.
#

.IF $(format) == omf
GCCO   = -Zomf -Zsys
.ELSE
GCCO   =
.END

#
#	MSC 5.1 needs the large model first pass of the compiler.
#	Not needed for later versions.
#

BIGC	=

#
#	Unset CL to avoid troubles with conflicting switches in MSC 6.0.
#

CL	=

#
#	Prepare for a debugger.
#

.IF $(debug) == yes
CDFLAGS =
LDFLAGS =
.ELSE
CDFLAGS = -O -s
LDFLAGS = -s
.END

#
#	How to produce the most ANSI-like environment.
#

STDC	= -ansi		# GCC

#
#	Possible system object files required during linking.
#

.IF $(format) == omf
SYSOBJ = $(PLIBP)\crt0.obj     $(PLIBP)\end.lib# GCC OMF
.ELSE
SYSOBJ	=			# MSC, GCC a.out, CSet/2
.END

#
#	Compiler library selection.  Change if necessary.
#
#	GCC emx 0.9 OMF: C single-threaded libs, Unix system call alias lib,
#	extra GCC lib, single threaded system lib, OS/2 API entry points.
#	Note that emx changed library naming convention between 0.8 and 0.9.
#
#	GCC a.out: extra GCC lib, C standard lib, extra GCC lib (again),
#	OS/2 API entry points.
#

.IF $(format) == omf
PLIBS  = $(PLIBP)\st\c $(PLIBP)\st\c_app $(PLIBP)\c_alias $(PLIBP)\gcc $(PLIBP)\st\sys $(PLIBP)\os2    # GCC emx 0.9 OMF
.ELSE
PLIBS  = -lgcc -lc -lgcc -los2 $(X11LIBS)      # GCC a.out
.END

#
#	C libraries used by makedefs, lev_comp and dgn_comp (change if
#	necessary).  If compilation is done in DOS, enable the upper line
#	possibly setting the library name to something else, if in OS/2,
#	enable the lower line (protected mode libraries).
#

#RLIBS	= $(RLIBP)\llibcer
RLIBS	= $(PLIBS)

SRCCC	= $(CC) $(CFLAGS) $(OPT) $@ $(AB)
UTILCC	= $(BEG) cd $(UTIL) $(SEP) $(CC) $(CFLAGS) $(OPT) $@ $(AB) $(END)
SYSCC	= $(BEG) cd $(SYS) $(SEP) $(CC) $(CFLAGS) $(OPT) $@ $(AB) $(END)
SSYSCC	= $(BEG) cd $(SSYS) $(SEP) $(CC) $(CFLAGS) $(OPT) $@ $(AB) $(END)
PSYSCC	= $(BEG) cd $(SSYS) $(SEP) $(CC) $(CFLAGS) $(OPT) $@ pc$(AB) $(END)
WINCC	= $(BEG) cd $(WIN) $(SEP) $(CC) $(CFLAGS) $(OPT) $@ $(AB) $(END)

#
#	Default linker skeletons.  The upper six lines for everything
#	that uses standard OS/2 object format (GCC OMF),  The lower six
#	for GCC a.out format.
#

.IF $(format) == omf
GAMELN = $(LINK) @$(TEMP)\$(GAME).rsp
MKDFLN = $(LINK) @$(TEMP)\makedefs.rsp
LEVCLN = $(LINK) @$(TEMP)\lev_comp.rsp
DGNCLN = $(LINK) @$(TEMP)\dgn_comp.rsp
RCVRLN = $(LINK) @$(TEMP)\recover.rsp
DLBRLN = $(LINK) @$(TEMP)\dlb.rsp
.ELSE
GAMELN = $(CC) $(LDFLAGS) -o $(GAMEDIR)\$(GAME).exe @$(TEMP)\$(GAME).r $(PLIBS) $(WINX11CFLAGS) $(WINX11LIB)
MKDFLN	= $(CC) $(LDFLAGS) -o $(TEMP)\makedefs.exe $(TEMP)\$(MKDFDEF) $(SYSOBJ) $(MAKEOBJS) $(PLIBS)
LEVCLN	= $(CC) $(LDFLAGS) -o $(TEMP)\lev_comp.exe $(TEMP)\$(LEVCDEF) $(SYSOBJ) $(SPLEVOBJS) $(PLIBS)
DGNCLN	= $(CC) $(LDFLAGS) -o $(TEMP)\dgn_comp.exe $(TEMP)\$(DGNCDEF) $(SYSOBJ) $(DGNCOMPOBJS) $(PLIBS)
RCVRLN	= $(CC) $(LDFLAGS) -o $(GAMEDIR)\recover.exe $(TEMP)\$(RCVRDEF) $(SYSOBJ) $(RECOVOBJS) $(PLIBS)
 DLBRLN = $(CC) $(LDFLAGS) -o $(TEMP)\dlb.exe $(TEMP)\$(DLBDEF) $(SYSOBJ) $(DLBOBJS) $(PLIBS)
.END

#
#	OS/2 module definition files for NetHack,
#	makedefs, dgn_comp, lev_comp, recover, dlb.
#

GAMEDEF	= $(GAME).def
MKDFDEF	= makedefs.def
LEVCDEF	= lev_comp.def
DGNCDEF	= dgn_comp.def
RCVRDEF	= recover.def
DLBDEF	= dlb.def

#
#	For compilation in DOS, enable the lower three lines and
#	disable the upper three.
#

MKDFMD	= $(TEMP)\$(MKDFDEF)
LEVCMD	= $(TEMP)\$(LEVCDEF)
DGNCMD	= $(TEMP)\$(DGNCDEF)
#MKDFMD	=
#LEVCMD	=
#DGNCMD	=

#
#	Optional high-quality BSD random number generation routines
#	(see os2conf.h).  Set to nothing if not used.
#

RANDOM	= $(OBJ)\random.o
#RANDOM	=

#
#	If TERMLIB is defined in os2conf.h, comment out the upper line and
#	uncomment the lower.  If the termcap-library doesn't exist, use
#	sys\share\makefile.lib to build it.
#

TERMLIB =
#TERMLIB = termlib.lib

#
#	Short / long file name selection for FAT and HPFS.
#	Only three files need consideration.
#

#GUIDEBOO = Guideboo	# FAT
#PATCHLEV = patchlev	# - " -
#DATABASE = data.bas	# - " -
GUIDEBOO = Guidebook	# HPFS
PATCHLEV = patchlevel	# - " -
DATABASE = data.base	# - " -


#
#	If you have LaTeX and want to create the NetHack Guidebook in TeX
#	device-independent file format, comment out the upper line and
#	uncomment the lower.
#

GUIDE	=
#GUIDE	= $(TEMP)\$(GUIDEBOO).dvi

#
#	Set WINOBJ lines corresponding to your desired combination
#	of windowing systems.  Also set windowing systems in config.h.
#
#	A straight tty port using no native windowing system is the
#	only choice for now.
#

WINOBJ1 = $(OBJ)\getline.o
WINOBJ2 = $(OBJ)\termcap.o
WINOBJ3 = $(OBJ)\topl.o
WINOBJ4 = $(OBJ)\wintty.o
WINOBJ = $(WINOBJ1) $(WINOBJ2) $(WINOBJ3) $(WINOBJ4) $(WINX11OBJ)

#
#	The default make target, so just typing 'make' is useful.
#	Has to be the first target in the makefile.
#

default : all

#
#	If you have yacc and lex programs and make any changes, uncomment
#	the lowermost two lines and comment out the others.  If you make
#	changes to the .y and .l files but prefer processing the files
#	separately elsewhere, activate the middle two lines, so your changes
#	don't get overwritten.
#

do_yacc : yacc_cpy	# use pre-generated files
do_lex :  lex_cpy	#	- " -
#do_yacc : yacc_msg	# show message if changed
#do_lex :  lex_msg	#	- " -
#do_yacc : yacc_act	# re-process files
#do_lex :  lex_act	#	- " -

#
#	If you have the TOUCH utility the upper line is ok.  Otherwise
#	the lower one does the same albeit in an ugly manner.  Besides,
#	the latter method only works for text files.
#

#do_touch : realtouch
do_touch : faketouch

#
#	If you don't have uudecode program, use the upper line.
#	If you still want the icon, you'll have to extract the
#	file manually somewhere else.
#

do_icon : icon_msg	# show message if changed
#do_icon : icon_act	# extract icon file

#
#	If you don't want to generate nethack.cmd, use the upper line.
#	This could be the case, e.g., if you use a different shell than
#	the standard cmd.exe.
#

#do_cmd : cmd_msg	# show message
do_cmd : cmd_act	# generate nethack.cmd

#
#	If you want to try the data librarian scheme to reduce
#	the amount of data files in the NetHack home directory, comment
#	out the lower line and uncomment the upper.  Also, make sure
#	that DLB is defined in config.h.
#

do_dlb : dlb_yup
#do_dlb : dlb_nope

######################################################################
#
#	Nothing below this line should have to be changed.
#
#	Other things that have to be reconfigured are in
#	config.h, os2conf.h and possibly system.h.
#

#
#	The game filename.
#

GAMEFILE = $(GAMEDIR)\$(GAME).exe

#
#	Object files for makedefs.
#

MAKEOBJS = $(OBJ)\makedefs.o $(OBJ)\monst.o $(OBJ)\objects.o

#
#	Object files for special levels compiler.
#

SOBJ01	= $(OBJ)\lev_yacc.o $(OBJ)\lev_lex.o $(OBJ)\lev_main.o $(OBJ)\alloc.o
SOBJ02	= $(OBJ)\monst.o $(OBJ)\objects.o $(OBJ)\panic.o $(OBJ)\decl.o
SOBJ03	= $(OBJ)\drawing.o

SPLEVOBJS = $(SOBJ01) $(SOBJ02) $(SOBJ03)

#
#	Object files for dungeon compiler.
#

DOBJ01	= $(OBJ)\dgn_yacc.o $(OBJ)\dgn_lex.o $(OBJ)\dgn_main.o
DOBJ02	= $(OBJ)\panic.o $(OBJ)\alloc.o

DGNCOMPOBJS = $(DOBJ01) $(DOBJ02)

#
#	Object files for recovery utility.
#

RECOVOBJS = $(OBJ)\recover.o

#
#	Object files for dlb.
#

DLBOBJS = $(OBJ)\dlb_main.o $(OBJ)\dlb.o $(OBJ)\alloc.o $(OBJ)\panic.o

#
#	Data files for dlb.
#

DATHELP = \
 help hh cmdhelp history opthelp wizhelp

SPEC_LEVS = \
 asmodeus.lev baalz.lev    bigrm-1.lev \
 bigrm-2.lev  bigrm-3.lev  bigrm-4.lev castle.lev   fakewiz1.lev fakewiz2.lev \
 juiblex.lev  knox.lev     medusa-1.lev medusa-2.lev minend-1.lev minend-2.lev \
 minend-3.lev minefill.lev minetn-1.lev minetn-2.lev minetn-3.lev minetn-4.lev \
 minetn-5.lev minetn-6.lev minetn-7.lev oracle.lev   orcus.lev    sanctum.lev \
 tower1.lev   tower2.lev   tower3.lev valley.lev   wizard1.lev  wizard2.lev \
 wizard3.lev  astral.lev   air.lev earth.lev    fire.lev     water.lev \
 soko1-1.lev  soko1-2.lev  soko2-1.lev  soko2-2.lev  \
 soko3-1.lev  soko3-2.lev  soko4-1.lev  soko4-2.lev

QUEST_LEVS = \
 Arc-goal.lev Arc-fila.lev Arc-filb.lev Arc-loca.lev Arc-strt.lev \
 Bar-goal.lev Bar-fila.lev Bar-filb.lev Bar-loca.lev Bar-strt.lev \
 Cav-goal.lev Cav-fila.lev Cav-filb.lev Cav-loca.lev Cav-strt.lev \
 Hea-goal.lev Hea-fila.lev Hea-filb.lev Hea-loca.lev Hea-strt.lev \
 Kni-goal.lev Kni-fila.lev Kni-filb.lev Kni-loca.lev Kni-strt.lev \
 Mon-goal.lev Mon-fila.lev Mon-filb.lev Mon-loca.lev Mon-strt.lev \
 Pri-goal.lev Pri-fila.lev Pri-filb.lev Pri-loca.lev Pri-strt.lev \
 Ran-goal.lev Ran-fila.lev Ran-filb.lev Ran-loca.lev Ran-strt.lev \
 Rog-goal.lev Rog-fila.lev Rog-filb.lev Rog-loca.lev Rog-strt.lev \
 Sam-goal.lev Sam-fila.lev Sam-filb.lev Sam-loca.lev Sam-strt.lev \
 Tou-goal.lev Tou-fila.lev Tou-filb.lev Tou-loca.lev Tou-strt.lev \
 Val-goal.lev Val-fila.lev Val-filb.lev Val-loca.lev Val-strt.lev \
 Wiz-goal.lev Wiz-fila.lev Wiz-filb.lev Wiz-loca.lev Wiz-strt.lev
VARDATD = \
 data oracles options quest.dat rumors $(WINX11VARDAT)

DATDLB = $(DATHELP) dungeon $(SPEC_LEVS) $(QUEST_LEVS) $(VARDATD) \
	 $(do_dlb)

#
#	Object files for the game itself.
#

VOBJ011 = $(OBJ)\allmain.o
VOBJ012 = $(OBJ)\alloc.o
VOBJ013 = $(OBJ)\apply.o
VOBJ014 = $(OBJ)\artifact.o
VOBJ021 = $(OBJ)\attrib.o 
VOBJ022 = $(OBJ)\ball.o
VOBJ023 = $(OBJ)\bones.o
VOBJ024 = $(OBJ)\botl.o
VOBJ031 = $(OBJ)\cmd.o
VOBJ032 = $(OBJ)\dbridge.o
VOBJ033 = $(OBJ)\decl.o
VOBJ034 = $(OBJ)\detect.o
VOBJ041 = $(OBJ)\dig.o
VOBJ042 = $(OBJ)\display.o
VOBJ043 = $(OBJ)\dlb.o
VOBJ044 = $(OBJ)\do.o
VOBJ051 = $(OBJ)\do_name.o
VOBJ052 = $(OBJ)\do_wear.o
VOBJ053 = $(OBJ)\dog.o
VOBJ054 = $(OBJ)\dogmove.o
VOBJ061 = $(OBJ)\dokick.o
VOBJ062 = $(OBJ)\dothrow.o
VOBJ063 = $(OBJ)\drawing.o
VOBJ064 = $(OBJ)\dungeon.o
VOBJ071 = $(OBJ)\eat.o
VOBJ072 = $(OBJ)\end.o
VOBJ073 = $(OBJ)\engrave.o
VOBJ074 = $(OBJ)\exper.o
VOBJ071 = $(OBJ)\eat.o
VOBJ072 = $(OBJ)\end.o
VOBJ073 = $(OBJ)\engrave.o
VOBJ074 = $(OBJ)\exper.o
VOBJ081 = $(OBJ)\explode.o
VOBJ082 = $(OBJ)\extralev.o
VOBJ083 = $(OBJ)\files.o
VOBJ084 = $(OBJ)\fountain.o
VOBJ091 = $(OBJ)\hack.o
VOBJ092 = $(OBJ)\hacklib.o
VOBJ093 = $(OBJ)\invent.o
VOBJ094 = $(OBJ)\light.o
VOBJ101 = $(OBJ)\lock.o
VOBJ102 = $(OBJ)\mail.o
VOBJ103 = $(OBJ)\main.o
VOBJ104 = $(OBJ)\makemon.o
VOBJ111 = $(OBJ)\mapglyph.o
VOBJ112 = $(OBJ)\mcastu.o
VOBJ113 = $(OBJ)\mhitm.o
VOBJ114 = $(OBJ)\mhitu.o
VOBJ115 = $(OBJ)\minion.o
VOBJ121 = $(OBJ)\mklev.o
VOBJ122 = $(OBJ)\mkmap.o
VOBJ123 = $(OBJ)\mkmaze.o
VOBJ124 = $(OBJ)\mkobj.o
VOBJ131 = $(OBJ)\mkroom.o
VOBJ132 = $(OBJ)\mon.o
VOBJ133 = $(OBJ)\mondata.o
VOBJ134 = $(OBJ)\monmove.o
VOBJ141 = $(OBJ)\monst.o
VOBJ142 = $(OBJ)\monstr.o
VOBJ143 = $(OBJ)\mplayer.o
VOBJ144 = $(OBJ)\mthrowu.o
VOBJ151 = $(OBJ)\muse.o
VOBJ152 = $(OBJ)\music.o
VOBJ153 = $(OBJ)\o_init.o
VOBJ154 = $(OBJ)\objects.o
VOBJ161 = $(OBJ)\objnam.o
VOBJ162 = $(OBJ)\options.o
VOBJ163 = $(OBJ)\os2.o
VOBJ164 = $(OBJ)\pager.o
VOBJ171 = $(OBJ)\pcsys.o
VOBJ172 = $(OBJ)\pickup.o
VOBJ173 = $(OBJ)\pline.o
VOBJ174 = $(OBJ)\polyself.o
VOBJ181 = $(OBJ)\potion.o
VOBJ182 = $(OBJ)\pray.o
VOBJ183 = $(OBJ)\priest.o
VOBJ184 = $(OBJ)\quest.o
VOBJ191 = $(OBJ)\questpgr.o
VOBJ192 = $(OBJ)\read.o
VOBJ193 = $(OBJ)\rect.o
VOBJ194 = $(OBJ)\region.o
VOBJ195 = $(OBJ)\restore.o
VOBJ201 = $(OBJ)\rip.o
VOBJ202 = $(OBJ)\rnd.o
VOBJ203 = $(OBJ)\rumors.o
VOBJ204 = $(OBJ)\save.o
VOBJ211 = $(OBJ)\shk.o
VOBJ212 = $(OBJ)\shknam.o
VOBJ213 = $(OBJ)\sit.o
VOBJ214 = $(OBJ)\sounds.o
VOBJ221 = $(OBJ)\sp_lev.o
VOBJ222 = $(OBJ)\spell.o
VOBJ223 = $(OBJ)\steal.o
VOBJ224 = $(OBJ)\teleport.o
VOBJ231 = $(OBJ)\timeout.o
VOBJ232 = $(OBJ)\topten.o
VOBJ233 = $(OBJ)\track.o
VOBJ234 = $(OBJ)\trap.o
VOBJ241 = $(OBJ)\tty.o
VOBJ242 = $(OBJ)\u_init.o
VOBJ243 = $(OBJ)\uhitm.o
VOBJ244 = $(OBJ)\unix.o
VOBJ251 = $(OBJ)\vault.o
VOBJ252 = $(OBJ)\vision.o
VOBJ253 = $(OBJ)\vis_tab.o
VOBJ254 = $(OBJ)\weapon.o
VOBJ261 = $(OBJ)\were.o
VOBJ262 = $(OBJ)\wield.o
VOBJ263 = $(OBJ)\windows.o
VOBJ264 = $(OBJ)\wizard.o
VOBJ271 = $(OBJ)\worm.o
VOBJ272 = $(OBJ)\worn.o
VOBJ273 = $(OBJ)\write.o
VOBJ274 = $(OBJ)\zap.o
VOBJ281 = $(OBJ)\role.o
VOBJ282 = $(OBJ)\steed.o

VOBJ01 = $(VOBJ011) $(VOBJ012) $(VOBJ013) $(VOBJ014)
VOBJ02 = $(VOBJ021) $(VOBJ022) $(VOBJ023) $(VOBJ024)
VOBJ03 = $(VOBJ031) $(VOBJ032) $(VOBJ033) $(VOBJ034)
VOBJ04 = $(VOBJ041) $(VOBJ042) $(VOBJ043) $(VOBJ044)
VOBJ05 = $(VOBJ051) $(VOBJ052) $(VOBJ053) $(VOBJ054)
VOBJ06 = $(VOBJ061) $(VOBJ062) $(VOBJ063) $(VOBJ064)
VOBJ07 = $(VOBJ071) $(VOBJ072) $(VOBJ073) $(VOBJ074)
VOBJ08 = $(VOBJ081) $(VOBJ082) $(VOBJ083) $(VOBJ084)
VOBJ09 = $(VOBJ091) $(VOBJ092) $(VOBJ093) $(VOBJ094)
VOBJ10 = $(VOBJ101) $(VOBJ102) $(VOBJ103) $(VOBJ104)
VOBJ11 = $(VOBJ111) $(VOBJ112) $(VOBJ113) $(VOBJ114) $(VOBJ115)
VOBJ12 = $(VOBJ121) $(VOBJ122) $(VOBJ123) $(VOBJ124)
VOBJ13 = $(VOBJ131) $(VOBJ132) $(VOBJ133) $(VOBJ134)
VOBJ14 = $(VOBJ141) $(VOBJ142) $(VOBJ143) $(VOBJ144)
VOBJ15 = $(VOBJ151) $(VOBJ152) $(VOBJ153) $(VOBJ154)
VOBJ16 = $(VOBJ161) $(VOBJ162) $(VOBJ163) $(VOBJ164)
VOBJ17 = $(VOBJ171) $(VOBJ172) $(VOBJ173) $(VOBJ174)
VOBJ18 = $(VOBJ181) $(VOBJ182) $(VOBJ183) $(VOBJ184)
VOBJ19 = $(VOBJ191) $(VOBJ192) $(VOBJ193) $(VOBJ194) $(VOBJ195)
VOBJ20 = $(VOBJ201) $(VOBJ202) $(VOBJ203) $(VOBJ204)
VOBJ21 = $(VOBJ211) $(VOBJ212) $(VOBJ213) $(VOBJ214)
VOBJ22 = $(VOBJ221) $(VOBJ222) $(VOBJ223) $(VOBJ224)
VOBJ23 = $(VOBJ231) $(VOBJ232) $(VOBJ233) $(VOBJ234)
VOBJ24 = $(VOBJ241) $(VOBJ242) $(VOBJ243) $(VOBJ244)
VOBJ25 = $(VOBJ251) $(VOBJ252) $(VOBJ253) $(VOBJ254)
VOBJ26 = $(VOBJ261) $(VOBJ262) $(VOBJ263) $(VOBJ264)
VOBJ27 = $(VOBJ271) $(VOBJ272) $(VOBJ273) $(VOBJ274)
VOBJ28 = $(VOBJ281) $(VOBJ282)
VOBJ29 = $(WINOBJ) $(RANDOM)
HHOBJ  = $(OBJ)\version.o

VOBJ =	 $(VOBJ01)  $(VOBJ02)  $(VOBJ03)  $(VOBJ04)  $(VOBJ05)  $(VOBJ06)  $(VOBJ07) \
	 $(VOBJ08)  $(VOBJ09)  $(VOBJ10)  $(VOBJ11)  $(VOBJ12)  $(VOBJ13)  $(VOBJ14) \
	 $(VOBJ15)  $(VOBJ16)  $(VOBJ17)  $(VOBJ18)  $(VOBJ19)  $(VOBJ20)  $(VOBJ21) \
	 $(VOBJ22)  $(VOBJ23)  $(VOBJ24)  $(VOBJ25)  $(VOBJ26)  $(VOBJ27)  $(VOBJ28) \
	 $(VOBJ29)
HOBJ =	 $(VOBJ)  $(HHOBJ)

EXTERN_H   = # $(INCL)\extern.h
OS2CONF_H  = $(INCL)\os2conf.h $(INCL)\micro.h $(INCL)\system.h $(EXTERN_H)
GLOBAL_H   = $(INCL)\global.h $(INCL)\coord.h $(OS2CONF_H)
CONFIG_H   = $(INCL)\config.h $(INCL)\config1.h $(INCL)\tradstdc.h $(GLOBAL_H)
TRAP_H	   = $(INCL)\trap.h
PERMONST_H = $(INCL)\permonst.h $(INCL)\monattk.h $(INCL)\monflag.h
YOU_H	   = $(INCL)\you.h $(INCL)\attrib.h $(PERMONST_H) $(INCL)\mondata.h \
	     $(INCL)\monst.h $(INCL)\youprop.h $(INCL)\prop.h $(INCL)\pm.h
DECL_H	   = $(INCL)\decl.h $(INCL)\spell.h $(INCL)\obj.h $(YOU_H) \
	     $(INCL)\onames.h $(INCL)\color.h
HACK_H	   = $(CONFIG_H) $(DECL_H) $(INCL)\monsym.h $(INCL)\mkroom.h \
	     $(INCL)\objclass.h $(TRAP_H) $(INCL)\engrave.h $(INCL)\flag.h \
	     $(INCL)\rm.h $(INCL)\dungeon.h $(INCL)\hack.h $(INCL)\display.h \
	     $(INCL)\vision.h $(INCL)\wintty.h $(INCL)\wintype.h $(INCL)\align.h \
	     $(INCL)\winprocs.h

#
#	The default target.
#

all :	makedefs dgn_comp lev_comp recover $(GAME) dat $(GUIDE)
	$(ECHO) Done.

#
#	Definition file creation.
#

$(TEMP)\$(GAMEDEF) :
	$(MAKEB) DD_NAME=$(GAME) DD_DESC=$(GAMEDES) DD_TARG=$@ do_def
$(TEMP)\$(MKDFDEF) :
	$(MAKEB) DD_NAME=makedefs DD_DESC="Definitions compiler" DD_TARG=$@ do_def
$(TEMP)\$(DGNCDEF) :
	$(MAKEB) DD_NAME=dgn_comp DD_DESC="Dungeon compiler" DD_TARG=$@ do_def
$(TEMP)\$(LEVCDEF) :
	$(MAKEB) DD_NAME=lev_comp DD_DESC="Level compiler" DD_TARG=$@ do_def
$(TEMP)\$(RCVRDEF) :
	$(MAKEB) DD_NAME=recover DD_DESC="Recovery utility" DD_TARG=$@ do_def
$(TEMP)\$(DLBDEF) :
	$(MAKEB) DD_NAME=dlb DD_DESC="Archive utility" DD_TARG=$@ do_def

do_def :
	$(ECHO) NAME $(DD_NAME) WINDOWCOMPAT> $(DD_TARG)
	$(ECHO) DESCRIPTION '$(DD_DESC)'>> $(DD_TARG)
	$(ECHO) PROTMODE>> $(DD_TARG)
	$(ECHO) EXETYPE OS2>> $(DD_TARG)

#
#	The main target.
#

$(GAME) : $(GAMEDIR)\$(GAME).exe
$(GAME).exe : $(GAMEDIR)\$(GAME).exe
$(GAMEDIR)\$(GAME).exe : $(TEMP)\$(GAME).rsp $(TEMP)\$(GAME).r
	$(GAMELN)

$(TEMP)\$(GAME).r : $(HOBJ) $(TEMP)\$(GAMEDEF)
	$(ECHO) $(VOBJ011) > $@
	$(ECHO) $(VOBJ012) >> $@
	$(ECHO) $(VOBJ013) >> $@
	$(ECHO) $(VOBJ014) >> $@
	$(ECHO) $(VOBJ021) >> $@
	$(ECHO) $(VOBJ022) >> $@
	$(ECHO) $(VOBJ023) >> $@
	$(ECHO) $(VOBJ024) >> $@
	$(ECHO) $(VOBJ031) >> $@
	$(ECHO) $(VOBJ032) >> $@
	$(ECHO) $(VOBJ033) >> $@
	$(ECHO) $(VOBJ034) >> $@
	$(ECHO) $(VOBJ041) >> $@
	$(ECHO) $(VOBJ042) >> $@
	$(ECHO) $(VOBJ043) >> $@
	$(ECHO) $(VOBJ044) >> $@
	$(ECHO) $(VOBJ051) >> $@
	$(ECHO) $(VOBJ052) >> $@
	$(ECHO) $(VOBJ053) >> $@
	$(ECHO) $(VOBJ054) >> $@
	$(ECHO) $(VOBJ061) >> $@
	$(ECHO) $(VOBJ062) >> $@
	$(ECHO) $(VOBJ063) >> $@
	$(ECHO) $(VOBJ064) >> $@
	$(ECHO) $(VOBJ071) >> $@
	$(ECHO) $(VOBJ072) >> $@
	$(ECHO) $(VOBJ073) >> $@
	$(ECHO) $(VOBJ074) >> $@
	$(ECHO) $(VOBJ081) >> $@
	$(ECHO) $(VOBJ082) >> $@
	$(ECHO) $(VOBJ083) >> $@
	$(ECHO) $(VOBJ084) >> $@
	$(ECHO) $(VOBJ091) >> $@
	$(ECHO) $(VOBJ092) >> $@
	$(ECHO) $(VOBJ093) >> $@
	$(ECHO) $(VOBJ094) >> $@
	$(ECHO) $(VOBJ101) >> $@
	$(ECHO) $(VOBJ102) >> $@
	$(ECHO) $(VOBJ103) >> $@
	$(ECHO) $(VOBJ104) >> $@
	$(ECHO) $(VOBJ111) >> $@
	$(ECHO) $(VOBJ112) >> $@
	$(ECHO) $(VOBJ113) >> $@
	$(ECHO) $(VOBJ114) >> $@
	$(ECHO) $(VOBJ115) >> $@
	$(ECHO) $(VOBJ121) >> $@
	$(ECHO) $(VOBJ122) >> $@
	$(ECHO) $(VOBJ123) >> $@
	$(ECHO) $(VOBJ124) >> $@
	$(ECHO) $(VOBJ131) >> $@
	$(ECHO) $(VOBJ132) >> $@
	$(ECHO) $(VOBJ133) >> $@
	$(ECHO) $(VOBJ134) >> $@
	$(ECHO) $(VOBJ141) >> $@
	$(ECHO) $(VOBJ142) >> $@
	$(ECHO) $(VOBJ143) >> $@
	$(ECHO) $(VOBJ144) >> $@
	$(ECHO) $(VOBJ151) >> $@
	$(ECHO) $(VOBJ152) >> $@
	$(ECHO) $(VOBJ153) >> $@
	$(ECHO) $(VOBJ154) >> $@
	$(ECHO) $(VOBJ161) >> $@
	$(ECHO) $(VOBJ162) >> $@
	$(ECHO) $(VOBJ163) >> $@
	$(ECHO) $(VOBJ164) >> $@
	$(ECHO) $(VOBJ171) >> $@
	$(ECHO) $(VOBJ172) >> $@
	$(ECHO) $(VOBJ173) >> $@
	$(ECHO) $(VOBJ174) >> $@
	$(ECHO) $(VOBJ181) >> $@
	$(ECHO) $(VOBJ182) >> $@
	$(ECHO) $(VOBJ183) >> $@
	$(ECHO) $(VOBJ184) >> $@
	$(ECHO) $(VOBJ191) >> $@
	$(ECHO) $(VOBJ192) >> $@
	$(ECHO) $(VOBJ193) >> $@
	$(ECHO) $(VOBJ194) >> $@
	$(ECHO) $(VOBJ195) >> $@
	$(ECHO) $(VOBJ201) >> $@
	$(ECHO) $(VOBJ202) >> $@
	$(ECHO) $(VOBJ203) >> $@
	$(ECHO) $(VOBJ204) >> $@
	$(ECHO) $(VOBJ211) >> $@
	$(ECHO) $(VOBJ212) >> $@
	$(ECHO) $(VOBJ213) >> $@
	$(ECHO) $(VOBJ214) >> $@
	$(ECHO) $(VOBJ221) >> $@
	$(ECHO) $(VOBJ222) >> $@
	$(ECHO) $(VOBJ223) >> $@
	$(ECHO) $(VOBJ224) >> $@
	$(ECHO) $(VOBJ231) >> $@
	$(ECHO) $(VOBJ232) >> $@
	$(ECHO) $(VOBJ233) >> $@
	$(ECHO) $(VOBJ234) >> $@
	$(ECHO) $(VOBJ241) >> $@
	$(ECHO) $(VOBJ242) >> $@
	$(ECHO) $(VOBJ243) >> $@
	$(ECHO) $(VOBJ244) >> $@
	$(ECHO) $(VOBJ251) >> $@
	$(ECHO) $(VOBJ252) >> $@
	$(ECHO) $(VOBJ253) >> $@
	$(ECHO) $(VOBJ254) >> $@
	$(ECHO) $(VOBJ261) >> $@
	$(ECHO) $(VOBJ262) >> $@
	$(ECHO) $(VOBJ263) >> $@
	$(ECHO) $(VOBJ264) >> $@
	$(ECHO) $(VOBJ271) >> $@
	$(ECHO) $(VOBJ272) >> $@
	$(ECHO) $(VOBJ273) >> $@
	$(ECHO) $(VOBJ274) >> $@
	$(ECHO) $(VOBJ281) >> $@
	$(ECHO) $(VOBJ282) >> $@
	$(ECHO) $(WINOBJ1) >> $@
	$(ECHO) $(WINOBJ2) >> $@
	$(ECHO) $(WINOBJ3) >> $@
	$(ECHO) $(WINOBJ4) >> $@
	$(ECHO) $(HHOBJ) >> $@
	$(ECHO) $(RANDOM) >> $@
.IF $(with_x11) == yes
	$(X11ECHO) $(WINX11OBJ01) >> $@
	$(X11ECHO) $(WINX11OBJ02) >> $@
	$(X11ECHO) $(WINX11OBJ03) >> $@
	$(X11ECHO) $(WINX11OBJ04) >> $@
	$(X11ECHO) $(WINX11OBJ05) >> $@
	$(X11ECHO) $(WINX11OBJ06) >> $@
	$(X11ECHO) $(WINX11OBJ07) >> $@
	$(X11ECHO) $(WINX11OBJ08) >> $@
	$(X11ECHO) $(WINX11OBJ09) >> $@
	$(X11ECHO) $(WINX11OBJ10) >> $@
	$(X11ECHO) $(WINX11OBJ11) >> $@
.END



$(TEMP)\$(GAME).rsp : $(HOBJ) $(TEMP)\$(GAMEDEF)
	$(ECHO) $(SYSOBJ) $(VOBJ01) +> $@
	$(ECHO) $(VOBJ02) +>> $@
	$(ECHO) $(VOBJ03) +>> $@
	$(ECHO) $(VOBJ04) +>> $@
	$(ECHO) $(VOBJ05) +>> $@
	$(ECHO) $(VOBJ06) +>> $@
	$(ECHO) $(VOBJ07) +>> $@
	$(ECHO) $(VOBJ08) +>> $@
	$(ECHO) $(VOBJ09) +>> $@
	$(ECHO) $(VOBJ10) +>> $@
	$(ECHO) $(VOBJ11) +>> $@
	$(ECHO) $(VOBJ12) +>> $@
	$(ECHO) $(VOBJ13) +>> $@
	$(ECHO) $(VOBJ14) +>> $@
	$(ECHO) $(VOBJ15) +>> $@
	$(ECHO) $(VOBJ16) +>> $@
	$(ECHO) $(VOBJ17) +>> $@
	$(ECHO) $(VOBJ18) +>> $@
	$(ECHO) $(VOBJ19) +>> $@
	$(ECHO) $(VOBJ20) +>> $@
	$(ECHO) $(VOBJ21) +>> $@
	$(ECHO) $(VOBJ22) +>> $@
	$(ECHO) $(VOBJ23) +>> $@
	$(ECHO) $(VOBJ24) +>> $@
	$(ECHO) $(VOBJ25) +>> $@
	$(ECHO) $(VOBJ26) +>> $@
	$(ECHO) $(VOBJ27) +>> $@
	$(ECHO) $(VOBJ28) +>> $@
	$(ECHO) $(VOBJ29) +>> $@
	$(ECHO) $(VOBJ30) +>> $@
	$(ECHO) $(HHOBJ)>> $@
	$(ECHO) $(GAMEDIR)\$(GAME).exe>> $@
	$(ECHO) $(TEMP)\$(GAME)>> $@
	$(ECHO) $(PLIBS) $(TERMLIB)>> $@
	$(ECHO) $(TEMP)\$(GAMEDEF) $(LFLAGS);>> $@

#
#	Targets for makedefs.
#

makedefs : $(TEMP)\makedefs.exe
$(TEMP)\makedefs.exe : $(TEMP)\makedefs.rsp
	$(MKDFLN)

$(TEMP)\makedefs.rsp : $(MAKEOBJS) $(TEMP)\$(MKDFDEF)
	$(ECHO) $(SYSOBJ) $(MAKEOBJS)> $@
	$(ECHO) $(TEMP)\makedefs.exe>> $@
	$(ECHO) nul>> $@
	$(ECHO) $(RLIBS)>> $@
	$(ECHO) $(MKDFMD) $(LFLAGS);>> $@

$(OBJ)\makedefs.o : $(UTIL)\$(CB) $(CONFIG_H) $(INCL)\permonst.h $(INCL)\objclass.h \
		    $(INCL)\monsym.h $(INCL)\artilist.h $(INCL)\qtext.h
	$(UTILCC)

#
#	Targets for the special levels compiler.
#

lev_comp : $(TEMP)\lev_comp.exe
$(TEMP)\lev_comp.exe : $(TEMP)\lev_comp.rsp
	$(LEVCLN)

$(TEMP)\lev_comp.rsp : $(SPLEVOBJS) $(TEMP)\$(LEVCDEF)
	$(ECHO) $(SYSOBJ) $(SOBJ01) +> $@
	$(ECHO) $(SOBJ02) +>> $@
	$(ECHO) $(SOBJ03)>> $@
	$(ECHO) $(TEMP)\lev_comp.exe>> $@
	$(ECHO) nul>> $@
	$(ECHO) $(RLIBS)>> $@
	$(ECHO) $(LEVCMD) $(LFLAGS);>> $@

$(OBJ)\lev_yacc.o : $(UTIL)\$(CB) $(HACK_H) $(INCL)\sp_lev.h
	$(UTILCC)
$(OBJ)\lev_lex.o  : $(UTIL)\$(CB) $(HACK_H) $(INCL)\sp_lev.h $(INCL)\lev_comp.h
	$(UTILCC)
$(OBJ)\lev_main.o : $(UTIL)\$(CB) $(HACK_H) $(INCL)\sp_lev.h $(INCL)\tcap.h
	$(UTILCC)

$(UTIL)\lev_yacc.c : $(UTIL)\lev_comp.y
	$(MAKEB) YY=lev do_yacc

$(UTIL)\lev_lex.c  : $(UTIL)\lev_comp.l
	$(MAKEB) YY=lev do_lex

#
#	Targets for the dungeon compiler.
#

dgn_comp : $(TEMP)\dgn_comp.exe
$(TEMP)\dgn_comp.exe : $(TEMP)\dgn_comp.rsp
	$(DGNCLN)

$(TEMP)\dgn_comp.rsp : $(DGNCOMPOBJS) $(TEMP)\$(DGNCDEF)
	$(ECHO) $(SYSOBJ) $(DOBJ01) +> $@
	$(ECHO) $(DOBJ02)>> $@
	$(ECHO) $(TEMP)\dgn_comp.exe>> $@
	$(ECHO) nul>> $@
	$(ECHO) $(RLIBS)>> $@
	$(ECHO) $(DGNCMD) $(LFLAGS);>> $@

$(OBJ)\dgn_yacc.o : $(UTIL)\$(CB) $(CONFIG_H) $(INCL)\date.h $(INCL)\dgn_file.h
	$(UTILCC)
$(OBJ)\dgn_lex.o  : $(UTIL)\$(CB) $(CONFIG_H) $(INCL)\dgn_comp.h $(INCL)\dgn_file.h
	$(UTILCC)
$(OBJ)\dgn_main.o : $(UTIL)\$(CB) $(CONFIG_H)
	$(UTILCC)

$(UTIL)\dgn_yacc.c : $(UTIL)\dgn_comp.y
	$(MAKEB) YY=dgn do_yacc

$(UTIL)\dgn_lex.c  : $(UTIL)\dgn_comp.l
	$(MAKEB) YY=dgn do_lex

#
#	For both lev_comp and dgn_comp.
#

$(OBJ)\panic.o : $(UTIL)\$(CB) $(CONFIG_H)
	$(UTILCC)

#
#	Yacc and Lex targets.
#

yacc_cpy :
	$(CP) $(SSYS)\$(YY)_yacc.c $(UTIL)
	$(CP) $(SSYS)\$(YY)_comp.h $(INCL)
	$(MAKEB) TT=$(UTIL)\$(YY)_yacc.c do_touch
	$(MAKEB) TT=$(INCL)\$(YY)_comp.h do_touch

yacc_msg :
	$(ECHO) $(YY)_comp.y has changed. To update $(YY)_yacc.c and $(YY)_comp.h run $(YACC).

yacc_act :
	$(YACC) -d $(UTIL)\$(YY)_comp.y
	$(CP) $(YTABC) $(UTIL)\$(YY)_yacc.c
	$(CP) $(YTABH) $(INCL)\$(YY)_comp.h
	$(RM) $(YTABC)
	$(RM) $(YTABH)

lex_cpy :
	$(CP) $(SSYS)\$(YY)_lex.c $(UTIL)
	$(MAKEB) TT=$(UTIL)\$(YY)_lex.c do_touch

lex_msg :
	$(ECHO) $(YY)_comp.l has changed. To update $(YY)_lex.c run $(LEX).

lex_act :
	$(LEX) $(UTIL)\$(YY)_comp.l
	$(CP) $(LEXYYC) $(UTIL)\$(YY)_lex.c
	$(RM) $(LEXYYC)

#
#	Why must this be so kludgy?
#

realtouch :
	$(TOUCH) $(TT)

faketouch :
	$(BEG) $(CAT) $(TT) > $(TEMP)\foo.bar $(SEP) $(CP) $(TEMP)\foo.bar $(TT) $(SEP) $(RM) $(TEMP)\foo.bar $(END)

#
#	Targets for the recovery utility.
#

recover : $(GAMEDIR)\recover.exe
$(GAMEDIR)\recover.exe : $(TEMP)\recover.rsp
	$(RCVRLN)

$(TEMP)\recover.rsp : $(RECOVOBJS) $(TEMP)\$(RCVRDEF)
	$(ECHO) $(SYSOBJ) $(RECOVOBJS)> $@
	$(ECHO) $(GAMEDIR)\recover.exe>> $@
	$(ECHO) nul>> $@
	$(ECHO) $(PLIBS)>> $@
	$(ECHO) $(TEMP)\$(RCVRDEF) $(LFLAGS);>> $@

$(OBJ)\recover.o : $(UTIL)\$(CB) $(CONFIG_H)
	$(UTILCC)

#
#	Targets for the dlb.
#

dlb : $(TEMP)\dlb.exe
$(TEMP)\dlb.exe : $(TEMP)\dlb.rsp
	$(DLBRLN)

$(TEMP)\dlb.rsp : $(DLBOBJS) $(TEMP)\$(DLBDEF)
	$(ECHO) $(SYSOBJ) $(DLBOBJS)> $@
	$(ECHO) $(TEMP)\dlb.exe>> $@
	$(ECHO) nul>> $@
	$(ECHO) $(PLIBS)>> $@
	$(ECHO) $(TEMP)\$(DLBDEF) $(LFLAGS);>> $@

$(OBJ)\dlb_main.o : $(UTIL)\$(CB) $(CONFIG_H) $(INCL)\dlb.h
	$(UTILCC)

$(GAMEDIR)\nhdat : $(WINX11VARDAT)
	$(MAKEB) do_dlb

dlb_yup : dlb
	$(TEMP)\dlb cCf $(GAMEDIR) $(GAMEDIR)\nhdat $(DATDLB)
	-$(RM) $(GAMEDIR)\help
	-$(RM) $(GAMEDIR)\hh
	-$(RM) $(GAMEDIR)\cmdhelp
	-$(RM) $(GAMEDIR)\history
	-$(RM) $(GAMEDIR)\opthelp
	-$(RM) $(GAMEDIR)\wizhelp
	-$(RM) $(GAMEDIR)\asmodeus.lev
	-$(RM) $(GAMEDIR)\baalz.lev
	-$(RM) $(GAMEDIR)\bigrm-?.lev
	-$(RM) $(GAMEDIR)\castle.lev
	-$(RM) $(GAMEDIR)\fakewiz?.lev
	-$(RM) $(GAMEDIR)\juiblex.lev
	-$(RM) $(GAMEDIR)\knox.lev
	-$(RM) $(GAMEDIR)\medusa-?.lev
	-$(RM) $(GAMEDIR)\minend-?.lev
	-$(RM) $(GAMEDIR)\minefill.lev
	-$(RM) $(GAMEDIR)\minetn-?.lev
	-$(RM) $(GAMEDIR)\oracle.lev
	-$(RM) $(GAMEDIR)\orcus.lev
	-$(RM) $(GAMEDIR)\sanctum.lev
	-$(RM) $(GAMEDIR)\tower?.lev
	-$(RM) $(GAMEDIR)\valley.lev
	-$(RM) $(GAMEDIR)\wizard?.lev
	-$(RM) $(GAMEDIR)\astral.lev
	-$(RM) $(GAMEDIR)\air.lev
	-$(RM) $(GAMEDIR)\earth.lev
	-$(RM) $(GAMEDIR)\fire.lev
	-$(RM) $(GAMEDIR)\water.lev
	-$(RM) $(GAMEDIR)\???-goal.lev
	-$(RM) $(GAMEDIR)\???-fil?.lev
	-$(RM) $(GAMEDIR)\???-loca.lev
	-$(RM) $(GAMEDIR)\???-strt.lev
	-$(RM) $(GAMEDIR)\data
	-$(RM) $(GAMEDIR)\oracles
	-$(RM) $(GAMEDIR)\options
	-$(RM) $(GAMEDIR)\quest.dat
	-$(RM) $(GAMEDIR)\rumors
	-$(RM) $(GAMEDIR)\dungeon
	-$(RM) $(GAMEDIR)\soko?-?.lev
#	-$(RM) $(GAMEDIR)\pet_mark.xbm
#	-$(RM) $(GAMEDIR)\rip.xpm

dlb_nope :
	$(ECHO) DLB not requested.

#
#	The following files depend on makedefs to be created.
#
#	date.h should be remade every time any of the source or include
#	files is modified.
#

$(INCL)\date.h : $(VOBJ) $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -v
	$(CP) $(DAT)\options $(GAMEDIR)
	$(RM) $(DAT)\options

$(INCL)\onames.h : $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -o

$(INCL)\pm.h : $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -p

monstr.c : $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -m

$(OBJ)\monstr.o : $(CB)
	$(SRCCC)

$(GAMEDIR)\data : $(DAT)\$(DATABASE) $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -d
	$(CP) $(DAT)\data $(GAMEDIR)
	$(RM) $(DAT)\data

$(GAMEDIR)\rumors : $(DAT)\rumors.tru $(DAT)\rumors.fal $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -r
	$(CP) $(DAT)\rumors $(GAMEDIR)
	$(RM) $(DAT)\rumors

$(GAMEDIR)\oracles : $(DAT)\oracles.txt $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -h
	$(CP) $(DAT)\oracles $(GAMEDIR)
	$(RM) $(DAT)\oracles

$(GAMEDIR)\quest.dat : $(DAT)\quest.txt $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -q
	$(CP) $(DAT)\quest.dat $(GAMEDIR)
	$(RM) $(DAT)\quest.dat

#
#	Vision tables for algorithm D.
#

vis_tab.c : $(INCL)\vis_tab.h
$(INCL)\vis_tab.h : $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -z

$(OBJ)\vis_tab.o : $(CB)
	$(SRCCC)

#
#	The following programs vary depending on what OS you are using.
#

$(OBJ)\main.o : $(SSYS)\pc$(CB) $(HACK_H) $(INCL)\dlb.h
	$(PSYSCC)
$(OBJ)\tty.o  : $(SSYS)\pc$(CB) $(HACK_H) $(INCL)\func_tab.h
	$(PSYSCC)
$(OBJ)\unix.o : $(SSYS)\pc$(CB) $(HACK_H)
	$(PSYSCC)

#
#	Other system specific modules.
#

$(OBJ)\os2.o   : $(SYS)\$(CB) $(HACK_H) $(INCL)\tcap.h $(INCL)\def_os2.h
	$(SYSCC)
$(OBJ)\pcsys.o : $(SSYS)\$(CB) $(HACK_H)
	$(SSYSCC)

#
#	Berkeley random(3) routines.
#

$(OBJ)\random.o : $(SSYS)\$(CB)
	$(SSYSCC)

#
#	Window source.
#

$(OBJ)\getline.o : $(WIN)\$(CB) $(HACK_H) $(INCL)\func_tab.h
	$(WINCC)
$(OBJ)\termcap.o : $(WIN)\$(CB) $(HACK_H) $(INCL)\tcap.h
	$(WINCC)
$(OBJ)\topl.o    : $(WIN)\$(CB) $(HACK_H) $(INCL)\tcap.h
	$(WINCC)
$(OBJ)\wintty.o  : $(WIN)\$(CB) $(HACK_H) $(INCL)\tcap.h
	$(WINCC)

#
#	Secondary targets.
#

dat :	spec_lev help_fil $(GAMEDIR)\dungeon $(GAMEDIR)\data $(GAMEDIR)\rumors \
	$(GAMEDIR)\oracles $(GAMEDIR)\quest.dat	$(GAMEDIR)\$(GAME).ico \
	$(GAMEDIR)\$(GAME).cmd $(GAMEDIR)\nethack.cnf $(GAMEDIR)\nhdat \
	$(WINX11VARDAT)

help_fil : $(GAMEDIR)\cmdhelp $(GAMEDIR)\help $(GAMEDIR)\hh $(GAMEDIR)\history \
	$(GAMEDIR)\license $(GAMEDIR)\opthelp $(GAMEDIR)\wizhelp

$(GAMEDIR)\cmdhelp : $(DAT)\cmdhelp
	$(CP) $(DAT)\cmdhelp $(GAMEDIR)
$(GAMEDIR)\help : $(DAT)\help
	$(CP) $(DAT)\help $(GAMEDIR)
$(GAMEDIR)\hh : $(DAT)\hh
	$(CP) $(DAT)\hh $(GAMEDIR)
$(GAMEDIR)\history : $(DAT)\history
	$(CP) $(DAT)\history $(GAMEDIR)
$(GAMEDIR)\license : $(DAT)\license
	$(CP) $(DAT)\license $(GAMEDIR)
$(GAMEDIR)\opthelp : $(DAT)\opthelp
	$(CP) $(DAT)\opthelp $(GAMEDIR)
$(GAMEDIR)\wizhelp : $(DAT)\wizhelp
	$(CP) $(DAT)\wizhelp $(GAMEDIR)

$(GAMEDIR)\dungeon : $(DAT)\dungeon.def $(TEMP)\makedefs.exe $(TEMP)\dgn_comp.exe
	$(TEMP)\makedefs -e
	$(TEMP)\dgn_comp $(DAT)\dungeon.pdf
	$(CP) $(DAT)\dungeon $(GAMEDIR)
	$(RM) $(DAT)\dungeon.pdf
	$(RM) $(DAT)\dungeon

AFILES = $(GAMEDIR)\Arc-goal.lev
BFILES = $(GAMEDIR)\Bar-goal.lev
CFILES = $(GAMEDIR)\Cav-goal.lev
HFILES = $(GAMEDIR)\Hea-goal.lev
KFILES = $(GAMEDIR)\Kni-goal.lev
MFILES = $(GAMEDIR)\Mon-goal.lev
PFILES = $(GAMEDIR)\Pri-goal.lev
RANFILES = $(GAMEDIR)\Ran-goal.lev
RFILES = $(GAMEDIR)\Rog-goal.lev
SFILES = $(GAMEDIR)\Sam-goal.lev
TFILES = $(GAMEDIR)\Tou-goal.lev
VFILES = $(GAMEDIR)\Val-goal.lev
WFILES = $(GAMEDIR)\Wiz-goal.lev

XFILES = $(AFILES) $(BFILES) $(CFILES) $(HFILES) $(KFILES) $(MFILES) \
	 $(PFILES) $(RANFILES) $(RFILES) $(SFILES) $(TFILES) $(VFILES) $(WFILES)

spec_lev : $(GAMEDIR)\astral.lev $(GAMEDIR)\bigrm-1.lev $(GAMEDIR)\castle.lev \
	   $(GAMEDIR)\knox.lev $(GAMEDIR)\medusa-1.lev $(GAMEDIR)\minefill.lev \
	   $(GAMEDIR)\oracle.lev $(GAMEDIR)\tower1.lev $(GAMEDIR)\valley.lev \
	   $(GAMEDIR)\wizard1.lev $(GAMEDIR)\soko1-1.lev $(XFILES)

#	Single special level files

$(GAMEDIR)\castle.lev : $(DAT)\castle.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=castle do_slev
$(GAMEDIR)\knox.lev : $(DAT)\knox.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=knox do_slev
$(GAMEDIR)\oracle.lev : $(DAT)\oracle.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=oracle do_slev

do_slev :
	$(TEMP)\lev_comp $(DAT)\$(LF).des
	$(CP) $(LF).lev $(GAMEDIR)
	$(RM) $(LF).lev

#	Multiple special level files

$(GAMEDIR)\astral.lev : $(DAT)\endgame.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\endgame.des
	$(CP) air.lev $(GAMEDIR)
	$(CP) astral.lev $(GAMEDIR)
	$(CP) earth.lev $(GAMEDIR)
	$(CP) fire.lev $(GAMEDIR)
	$(CP) water.lev $(GAMEDIR)
	$(RM) air.lev
	$(RM) astral.lev
	$(RM) earth.lev
	$(RM) fire.lev
	$(RM) water.lev

$(GAMEDIR)\bigrm-1.lev : $(DAT)\bigroom.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\bigroom.des
	$(CP) bigrm-?.lev $(GAMEDIR)
	$(RM) bigrm-?.lev

$(GAMEDIR)\medusa-1.lev : $(DAT)\medusa.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\medusa.des
	$(CP) medusa-?.lev $(GAMEDIR)
	$(RM) medusa-?.lev

$(GAMEDIR)\minefill.lev : $(DAT)\mines.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\mines.des
	$(CP) minend-?.lev $(GAMEDIR)
	$(CP) minefill.lev $(GAMEDIR)
	$(CP) minetn-?.lev $(GAMEDIR)
	$(RM) minend-?.lev
	$(RM) minefill.lev
	$(RM) minetn-?.lev

$(GAMEDIR)\tower1.lev : $(DAT)\tower.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\tower.des
	$(CP) tower?.lev $(GAMEDIR)
	$(RM) tower?.lev

$(GAMEDIR)\valley.lev : $(DAT)\gehennom.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\gehennom.des
	$(CP) asmodeus.lev $(GAMEDIR)
	$(CP) baalz.lev $(GAMEDIR)
	$(CP) juiblex.lev $(GAMEDIR)
	$(CP) orcus.lev $(GAMEDIR)
	$(CP) sanctum.lev $(GAMEDIR)
	$(CP) valley.lev $(GAMEDIR)
	$(RM) asmodeus.lev
	$(RM) baalz.lev
	$(RM) juiblex.lev
	$(RM) orcus.lev
	$(RM) sanctum.lev
	$(RM) valley.lev

$(GAMEDIR)\wizard1.lev : $(DAT)\yendor.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\yendor.des
	$(CP) wizard?.lev $(GAMEDIR)
	$(CP) fakewiz?.lev $(GAMEDIR)
	$(RM) wizard?.lev
	$(RM) fakewiz?.lev

$(GAMEDIR)\soko1-1.lev : $(DAT)\sokoban.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\sokoban.des
	$(CP) soko?-?.lev $(GAMEDIR)
	$(RM) soko?-?.lev


#	Quest dungeons

$(AFILES) : $(DAT)\Arch.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Arc QF=Arch do_quest
$(BFILES) : $(DAT)\Barb.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Bar QF=Barb do_quest
$(CFILES) : $(DAT)\Caveman.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Cav QF=Caveman do_quest
$(HFILES) : $(DAT)\Healer.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Hea QF=Healer do_quest
$(KFILES) : $(DAT)\Knight.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Kni QF=Knight do_quest
$(MFILES) : $(DAT)\Monk.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Mon QF=Monk do_quest
$(PFILES) : $(DAT)\Priest.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Pri QF=Priest do_quest
$(RANFILES) : $(DAT)\Ranger.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Ran QF=Ranger do_quest
$(RFILES) : $(DAT)\Rogue.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Rog QF=Rogue do_quest
$(SFILES) : $(DAT)\Samurai.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Sam QF=Samurai do_quest
$(TFILES) : $(DAT)\Tourist.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Tou QF=Tourist do_quest
$(VFILES) : $(DAT)\Valkyrie.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Val QF=Valkyrie do_quest
$(WFILES) : $(DAT)\Wizard.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Wiz QF=Wizard do_quest

do_quest :
	$(TEMP)\lev_comp $(DAT)\$(QF).des
	$(CP) $(QQ)-fil?.lev $(GAMEDIR)
	$(CP) $(QQ)-goal.lev $(GAMEDIR)
	$(CP) $(QQ)-loca.lev $(GAMEDIR)
	$(CP) $(QQ)-strt.lev $(GAMEDIR)
	$(RM) $(QQ)-fil?.lev
	$(RM) $(QQ)-goal.lev
	$(RM) $(QQ)-loca.lev
	$(RM) $(QQ)-strt.lev

#
#	NetHack icon for Presentation Manager.
#

$(GAMEDIR)\$(GAME).ico : $(SYS)\nhpmico.uu
	$(MAKEB) do_icon

icon_msg :
	$(ECHO) Icon file not extracted.  Extract manually if required.

icon_act :
	$(UUDECODE) $(SYS)\nhpmico.uu
	$(CP) nethack.ico $(GAMEDIR)\$(GAME).ico
	$(RM) nethack.ico

#
#	NetHack command file to use with Presentation Manager.
#

$(GAMEDIR)\$(GAME).cmd :
	$(MAKEB) CMDF=$@ do_cmd

cmd_msg :
	$(ECHO) Command file not created.  Create manually if required.

cmd_act :
	$(ECHO) @echo off> $(CMDF)
	$(ECHO) REM Command file for starting nethack.exe from PM/WPS Desktop>> $(CMDF)
	$(ECHO) $(GAME).exe $(P)1 $(P)2 $(P)3 $(P)4 $(P)5 $(P)6 $(P)7>> $(CMDF)
	$(ECHO) pause>> $(CMDF)

#
#	NetHack configuration file.  Will not overwrite an existing file.
#

$(GAMEDIR)\nethack.cnf :
	$(CP) $(SSYS)\nethack.cnf $(GAMEDIR)

#
#	Documentation.
#

$(TEMP)\$(GUIDEBOO).dvi : $(DOC)\$(GUIDEBOO).tex
	$(LATEX) $(DOC)\$(GUIDEBOO).tex
	$(CP) $(GUIDEBOO).dvi $(TEMP)
	$(CP) $(GUIDEBOO).aux $(TEMP)
	$(CP) $(GUIDEBOO).log $(TEMP)
	$(RM) $(GUIDEBOO).dvi
	$(RM) $(GUIDEBOO).aux
	$(RM) $(GUIDEBOO).log

#
#	Housekeeping.
#

clean :
	-$(RM) $(OBJ)\*.o

spotless : clean
	-$(RM) $(INCL)\date.h
	-$(RM) $(INCL)\onames.h
	-$(RM) $(INCL)\pm.h
	-$(RM) $(INCL)\vis_tab.h
	-$(RM) vis_tab.c
	-$(RM) monstr.c
	-$(RM) *.lev
	-$(RM) nethack.ico
	-$(RM) $(TEMP)\makedefs.exe
	-$(RM) $(TEMP)\lev_comp.exe
	-$(RM) $(TEMP)\dgn_comp.exe
	-$(RM) $(TEMP)\*.rsp
	-$(RM) $(TEMP)\*.def
	-$(RM) $(TEMP)\*.map
	-$(RM) $(TEMP)\$(GUIDEBOO).dvi
	-$(RM) $(TEMP)\$(GUIDEBOO).aux
	-$(RM) $(TEMP)\$(GUIDEBOO).log

#
#	Main source.
#
#	Default rules are sooo difficult for so many make
#	programs that we do this the most straightforward way.
#

$(OBJ)\allmain.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\alloc.o    : $(SRC)\$(CB) $(CONFIG_H)
	$(SRCCC)
$(OBJ)\apply.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\edog.h
	$(SRCCC)
$(OBJ)\artifact.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h
	$(SRCCC)
$(OBJ)\attrib.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h
	$(SRCCC)
$(OBJ)\ball.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\bones.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h
	$(SRCCC)
$(OBJ)\botl.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\cmd.o      : $(SRC)\$(CB) $(HACK_H) $(INCL)\func_tab.h
	$(SRCCC)
$(OBJ)\dbridge.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\decl.o     : $(SRC)\$(CB) $(HACK_H) $(INCL)\quest.h
	$(SRCCC)
$(OBJ)\detect.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h
	$(SRCCC)
$(OBJ)\dig.o      : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\display.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\dlb.o      : $(SRC)\$(CB) $(CONFIG_H) $(INCL)\dlb.h
	$(SRCCC)
$(OBJ)\do.o       : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h
	$(SRCCC)
$(OBJ)\do_name.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\do_wear.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\dog.o      : $(SRC)\$(CB) $(HACK_H) $(INCL)\edog.h
	$(SRCCC)
$(OBJ)\dogmove.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
	$(SRCCC)
$(OBJ)\dokick.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\eshk.h
	$(SRCCC)
$(OBJ)\dothrow.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\drawing.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\tcap.h
	$(SRCCC)
$(OBJ)\dungeon.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\dgn_file.h
	$(SRCCC)
$(OBJ)\eat.o      : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\end.o      : $(SRC)\$(CB) $(HACK_H) $(INCL)\eshk.h
	$(SRCCC)
$(OBJ)\engrave.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h
	$(SRCCC)
$(OBJ)\exper.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\explode.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\extralev.o : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\files.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\fountain.o : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\hack.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\hacklib.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\invent.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h
	$(SRCCC)
$(OBJ)\light.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\lock.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\mail.o     : $(SRC)\$(CB) $(HACK_H) $(INCL)\mail.h
	$(SRCCC)
$(OBJ)\makemon.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\epri.h $(INCL)\emin.h
	$(SRCCC)
$(OBJ)\mapglyph.o : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\mcastu.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\mhitm.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h $(INCL)\edog.h
	$(SRCCC)
$(OBJ)\mhitu.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h $(INCL)\edog.h
	$(SRCCC)
$(OBJ)\minion.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\emin.h $(INCL)\epri.h
	$(SRCCC)
$(OBJ)\mklev.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\mkmap.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\sp_lev.h
	$(SRCCC)
$(OBJ)\mkmaze.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\sp_lev.h
	$(SRCCC)
$(OBJ)\mkobj.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h
	$(SRCCC)
$(OBJ)\mkroom.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\mon.o      : $(SRC)\$(CB) $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
	$(SRCCC)
$(OBJ)\mondata.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\eshk.h $(INCL)\epri.h
	$(SRCCC)
$(OBJ)\monmove.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\mfndpos.h $(INCL)\artifact.h
	$(SRCCC)
$(OBJ)\monst.o    : $(SRC)\$(CB) $(CONFIG_H) $(PERMONST_H) $(INCL)\monsym.h $(INCL)\eshk.h $(INCL)\vault.h $(INCL)\epri.h $(INCL)\color.h
	$(SRCCC)
$(OBJ)\mplayer.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\mthrowu.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\muse.o     : $(SRC)\$(CB) $(HACK_H) $(INCL)\edog.h
	$(SRCCC)
$(OBJ)\music.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\o_init.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\objects.o  : $(SRC)\$(CB) $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h $(INCL)\prop.h $(INCL)\color.h
	$(SRCCC)
$(OBJ)\objnam.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\options.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\tcap.h
	$(SRCCC)
$(OBJ)\pager.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\pickup.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\pline.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\epri.h
	$(SRCCC)
$(OBJ)\polyself.o : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\potion.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\pray.o     : $(SRC)\$(CB) $(HACK_H) $(INCL)\epri.h
	$(SRCCC)
$(OBJ)\priest.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\mfndpos.h $(INCL)\eshk.h $(INCL)\epri.h $(INCL)\emin.h
	$(SRCCC)
$(OBJ)\quest.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\quest.h $(INCL)\qtext.h
	$(SRCCC)
$(OBJ)\questpgr.o : $(SRC)\$(CB) $(HACK_H) $(INCL)\qtext.h
	$(SRCCC)
$(OBJ)\read.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\region.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\rect.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\restore.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h $(INCL)\tcap.h $(INCL)\quest.h
	$(SRCCC)
$(OBJ)\rip.o      : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\rnd.o      : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\role.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\rumors.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\save.o     : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h $(INCL)\quest.h
	$(SRCCC)
$(OBJ)\shk.o      : $(SRC)\$(CB) $(HACK_H) $(INCL)\eshk.h
	$(SRCCC)
$(OBJ)\shknam.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\eshk.h
	$(SRCCC)
$(OBJ)\sit.o      : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h
	$(SRCCC)
$(OBJ)\sounds.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\edog.h $(INCL)\eshk.h
	$(SRCCC)
$(OBJ)\sp_lev.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\sp_lev.h $(INCL)\rect.h
	$(SRCCC)
$(OBJ)\spell.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\steal.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\steed.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\teleport.o : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\timeout.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\topten.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\track.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\trap.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\u_init.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\uhitm.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\vault.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\vault.h
	$(SRCCC)
$(OBJ)\version.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\date.h $(INCL)\$(PATCHLEV).h
	$(SRCCC)
$(OBJ)\vision.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\vis_tab.h
	$(SRCCC)
$(OBJ)\weapon.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\were.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\wield.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\windows.o  : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\wizard.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\qtext.h
	$(SRCCC)
$(OBJ)\worm.o     : $(SRC)\$(CB) $(HACK_H) $(INCL)\lev.h
	$(SRCCC)
$(OBJ)\worn.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\write.o    : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\zap.o      : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)

$(OBJ)/Window.o: $(WINX11)\Window.c $(INCL)\xwindowp.h $(INCL)\xwindow.h \
		$(CONFIG_H)
	$(CC) -o$(OBJ)\Window.o $(CFLAGS) -c $(WINX11)\Window.c
$(OBJ)/dialogs.o: $(WINX11)\dialogs.c $(CONFIG_H)
	$(CC) -o$(OBJ)\dialogs.o $(CFLAGS) -c $(WINX11)\dialogs.c
$(OBJ)/winX.o: $(WINX11)\winX.c $(HACK_H) $(INCL)\winX.h $(INCL)\dlb.h \
		$(INCL)\patchlevel.h $(WINX11)\nh72icon \
		$(WINX11)\nh56icon $(WINX11)\nh32icon
	$(CC) $(CFLAGS) -c $(WINX11)\winX.c -o$(OBJ)\winX.o
$(OBJ)/winmap.o: $(WINX11)\winmap.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\dlb.h \
		$(INCL)\winX.h $(INCL)\tile2x11.h
	$(CC) $(CFLAGS) -c $(WINX11)\winmap.c -o $(OBJ)\winmap.o
$(OBJ)/winmenu.o: $(WINX11)\winmenu.c $(HACK_H) $(INCL)\winX.h
	$(CC) $(CFLAGS) -c $(WINX11)\winmenu.c -o $(OBJ)\winmenu.o
$(OBJ)/winmesg.o: $(WINX11)\winmesg.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\winX.h
	$(CC) $(CFLAGS) -c $(WINX11)\winmesg.c -o$(OBJ)\winmesg.o
$(OBJ)/winmisc.o: $(WINX11)\winmisc.c $(HACK_H) $(INCL)\func_tab.h \
		$(INCL)\winX.h
	$(CC) $(CFLAGS) -c $(WINX11)\winmisc.c -o$(OBJ)\winmisc.o
$(OBJ)/winstat.o: $(WINX11)\winstat.c $(HACK_H) $(INCL)\winX.h
	$(CC) $(CFLAGS) -c $(WINX11)\winstat.c -o$(OBJ)\winstat.o
$(OBJ)/wintext.o: $(WINX11)\wintext.c $(HACK_H) $(INCL)\winX.h $(INCL)\xwindow.h
	$(CC) $(CFLAGS) -c $(WINX11)\wintext.c -o$(OBJ)\wintext.o
$(OBJ)/winval.o: $(WINX11)\winval.c $(HACK_H) $(INCL)\winX.h
	$(CC) $(CFLAGS) -c $(WINX11)\winval.c -o$(OBJ)\winval.o

$(OBJ)/tile.o: $(NHSRC)\src\tile.c $(HACK_H)
	$(CC) $(CFLAGS) -c $(NHSRC)\src\tile.c -o$(OBJ)\tile.o

$(TEMP)\tilemap.exe: ..\win\share\tilemap.c $(HACK_H)
	$(CC) $(GCCO) $(WARN) -I$(INCL) $(CDFLAGS) $(STDC) $(WINX11CFLAGS) $(LFLAGS) -o $(TEMP)\tilemap.exe ..\win\share\tilemap.c $(LIBS)
$(NHSRC)\src\tile.c: $(TEMP)\tilemap.exe
	$(TEMP)\tilemap

x11tiles: $(TEMP)\tile2x11.exe $(WINSHARE)\monsters.txt \
				$(WINSHARE)\objects.txt \
				$(WINSHARE)\other.txt
	$(TEMP)\tile2x11.exe $(WINSHARE)\monsters.txt $(WINSHARE)\objects.txt \
				$(WINSHARE)\other.txt
	$(CP) x11tiles $(GAMEDIR)\x11tiles

TEXT_IO = $(OBJ)\tiletext.o \
	  $(OBJ)\tiletxt.o \
	  $(OBJ)\drawing.o \
	  $(OBJ)\decl.o \
	  $(OBJ)\monst.o \
	  $(OBJ)\objects.o

$(OBJ)\tiletext.o: ../win/share/tiletext.c $(CONFIG_H) $(WINSHARE)\tile.h
	$(CC) $(CFLAGS) -c $(WINSHARE)\tiletext.c -o$(OBJ)\tiletext.o
$(OBJ)\tiletxt.o: $(WINSHARE)\tilemap.c $(HACK_H)
	$(CC) $(CFLAGS) -c -DTILETEXT $(WINSHARE)\tilemap.c -o$(OBJ)\tiletxt.o

$(TEMP)\tile2x11.exe: $(OBJ)\tile2x11.o $(TEXT_IO)
	$(CC) $(LFLAGS) -o $(TEMP)\tile2x11.exe $(OBJ)\tile2x11.o $(TEXT_IO) $(LIBS)

pet_mark.xbm: $(WINX11)\pet_mark.xbm
	$(CP) $(WINX11)\pet_mark.xbm $(GAMEDIR)\pet_mark.xbm

rip.xpm: $(WINX11)\rip.xpm
	$(CP) $(WINX11)\rip.xpm $(GAMEDIR)\rip.xpm

$(OBJ)\tile2x11.o : $(WINX11)\tile2x11.c $(INCL)\tile2x11.h
	$(CC) $(CFLAGS) -o$(OBJ)\tile2x11.o -c $(WINX11)\tile2x11.c \
		-I$(WINSHARE)

