# NetHack 3.6	Makefile.os2	$NHDT-Date: 1432512793 2015/05/25 00:13:13 $  $NHDT-Branch: master $:$NHDT-Revision: 1.19 $
#	OS/2 NetHack 3.6 Makefile for OS/2 versions 1.x and 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\nh350x11	# 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.6.0"

#
#	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
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)
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, recover, dlb.
#

GAMEDEF	= $(GAME).def
MKDFDEF	= makedefs.def
RCVRDEF	= recover.def
DLBDEF	= dlb.def

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

MKDFMD	= $(TEMP)\$(MKDFDEF)
#MKDFMD	=

#
#	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 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 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

VARDATD = \
 data oracles options rumors $(WINX11VARDAT)

DATDLB = $(DATHELP) dungeon *.lua $(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
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
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
VOBJ283 = $(OBJ)\sys.o

VOBJ01 = $(VOBJ011) $(VOBJ012) $(VOBJ013) $(VOBJ014)
VOBJ02 = $(VOBJ021) $(VOBJ022) $(VOBJ023) $(VOBJ024)
VOBJ03 = $(VOBJ031) $(VOBJ032) $(VOBJ033) $(VOBJ034)
VOBJ04 = $(VOBJ041) $(VOBJ042) $(VOBJ043) $(VOBJ044)
VOBJ05 = $(VOBJ051) $(VOBJ052) $(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) $(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) $(VOBJ283)
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)\mextra.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) $(INCL)\context.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 $(INCL)\sys.h

#
#	The default target.
#

all :	makedefs 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)\$(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) $(VOBJ283) >> $@
	$(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
	$(UTILCC)

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

#
#	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)\data
	-$(RM) $(GAMEDIR)\oracles
	-$(RM) $(GAMEDIR)\options
	-$(RM) $(GAMEDIR)\rumors
#	-$(RM) $(GAMEDIR)\quest.dat
#	-$(RM) $(GAMEDIR)\dungeon
#	-$(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

$(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

#
#	Vision tables for algorithm D.
#

#
#	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 $(INCL)\date.h
	$(WINCC)

#
#	Secondary targets.
#

dat :	help_fil $(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)

do_slev :
	$(CP) $(LF).lua $(GAMEDIR)



#
#	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.
#
#	LaTeX needs to be run twice.
#	The second pass uses the $(GUIDEBOO).aux file made by the first.
#

$(TEMP)\$(GUIDEBOO).dvi : $(DOC)\$(GUIDEBOO).tex
	$(LATEX) $(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) nethack.ico
	-$(RM) $(TEMP)\makedefs.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)
	$(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)
	$(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)
	$(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)
	$(SRCCC)
$(OBJ)\dogmove.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\mfndpos.h
	$(SRCCC)
$(OBJ)\dokick.o   : $(SRC)\$(CB) $(HACK_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)
	$(SRCCC)
$(OBJ)\engrave.o  : $(SRC)\$(CB) $(HACK_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)
	$(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
	$(SRCCC)
$(OBJ)\mhitu.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h
	$(SRCCC)
$(OBJ)\minion.o   : $(SRC)\$(CB) $(HACK_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
	$(SRCCC)
$(OBJ)\mondata.o  : $(SRC)\$(CB) $(HACK_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)\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)
	$(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)
	$(SRCCC)
$(OBJ)\polyself.o : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\potion.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\pray.o     : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\priest.o   : $(SRC)\$(CB) $(HACK_H) $(INCL)\mfndpos.h
	$(SRCCC)
$(OBJ)\quest.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\quest.h
	$(SRCCC)
$(OBJ)\questpgr.o : $(SRC)\$(CB) $(HACK_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)\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)\quest.h
	$(SRCCC)
$(OBJ)\shk.o      : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\shknam.o   : $(SRC)\$(CB) $(HACK_H)
	$(SRCCC)
$(OBJ)\sit.o      : $(SRC)\$(CB) $(HACK_H) $(INCL)\artifact.h
	$(SRCCC)
$(OBJ)\sounds.o   : $(SRC)\$(CB) $(HACK_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)\sys.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)
	$(SRCCC)
$(OBJ)\version.o  : $(SRC)\$(CB) $(HACK_H) $(INCL)\date.h $(INCL)\$(PATCHLEV).h
	$(SRCCC)
$(OBJ)\vision.o   : $(SRC)\$(CB) $(HACK_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)
	$(SRCCC)
$(OBJ)\worm.o     : $(SRC)\$(CB) $(HACK_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)

