#	SCCS Id: @(#)Makefile.os2	3.4.3	1996/10/29
#	OS/2 NetHack 3.4.1 Makefile for OS/2 versions 1.x and 2.x
#	Copyright (C) 1990, 1991, 1992, 1993, 1996 Timo Hakulinen
#
#	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).
#
#	Slash'EM version by Pekka Rousu (prousu@users.sourceforge.net).
#
#	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.
#
#	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.
#
#
#	"OMF" is short for "Object Module Format" and refers to the
#	standard OS/2 object format, which e.g. link386 uses.
#
#	"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.
#

format = omf
#format = a.out

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

#
#	Compiler and linker selection.
#

CC	= gcc
LINK	= gcc

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

#
#	Make syntax peculiarities.
#

MAKEB	= @dmake	# Executable name (change if necessary)
CMD	= @cmd /C	# Command processor name if required
AB	= $(@:B).c	# Base name of the target in target action
CB	= $$(@:B).c	#               - " -               dependent
BEG	= $(CMD) "	# Command line begin in shell one-liners
END	= "		#   - " -      end   - " -
SEP	= &		# Command separator  - " -
P	= %		# Literal percent sign

#
#	Most makes execute actions automatically inside a subshell,
#	which makes even the shell internals work ok. DMAKE wants it
#	spelled out for it.

ECHO	= $(CMD) echo
X11ECHO	= $(CMD) echo

#RM	= -$(CMD) del
#CP	= $(CMD) copy
#CAT	= $(CMD) type

RM	= -$(CMD) rm -f
CP	= $(CMD) cp
CAT	= $(CMD) cat

#
#	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	= \slashem

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

.IF $(with_x11) == yes
GAMEDIR  = \games\$(GAME)-x11	# Game directory
.ELSE
GAMEDIR  = \games\$(GAME)	# Game directory
.END

OBJ	 = \tmp\se_obj		# Object files
TEMP	 = \tmp\se_bin		# Temporary files during make process

DLBFILE	 = nhshare		# Platform independent data files
DLBFILE2 = nhushare		# Platform specific data files
MAN6DIR	 = $(GAMEDIR)		# Manual page section 6 directory (\man\man6)
PLIBP	 = c:\emx\lib		# Protected mode C libraries
RLIBP	 = c:\emx\lib		# Possible real mode C libraries
X11ROOT = c:\xfree86

#
#	The game name and description.
#

GAME	= slashem
GAMEDES = "SlashEM 0.0.7"

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

.IF $(with_x11) == yes
WINX11CFLAGS = -DX11_GRAPHICS -DUSE_XPM -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
WINX11VARDAT= x11tiles x11bigtiles pet_mark.xbm rip.xpm
.END

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

.IF $(debug) == yes
WARN	=-W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN # GCC
.ELSE
WARN	=-w
.END

#
#	GCC object format selection.
#

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

#
#	Prepare for a debugger.
#

.IF $(debug) == yes
CDFLAGS = -g		# GDB (GCC a.out)
LDFLAGS = -g		# - " -
.ELSE
CDFLAGS = -O -s
LDFLAGS = $(LFLAGS) -s
.END

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

STDC	=-ansi

#
#	Possible system object files required during linking.
#

SYSOBJ 	=

#
#	Compiler library selection.  Change if necessary.
#
#	GCC : extra GCC lib, C standard lib, extra GCC lib (again),
#	OS/2 API entry points.
#

PLIBS	=-lgcc -lc -lgcc -los2 $(X11LIBS)

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

GAMELN	= $(CC) $(LDFLAGS) -o $(GAMEFILE) @$(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)

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

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

.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
WINX11OBJ = $(WINX11OBJ01) $(WINX11OBJ02) $(WINX11OBJ03) $(WINX11OBJ04) $(WINX11OBJ05)\
 $(WINX11OBJ06) $(WINX11OBJ07) $(WINX11OBJ08) $(WINX11OBJ09) $(WINX11OBJ10) $(WINX11OBJ11)
.END

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.
#
#	Slash'EM requires DLB.
#

do_dlb : dlb_yup
#do_dlb : dlb_nope

#
#	man_msg = Do not copy man pages.
# 	copy_txt = copy preformatted man pages into GAMEDIR
# 	copy_man = copy man pages into MAN6DIR
#

do_man: man_msg
#do_man: copy_txt
#do_man: copy_man
#do_man: copy_txt copy_man

#
#	util_msg = Do not copy utils.
#	copy_utils = copies dlb.exe, lev_comp.exe and dgn_comp.exe
#	             into the GAMEDIR
#

do_utils: util_msg
#do_utils: copy_utils


######################################################################
#
#	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 license gypsy.txt $(GUIDEBOO).txt

SPEC_LEVS = \
 asmodeus.lev	baalz.lev	bigrm-1.lev	bigrm-2.lev	bigrm-3.lev \
 bigrm-4.lev	bigrm-5.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 \
 \
 soko1-3.lev	soko1-4.lev	soko2-3.lev	soko2-4.lev	soko2-5.lev \
 soko2-6.lev	soko2-7.lev	soko3-3.lev	soko3-4.lev	soko3-5.lev \
 soko3-6.lev	soko3-7.lev	soko4-3.lev	soko4-4.lev	soko4-5.lev \
 beholder.lev	blkmar.lev	cav2fill.lev	demogorg.lev	dispater.lev\
 dragons.lev	geryon.lev	grund-1.lev	grund-2.lev	grund-3.lev \
 guild.lev	frnknstn.lev	kobold-1.lev	kobold-2.lev	lich.lev    \
 mall.lev	mall-1.lev	mall-2.lev	medusa-3.lev	medusa-4.lev\
 mineking.lev	mtemple.lev	nightmar.lev	nymph.lev	rats.lev    \
 sea.lev 	spiders.lev	stor-1.lev	stor-2.lev	stor-3.lev  \
 tomb.lev	yeenoghu.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 \
 \
 Fla-goal.lev Fla-fila.lev Fla-filb.lev Fla-loca.lev Fla-strt.lev \
 Ice-goal.lev Ice-fila.lev Ice-filb.lev Ice-loca.lev Ice-strt.lev \
 Nec-goal.lev Nec-fila.lev Nec-filb.lev Nec-loca.lev Nec-strt.lev \
 Und-goal.lev Und-fila.lev Und-filb.lev Und-loca.lev Und-strt.lev \
 Yeo-goal.lev Yeo-fila.lev Yeo-filb.lev Yeo-loca.lev Yeo-strt.lev

VARDATD = data oracles options rumors

DATDLB = $(VARDATD) $(DATHELP)
DATDLB2 = dungeon quest.dat $(SPEC_LEVS) $(QUEST_LEVS)

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

VOBJ301 = $(OBJ)\borg.o
VOBJ302 = $(OBJ)\gypsy.o
VOBJ303 = $(OBJ)\tech.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)
VOBJ30 = $(VOBJ301) $(VOBJ302) $(VOBJ303)
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)  $(VOBJ30)
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 $(GAMEFILE) $(GUIDE) $(WINX11VARDAT) \
     	dat do_dlb do_man do_utils finish
	$(ECHO) Done building all targets.

#
#	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) : $(GAMEFILE)
$(GAMEFILE) : $(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) $(VOBJ301) >> $@
	$(ECHO) $(VOBJ302) >> $@
	$(ECHO) $(VOBJ303) >> $@
	$(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

#
#	Targets for makedefs.
#

makedefs : $(TEMP)\makedefs.exe
$(TEMP)\makedefs.exe : $(MAKEOBJS) $(TEMP)\$(MKDFDEF)
	$(MKDFLN)

$(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 : $(SPLEVOBJS) $(TEMP)\$(LEVCDEF)
	$(LEVCLN)

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

$(INCL)\lev_comp.h : $(UTIL)\lev_yacc.c
$(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 : $(DGNCOMPOBJS) $(TEMP)\$(DGNCDEF)
	$(DGNCLN)

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

$(INCL)\dgn_comp.h : $(UTIL)\dgn_yacc.c
$(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 : $(RECOVOBJS) $(TEMP)\$(RCVRDEF)
	$(RCVRLN)

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

#
#	Targets for the dlb.
#

dlb : $(TEMP)\dlb.exe
$(TEMP)\dlb.exe : $(DLBOBJS) $(TEMP)\$(DLBDEF)
	$(DLBRLN)

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

$(GAMEDIR)\$(DLBFILE):
	$(TEMP)\dlb.exe cCf $(TEMP) $(GAMEDIR)\$(DLBFILE) $(DATDLB)

$(GAMEDIR)\$(DLBFILE2): $(HACK_H)
	$(TEMP)\dlb.exe cCf $(TEMP) $(GAMEDIR)\$(DLBFILE2) $(DATDLB2)

dlb_yup : $(TEMP)\dlb.exe $(GAMEDIR)\$(DLBFILE) $(GAMEDIR)\$(DLBFILE2)

removedat:
	$(RM) $(DATDIR)\cmdhelp
	$(RM) $(DATDIR)\data
	$(RM) $(DATDIR)\dungeon
	$(RM) $(DATDIR)\help
	$(RM) $(DATDIR)\hh
	$(RM) $(DATDIR)\history
	$(RM) $(DATDIR)\opthelp
	$(RM) $(DATDIR)\options
	$(RM) $(DATDIR)\oracles
	$(RM) $(DATDIR)\quest.dat
	$(RM) $(DATDIR)\rumors
	$(RM) $(DATDIR)\wizhelp
	$(RM) $(DATDIR)\gypsy.txt\

	$(RM) $(DATDIR)\???-fil?.lev
	$(RM) $(DATDIR)\???-goal.lev
	$(RM) $(DATDIR)\???-loca.lev
	$(RM) $(DATDIR)\???-strt.lev
	$(RM) $(DATDIR)\air.lev
	$(RM) $(DATDIR)\asmodeus.lev
	$(RM) $(DATDIR)\astral.lev
	$(RM) $(DATDIR)\bigrm-?.lev
	$(RM) $(DATDIR)\castle.lev
	$(RM) $(DATDIR)\earth.lev
	$(RM) $(DATDIR)\fakewiz?.lev
	$(RM) $(DATDIR)\fire.lev
	$(RM) $(DATDIR)\guild.lev
	$(RM) $(DATDIR)\juiblex.lev
	$(RM) $(DATDIR)\knox.lev
	$(RM) $(DATDIR)\medusa-?.lev
	$(RM) $(DATDIR)\minefill.lev
	$(RM) $(DATDIR)\minend-?.lev
	$(RM) $(DATDIR)\minetn-?.lev
	$(RM) $(DATDIR)\oracle.lev
	$(RM) $(DATDIR)\orcus.lev
	$(RM) $(DATDIR)\sanctum.lev
	$(RM) $(DATDIR)\soko?-?.lev
	$(RM) $(DATDIR)\tower?.lev
	$(RM) $(DATDIR)\valley.lev
	$(RM) $(DATDIR)\water.lev
	$(RM) $(DATDIR)\wizard?.lev\

	$(RM) $(DATDIR)\baalz.lev
	$(RM) $(DATDIR)\beholder.lev
	$(RM) $(DATDIR)\blkmar.lev
	$(RM) $(DATDIR)\cav2fill.lev
	$(RM) $(DATDIR)\demogorg.lev
	$(RM) $(DATDIR)\dispater.lev
	$(RM) $(DATDIR)\dragons.lev
	$(RM) $(DATDIR)\frnknstn.lev
	$(RM) $(DATDIR)\geryon.lev
	$(RM) $(DATDIR)\grund-?.lev
	$(RM) $(DATDIR)\kobold-?.lev
	$(RM) $(DATDIR)\lich.lev
	$(RM) $(DATDIR)\mall-?.lev
	$(RM) $(DATDIR)\mall.lev
	$(RM) $(DATDIR)\mineking.lev
	$(RM) $(DATDIR)\mtemple.lev
	$(RM) $(DATDIR)\nightmar.lev
	$(RM) $(DATDIR)\nymph.lev
	$(RM) $(DATDIR)\rats.lev
	$(RM) $(DATDIR)\sea.lev
	$(RM) $(DATDIR)\spiders.lev
	$(RM) $(DATDIR)\stor-?.lev
	$(RM) $(DATDIR)\tomb.lev
	$(RM) $(DATDIR)\yeenoghu.lev

copydat:
	$(CP) $(TEMP)\cmdhelp		$(GAMEDIR)
	$(CP) $(TEMP)\data		$(GAMEDIR)
	$(CP) $(TEMP)\dungeon		$(GAMEDIR)
	$(CP) $(TEMP)\help		$(GAMEDIR)
	$(CP) $(TEMP)\hh		$(GAMEDIR)
	$(CP) $(TEMP)\history		$(GAMEDIR)
	$(CP) $(TEMP)\opthelp		$(GAMEDIR)
	$(CP) $(TEMP)\options		$(GAMEDIR)
	$(CP) $(TEMP)\oracles		$(GAMEDIR)
	$(CP) $(TEMP)\quest.dat 	$(GAMEDIR)
	$(CP) $(TEMP)\rumors		$(GAMEDIR)
	$(CP) $(TEMP)\wizhelp		$(GAMEDIR)
	$(CP) $(TEMP)\gypsy.txt 	$(GAMEDIR)\

	$(CP) $(TEMP)\???-fil?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\???-goal.lev	$(GAMEDIR)
	$(CP) $(TEMP)\???-loca.lev	$(GAMEDIR)
	$(CP) $(TEMP)\???-strt.lev	$(GAMEDIR)
	$(CP) $(TEMP)\air.lev		$(GAMEDIR)
	$(CP) $(TEMP)\asmodeus.lev	$(GAMEDIR)
	$(CP) $(TEMP)\astral.lev	$(GAMEDIR)
	$(CP) $(TEMP)\bigrm-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\castle.lev	$(GAMEDIR)
	$(CP) $(TEMP)\earth.lev 	$(GAMEDIR)
	$(CP) $(TEMP)\fakewiz?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\fire.lev		$(GAMEDIR)
	$(CP) $(TEMP)\guild.lev 	$(GAMEDIR)
	$(CP) $(TEMP)\juiblex.lev	$(GAMEDIR)
	$(CP) $(TEMP)\knox.lev		$(GAMEDIR)
	$(CP) $(TEMP)\medusa-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\minefill.lev	$(GAMEDIR)
	$(CP) $(TEMP)\minend-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\minetn-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\oracle.lev	$(GAMEDIR)
	$(CP) $(TEMP)\orcus.lev 	$(GAMEDIR)
	$(CP) $(TEMP)\sanctum.lev	$(GAMEDIR)
	$(CP) $(TEMP)\soko?-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\tower?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\valley.lev	$(GAMEDIR)
	$(CP) $(TEMP)\water.lev 	$(GAMEDIR)
	$(CP) $(TEMP)\wizard?.lev	$(GAMEDIR)\

	$(CP) $(TEMP)\baalz.lev 	$(GAMEDIR)
	$(CP) $(TEMP)\beholder.lev	$(GAMEDIR)
	$(CP) $(TEMP)\blkmar.lev	$(GAMEDIR)
	$(CP) $(TEMP)\cav2fill.lev	$(GAMEDIR)
	$(CP) $(TEMP)\demogorg.lev	$(GAMEDIR)
	$(CP) $(TEMP)\dispater.lev	$(GAMEDIR)
	$(CP) $(TEMP)\dragons.lev	$(GAMEDIR)
	$(CP) $(TEMP)\frnknstn.lev	$(GAMEDIR)
	$(CP) $(TEMP)\geryon.lev	$(GAMEDIR)
	$(CP) $(TEMP)\grund-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\kobold-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\lich.lev		$(GAMEDIR)
	$(CP) $(TEMP)\mall-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\mall.lev		$(GAMEDIR)
	$(CP) $(TEMP)\mineking.lev	$(GAMEDIR)
	$(CP) $(TEMP)\mtemple.lev	$(GAMEDIR)
	$(CP) $(TEMP)\nightmar.lev	$(GAMEDIR)
	$(CP) $(TEMP)\nymph.lev 	$(GAMEDIR)
	$(CP) $(TEMP)\rats.lev		$(GAMEDIR)
	$(CP) $(TEMP)\sea.lev		$(GAMEDIR)
	$(CP) $(TEMP)\spiders.lev	$(GAMEDIR)
	$(CP) $(TEMP)\stor-?.lev	$(GAMEDIR)
	$(CP) $(TEMP)\tomb.lev		$(GAMEDIR)
	$(CP) $(TEMP)\yeenoghu.lev	$(GAMEDIR)

dlb_nope :
	$(ECHO) DLB not requested.
	$(MAKEB) copydat
	$(RM) $(GAMEDIR)\$(DLBFILE) 
	$(RM) $(GAMEDIR)\$(DLBFILE2)

#
#	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 $(TEMP)
	$(RM) $(DAT)\options

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

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

$(INCL)\filename.h : $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -f

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

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

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

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

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

$(TEMP)\quest.dat : $(DAT)\quest.txt $(TEMP)\makedefs.exe
	$(TEMP)\makedefs -q
	$(CP) $(DAT)\quest.dat $(TEMP)
	$(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 $(TEMP)\dungeon $(TEMP)\data $(TEMP)\rumors \
	$(TEMP)\oracles $(TEMP)\quest.dat $(GAMEDIR)\$(GAME).ico \
	$(GAMEDIR)\$(GAME).cmd $(GAMEDIR)\$(GAME).cnf $(WINX11VARDAT)

help_fil : $(TEMP)\cmdhelp $(TEMP)\help $(TEMP)\hh $(TEMP)\history \
	$(TEMP)\license $(TEMP)\opthelp $(TEMP)\wizhelp $(TEMP)\gypsy.txt \
	$(TEMP)\$(GUIDEBOO).txt

$(TEMP)\cmdhelp : $(DAT)\cmdhelp
	$(CP) $(DAT)\cmdhelp $(TEMP)
$(TEMP)\help : $(DAT)\help
	$(CP) $(DAT)\help $(TEMP)
$(TEMP)\hh : $(DAT)\hh
	$(CP) $(DAT)\hh $(TEMP)
$(TEMP)\history : $(DAT)\history
	$(CP) $(DAT)\history $(TEMP)
$(TEMP)\license : $(DAT)\license
	$(CP) $(DAT)\license $(TEMP)
$(TEMP)\opthelp : $(DAT)\opthelp
	$(CP) $(DAT)\opthelp $(TEMP)
$(TEMP)\wizhelp : $(DAT)\wizhelp
	$(CP) $(DAT)\wizhelp $(TEMP)
$(TEMP)\gypsy.txt : $(DAT)\gypsy.txt
	$(CP) $(DAT)\gypsy.txt $(TEMP)
$(TEMP)\$(GUIDEBOO).txt: $(DOC)\$(GUIDEBOO).txt
	$(CP) $(DOC)\$(GUIDEBOO).txt $(TEMP)

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

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

FFILES = $(TEMP)\Fla-goal.lev
IFILES = $(TEMP)\Ice-goal.lev
NFILES = $(TEMP)\Nec-goal.lev
UFILES = $(TEMP)\Und-goal.lev
YFILES = $(TEMP)\Yeo-goal.lev

XFILES = $(AFILES) $(BFILES) $(CFILES) $(HFILES) $(KFILES) $(MFILES) \
	 $(PFILES) $(RANFILES) $(RFILES) $(SFILES) $(TFILES) $(VFILES) $(WFILES) \
	 $(FFILES) $(IFILES) $(NFILES) $(UFILES) $(YFILES)

spec_lev :\
 $(TEMP)\astral.lev	\
 $(TEMP)\bigrm-1.lev	\
 $(TEMP)\castle.lev	\
 $(TEMP)\knox.lev	\
 $(TEMP)\medusa-1.lev	\
 $(TEMP)\minefill.lev	\
 $(TEMP)\oracle.lev	\
 $(TEMP)\soko1-1.lev	\
 $(TEMP)\tower1.lev	\
 $(TEMP)\valley.lev	\
 $(TEMP)\wizard1.lev	\
\
 $(TEMP)\beholder.lev	\
 $(TEMP)\blkmar.lev	\
 $(TEMP)\cav2fill.lev	\
 $(TEMP)\dragons.lev	\
 $(TEMP)\frnknstn.lev	\
 $(TEMP)\guild.lev	\
 $(TEMP)\grund-1.lev	\
 $(TEMP)\kobold-1.lev	\
 $(TEMP)\kobold-2.lev	\
 $(TEMP)\lich.lev	\
 $(TEMP)\mall.lev	\
 $(TEMP)\mall-1.lev	\
 $(TEMP)\mall-2.lev	\
 $(TEMP)\mtemple.lev	\
 $(TEMP)\nightmar.lev	\
 $(TEMP)\nymph.lev	\
 $(TEMP)\rats.lev	\
 $(TEMP)\sea.lev 	\
 $(TEMP)\spiders.lev	\
 $(TEMP)\stor-1.lev	\
 $(TEMP)\stor-2.lev	\
 $(TEMP)\stor-3.lev	\
 $(TEMP)\tomb.lev	\
 $(XFILES)

#	Single special level files

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

$(TEMP)\beholder.lev : $(DAT)\beholder.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=beholder do_slev
$(TEMP)\blkmar.lev : $(DAT)\blkmar.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=blkmar do_slev
$(TEMP)\dragons.lev : $(DAT)\dragons.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=dragons do_slev
$(TEMP)\frnknstn.lev : $(DAT)\frnknstn.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=frnknstn do_slev
$(TEMP)\guild.lev : $(DAT)\guild.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=guild do_slev
$(TEMP)\kobold-1.lev : $(DAT)\kobold-1.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=kobold-1 do_slev
$(TEMP)\kobold-2.lev : $(DAT)\kobold-2.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=kobold-2 do_slev
$(TEMP)\lich.lev : $(DAT)\lich.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=lich do_slev
$(TEMP)\mall-1.lev : $(DAT)\mall-1.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=mall-1 do_slev
$(TEMP)\mall-2.lev : $(DAT)\mall-2.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=mall-2 do_slev
$(TEMP)\mtemple.lev : $(DAT)\mtemple.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=mtemple do_slev
$(TEMP)\nightmar.lev : $(DAT)\nightmar.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=nightmar do_slev
$(TEMP)\nymph.lev : $(DAT)\nymph.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=nymph do_slev
$(TEMP)\rats.lev : $(DAT)\rats.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=rats do_slev
$(TEMP)\sea.lev : $(DAT)\sea.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=sea do_slev
$(TEMP)\spiders.lev : $(DAT)\spiders.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=spiders do_slev
$(TEMP)\stor-1.lev : $(DAT)\stor-1.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=stor-1 do_slev
$(TEMP)\stor-2.lev : $(DAT)\stor-2.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=stor-2 do_slev
$(TEMP)\stor-3.lev : $(DAT)\stor-3.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=stor-3 do_slev
$(TEMP)\tomb.lev : $(DAT)\tomb.des $(TEMP)\lev_comp.exe
	$(MAKEB) LF=tomb do_slev

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

#	Multiple special level files

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

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

$(TEMP)\cav2fill.lev : $(DAT)\giants.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\giants.des
	$(CP) cav2fill.lev $(TEMP)
	$(RM) cav2fill.lev

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

$(TEMP)\mall.lev : $(DAT)\newmall.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\newmall.des
	$(CP) mall.lev $(TEMP)
	$(RM) mall.lev

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

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

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

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

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

$(TEMP)\soko1-1.lev : $(DAT)\sokoban.des $(TEMP)\lev_comp.exe
	$(TEMP)\lev_comp $(DAT)\sokoban.des
	$(CP) soko?-?.lev $(TEMP)
	$(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

$(FFILES) : $(DAT)\Flame.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Fla QF=Flame do_quest
$(IFILES) : $(DAT)\Ice.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Ice QF=Ice do_quest
$(NFILES) : $(DAT)\Necro.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Nec QF=Necro do_quest
$(UFILES) : $(DAT)\Slayer.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Und QF=Slayer do_quest
$(YFILES) : $(DAT)\Yeoman.des $(TEMP)\lev_comp.exe
	$(MAKEB) QQ=Yeo QF=Yeoman do_quest

do_quest :
	$(TEMP)\lev_comp $(DAT)\$(QF).des
	$(CP) $(QQ)-fil?.lev $(TEMP)
	$(CP) $(QQ)-goal.lev $(TEMP)
	$(CP) $(QQ)-loca.lev $(TEMP)
	$(CP) $(QQ)-strt.lev $(TEMP)
	$(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)\$(GAME).cnf :
	$(CP) $(SSYS)\nethack.cnf $(GAMEDIR)\$(GAME).cnf

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

#
# 	Manual pages. 
#

copy_txt:
	$(CP) $(DOC)\$(GAME).txt $(GAMEDIR)
	$(CP) $(DOC)\recover.txt $(GAMEDIR)
	$(CP) $(DOC)\lev_comp.txt $(GAMEDIR)
	$(CP) $(DOC)\dgn_comp.txt $(GAMEDIR)
	$(CP) $(DOC)\dlb.txt $(GAMEDIR)

copy_man:
	$(CP) $(DOC)\$(GAME).6 $(MAN6DIR)
	$(CP) $(DOC)\recover.6 $(MAN6DIR)
	$(CP) $(DOC)\lev_comp.6 $(MAN6DIR)
	$(CP) $(DOC)\dgn_comp.6 $(MAN6DIR)
	$(CP) $(DOC)\dlb.6 $(MAN6DIR)

man_msg:
	$(ECHO) Manual pages not copied. Copy manually if required.

#
#	Utilities.
#

copy_utils: $(GAMEDIR)\lev_comp.exe $(GAMEDIR)\dgn_comp.exe $(GAMEDIR)\dlb.exe  

util_msg:
	$(ECHO) Utils not copied. Copy manually if required.

#
#	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) $(INCL)\filename.h
	$(RM) $(INCL)\tile.h
	$(RM) $(INCL)\dgn_comp.h
	$(RM) $(INCL)\lev_comp.h
	$(RM) vis_tab.c
	$(RM) monstr.c
	$(RM) tile.c
	$(RM) *.lev
	$(RM) nethack.ico
	$(RM) $(UTIL)\???_lex.c
	$(RM) $(UTIL)\???_yacc.c
	$(RM) $(UTIL)\???_comp.h
	$(RM) $(TEMP)\makedefs.exe
	$(RM) $(TEMP)\lev_comp.exe
	$(RM) $(TEMP)\dgn_comp.exe
	$(RM) $(TEMP)\dlb.exe
	$(RM) $(TEMP)\bigtile.exe
	$(RM) $(TEMP)\magtile.exe
	$(RM) $(TEMP)\txtbg.exe
	$(RM) $(TEMP)\txtmerge.exe
	$(RM) $(TEMP)\*.def
	$(RM) $(TEMP)\*.map
	$(RM) $(TEMP)\tile2x11.exe
	$(RM) $(TEMP)\tilemap.exe
	$(RM) $(TEMP)\$(GAME).r
	$(RM) $(TEMP)\$(GUIDEBOO).dvi
	$(RM) $(TEMP)\$(GUIDEBOO).aux
	$(RM) $(TEMP)\$(GUIDEBOO).log
	$(RM) $(TEMP)\$(GUIDEBOO).txt
	$(RM) $(TEMP)\license
	$(MAKEB) DATDIR=$(TEMP) removedat
	$(RM) x11*tiles*
	$(RM) $(WINSHARE)\???3?-t.txt
	$(RM) $(WINSHARE)\???3?.txt
	$(RM) $(WINSHARE)\???big.txt
	$(RM) $(WINSHARE)\???mag.txt


uninstall:
	$(RM) $(GAMEFILE)
	$(RM) $(GAMEDIR)\$(GAME).ico
	$(RM) $(GAMEDIR)\$(GAME).cmd
	$(RM) $(GAMEDIR)\$(DLBFILE)
	$(RM) $(GAMEDIR)\$(DLBFILE2)
	$(MAKEB) DATDIR=$(GAMEDIR) removedat
	$(RM) $(GAMEDIR)\license
	$(RM) $(GAMEDIR)\$(GUIDEBOO).txt
	$(RM) $(GAMEDIR)\recover.exe
	$(RM) $(GAMEDIR)\makedefs.exe
	$(RM) $(GAMEDIR)\lev_comp.exe
	$(RM) $(GAMEDIR)\dgn_comp.exe
	$(RM) $(GAMEDIR)\dlb.exe
	$(RM) $(GAMEDIR)\$(GAME).txt
	$(RM) $(GAMEDIR)\recover.txt
	$(RM) $(GAMEDIR)\dlb.txt
	$(RM) $(GAMEDIR)\lev_comp.txt
	$(RM) $(GAMEDIR)\dgn_comp.txt
	$(RM) $(MAN6DIR)\slashem.6
	$(RM) $(MAN6DIR)\recover.6
	$(RM) $(MAN6DIR)\dlb.6
	$(RM) $(MAN6DIR)\lev_comp.6
	$(RM) $(MAN6DIR)\dgn_comp.6
	$(RM) $(GAMEDIR)\readme.txt
	$(RM) $(GAMEDIR)\slamfaq.txt
	$(RM) $(GAMEDIR)\history.txt
	$(RM) $(GAMEDIR)\x11*tiles*
	$(RM) $(GAMEDIR)\pet_mark.xbm
	$(RM) $(GAMEDIR)\rip.xpm

finish: $(GAMEDIR)\$(GUIDEBOO).txt
	$(CP) $(DAT)\license $(GAMEDIR)\LICENSE
	$(CP) $(NHSRC)\readme.txt $(GAMEDIR)
	$(CP) $(NHSRC)\slamfaq.txt $(GAMEDIR)
	$(CP) $(NHSRC)\history.txt $(GAMEDIR)
.IF $(with_x11) == yes
	$(CP) x11tiles $(GAMEDIR)
	$(CP) x11bigtiles $(GAMEDIR)
	$(CP) $(WINX11)\$(GAME).ad $(GAMEDIR)
	$(CP) $(WINX11)\$(GAME).rc $(GAMEDIR)
.END

$(GAMEDIR)\$(GUIDEBOO).txt : $(TEMP)\$(GUIDEBOO).txt
	$(CP) $(TEMP)\$(GUIDEBOO).txt $(GAMEDIR)
$(GAMEDIR)\dgn_comp.exe : $(TEMP)\dgn_comp.exe
	$(CP) $(TEMP)\dgn_comp.exe  $(GAMEDIR)
$(GAMEDIR)\lev_comp.exe : $(TEMP)\lev_comp.exe
	$(CP) $(TEMP)\lev_comp.exe  $(GAMEDIR)
$(GAMEDIR)\dlb.exe : $(TEMP)\dlb.exe
	$(CP) $(TEMP)\dlb.exe $(GAMEDIR)

#
#	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) $(INCL)\filename.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)\borg.o     : $(SRC)\$(CB) $(HACK_H) $(INCL)\func_tab.h
	$(SRCCC)
$(OBJ)\gypsy.o     : $(SRC)\$(CB) $(HACK_H) $(INCL)\egyp.h $(INCL)\qtext.h
	$(SRCCC)
$(OBJ)\tech.o    : $(SRC)\$(CB) $(HACK_H) $(INCL)\tech.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

$(INCL)\tile.h: $(TEMP)\tilemap.exe

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

$(TEMP)\txtbg.exe: $(WINSHARE)\txtbg.c $(HACK_H) $(INCL)\tile.h $(TEXT_IO)
	$(CC) $(GCCO) $(WARN) -I$(INCL) $(CDFLAGS) $(STDC) $(WINX11CFLAGS) $(LFLAGS) \
 -o $(TEMP)\txtbg.exe $(WINSHARE)\txtbg.c $(TEXT_IO) $(LIBS)

$(TEMP)\txtmerge.exe: $(WINSHARE)\txtmerge.c $(CONFIG_H) $(INCL)\tile.h $(TEXT_IO)
	$(CC) $(GCCO) $(WARN) -I$(INCL) $(CDFLAGS) $(STDC) $(WINX11CFLAGS) $(LFLAGS) \
 -o $(TEMP)\txtmerge.exe $(WINSHARE)\txtmerge.c $(TEXT_IO) $(LIBS)

$(TEMP)\magtile.exe: $(WINSHARE)\magtile.c $(CONFIG_H) $(INCL)\tile.h $(TEXT_IO)
	$(CC) $(GCCO) $(WARN) -I$(INCL) $(CDFLAGS) $(STDC) $(WINX11CFLAGS) $(LFLAGS) \
 -o $(TEMP)\magtile.exe $(WINSHARE)\magtile.c $(TEXT_IO) $(LIBS)

$(TEMP)\bigtile.exe: $(WINSHARE)\bigtile.c $(CONFIG_H) $(INCL)\tile.h $(TEXT_IO)
	$(CC) $(GCCO) $(WARN) -I$(INCL) $(CDFLAGS) $(STDC) $(WINX11CFLAGS) $(LFLAGS) \
 -o $(TEMP)\bigtile.exe $(WINSHARE)\bigtile.c $(TEXT_IO) $(LIBS)

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

x11bigtiles: $(TEMP)\tile2x11.exe $(WINSHARE)\mon32.txt $(WINSHARE)\obj32.txt $(WINSHARE)\oth32.txt
	$(TEMP)\tile2x11.exe -o x11bigtiles $(WINSHARE)\mon32.txt $(WINSHARE)\obj32.txt $(WINSHARE)\oth32.txt

x11big3dtiles: $(TEMP)\tile2x11.exe $(WINSHARE)\mon3d.txt $(WINSHARE)\obj3d.txt $(WINSHARE)\oth3d.txt
	$(TEMP)\tile2x11.exe -o x11big3dtiles $(WINSHARE)\mon3d.txt $(WINSHARE)\obj3d.txt $(WINSHARE)\oth3d.txt


$(OBJ)\tiletext.o: $(WINSHARE)\tiletext.c $(CONFIG_H) $(INCL)\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)

$(WINSHARE)\mon32.txt:	$(TEMP)\txtbg.exe $(WINSHARE)\mon32-t.txt
	$(TEMP)\txtbg $(WINSHARE)\mon32-t.txt $(WINSHARE)\mon32.txt

$(WINSHARE)\obj32.txt:	$(TEMP)\txtbg.exe $(WINSHARE)\obj32-t.txt
	$(TEMP)\txtbg.exe $(WINSHARE)\obj32-t.txt $(WINSHARE)\obj32.txt

$(WINSHARE)\oth32.txt:	$(TEMP)\txtbg.exe $(WINSHARE)\oth32-t.txt
	$(TEMP)\txtbg.exe $(WINSHARE)\oth32-t.txt $(WINSHARE)\oth32.txt

$(WINSHARE)\mon32-t.txt:	$(TEMP)\txtmerge.exe $(WINSHARE)\monmag.txt \
 $(WINSHARE)\mon32mi.txt $(WINSHARE)\mon32alg.txt $(WINSHARE)\mon32aw.txt \
 $(WINSHARE)\mon32se.txt $(WINSHARE)\palette.txt
	$(TEMP)\txtmerge.exe -p $(WINSHARE)\palette.txt \
 $(WINSHARE)\mon32-t.txt $(WINSHARE)\monmag.txt -b $(WINSHARE)\mon32mi.txt \
 -b $(WINSHARE)\mon32se.txt -bff00ff $(WINSHARE)\mon32alg.txt \
 -bff00ff $(WINSHARE)\mon32aw.txt

$(WINSHARE)\obj32-t.txt:	$(TEMP)\txtmerge.exe $(WINSHARE)\objmag.txt \
 $(WINSHARE)\obj32mi.txt $(WINSHARE)\obj32se.txt $(WINSHARE)\obj32alg.txt \
 $(WINSHARE)\palette.txt
	$(TEMP)\txtmerge.exe -p $(WINSHARE)\palette.txt \
 $(WINSHARE)\obj32-t.txt $(WINSHARE)\objmag.txt -b $(WINSHARE)\obj32mi.txt \
 -b $(WINSHARE)\obj32se.txt -bff00ff $(WINSHARE)\obj32alg.txt

$(WINSHARE)\oth32-t.txt:	$(TEMP)\txtmerge.exe $(WINSHARE)\othmag.txt \
 $(WINSHARE)\oth32mi.txt $(WINSHARE)\oth32se.txt $(WINSHARE)\oth32alg.txt \
 $(WINSHARE)\palette.txt
	$(TEMP)\txtmerge.exe -p $(WINSHARE)\palette.txt \
 $(WINSHARE)\oth32-t.txt $(WINSHARE)\othmag.txt -b $(WINSHARE)\oth32mi.txt \
 -b $(WINSHARE)\oth32se.txt -bff00ff $(WINSHARE)\oth32alg.txt

$(WINSHARE)\monmag.txt: $(TEMP)\magtile.exe $(WINSHARE)\monsters.txt
	$(TEMP)\magtile.exe

$(WINSHARE)\objmag.txt: $(TEMP)\magtile.exe $(WINSHARE)\objects.txt
	$(TEMP)\magtile.exe

$(WINSHARE)\othmag.txt: $(TEMP)\magtile.exe $(WINSHARE)\other.txt
	$(TEMP)\magtile.exe

$(WINSHARE)\mon3d.txt:	$(TEMP)\txtmerge.exe $(WINSHARE)\monbig.txt \
 $(WINSHARE)\mon3dmi.txt $(WINSHARE)\palette.txt
	$(TEMP)\txtmerge.exe -p $(WINSHARE)\palette.txt $(WINSHARE)\mon3d.txt \
 $(WINSHARE)\monbig.txt -b $(WINSHARE)\mon3dmi.txt

$(WINSHARE)\obj3d.txt:	$(TEMP)\txtmerge.exe $(WINSHARE)\objbig.txt
	cp $(WINSHARE)\objbig.txt $(WINSHARE)\obj3d.txt

$(WINSHARE)\oth3d.txt:	$(TEMP)\txtmerge.exe $(WINSHARE)\othbig.txt \
 $(WINSHARE)\oth3dmi.txt $(WINSHARE)\oth-2kmi.txt $(WINSHARE)\oth3dse.txt \
 $(WINSHARE)\palette.txt
	$(TEMP)\txtmerge.exe -p $(WINSHARE)\palette.txt $(WINSHARE)\oth3d.txt \
 $(WINSHARE)\othbig.txt -b $(WINSHARE)\oth3dmi.txt -b $(WINSHARE)\oth-2kmi.txt \
 -b $(WINSHARE)\oth3dse.txt

$(WINSHARE)\monbig.txt: $(TEMP)\bigtile.exe $(WINSHARE)\mon32-t.txt \
 $(WINSHARE)\obj32-t.txt $(WINSHARE)\oth32-t.txt
	$(TEMP)\bigtile.exe

$(WINSHARE)\objbig.txt: $(TEMP)\bigtile.exe $(WINSHARE)\mon32-t.txt \
 $(WINSHARE)\obj32-t.txt $(WINSHARE)\oth32-t.txt
	$(TEMP)\bigtile.exe

$(WINSHARE)\othbig.txt: $(TEMP)\bigtile.exe $(WINSHARE)\mon32-t.txt \
$(WINSHARE)\obj32-t.txt $(WINSHARE)\oth32-t.txt
	$(TEMP)\bigtile.exe

