#       SCCS Id: @(#)Makefile.nt       3.3     2000/08/01
#       Copyright (c) NetHack PC Development Team 1993-2000
#
#       Slash'EM modifications by Lars Huttar and J. Ali Harlow.
#
#       Slash'EM 0.0.7 Makefile for MS Visual C++ V4.x and above and MS NMAKE
#  
#       Win32 Compilers Tested (with NetHack 3.3):
#                              - Microsoft 32 bit Visual C++ V4.x
#                              - Microsoft 32 bit Visual C++ V6.0 SP3, SP4
#
#	This is used for building a TTY version of Slash'EM using WIN32 Console
#	I/O routines only. It should be possible to build the GTK interface
#	using Microsoft C, but nobody has done this yet. See Makefile.gcc for
#	a starting point if you want to try this.
#
#       In addition to your C compiler,
#
#       if you want to change           you will need a
#       files with suffix               workalike for
#              .y                           yacc   (such as bison)
#              .l                           lex    (such as flex)
#
#
#       If you have any questions read the Install.nt file included with
#       the distribution.
#
#       Michael Allison
#
#----------------------------------------------------------------------
# Do not delete the following 3 lines.
#
TARGETOS=BOTH
APPVER=4.0
!include <win32.mak>

#
#  Set the gamedir according to your preference.  It must be present prior
#  to compilation.

GAME    = slashem                # Game Name
GAMEDIR = d:\downloads\slashem\custbld      # Game directory

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

INCL  = ..\include   # NetHack include files
DAT   = ..\dat       # NetHack data files
DOC   = ..\doc       # NetHack documentation files
UTIL  = ..\util      # Utility source
SRC   = ..\src       # Main source
SSYS  = ..\sys\share # Shared system files
NTSYS = ..\sys\winnt # NT Win32 specific files
TTY   = ..\win\tty   # window port files (tty)
WIN32 = ..\win\win32 # window port files (Win32)
WSHR  = ..\win\share # Tile support files 

#
#  Object directory.
#

OBJ     = o


#
# Exe File Info.
# ($(MAKE) macro is often predefined, so we use $(MAKEBIN) instead.)
#

MAKEBIN = nmake

# 
# Yacc/Lex ... if you got 'em.
#
# If you have yacc and lex programs (or work-alike such as bison 
# and flex), comment out the upper two macros and uncomment 
# the lower two.
#

DO_YACC = YACC_MSG
DO_LEX  = LEX_MSG
#DO_YACC  = YACC_ACT
#DO_LEX   = LEX_ACT

#
# - Specify your yacc and lex programs (or work-alikes) here.
#

#YACC	= bison -y
YACC   = byacc
#YACC	= yacc

#LEX	= lex
LEX	= flex

#
# - Specify your flex skeleton file (if needed).
#

FLEXSKEL =
#FLEXSKEL = -S../tools/flex.ske

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

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

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

#
# - For debugging ability, comment out the upper two 
#   macros and uncomment the lower two.
#

#
#  Leave the next two lines uncommented _ONLY_ if you do NOT want any
#  debug capability in the object files, or in the NetHack executable.
#  Comment them if you want debug capability.

#cdebug =
#linkdebug =

#
# Compiler and Linker flags
#

PRECOMPHEAD = N			# set to Y if you want to use precomp. headers


########################################################################
########################################################################
#
# Nothing below this line should have to be changed.
#

RESFILE = $(GAME).res

#Do not uncomment these for 0.0.7
#TILEGAME  = $(OBJ)\tile.o
#TILEDEF   = -DTILES
#TILEHDR   =
#SOUND = $(OBJ)\ntsound.o

#SOUND =
#TILEUTIL  =
#TILEBMP   =
#TILEGAME  =
#TILEDEF   =   
#TILEHDR   =

#
# Uncomment the line below if you want to store all the level files,
# help files, etc. in a single library file.

USE_DLB = Y

! IF ("$(USE_DLB)"=="Y")
DLBFLG = -DDLB
! ELSE
DLBFLG =
! ENDIF

# You can actually build a set of tiles with this makefile
# even though they are not used. 
# Use 'nmake o\nhtiles.bmp'
#
TILEUTIL  = $(UTIL)\tile2bmp.exe
TILEBMP   = $(OBJ)\nhtiles.bmp

#
# - Util builds
#

CFLAGSU	= -c $(cflags) $(cvars) -I$(INCL) -nologo $(cdebug) \
		$(TILEDEF) $(DLBFLG)
LFLAGSU	= $(linkdebug) $(conflags)

#
# - Game build
#
#

CFLAGSG	= $(CFLAGSU)
#LFLAGSG	= $(guiflags) $(linkdebug) -IGNORE:505 $(guilibs) comct132.lib
LFLAGSG	= $(conflags) $(linkdebug) -IGNORE:505 $(conlibs) comct132.lib

GAMEFILE = $(GAMEDIR)\$(GAME).exe # whole thing

#  This line should not be deleted.
NTSUB = -DWIN32CON

! IF ("$(USE_DLB)"=="Y")
DLB = $(DAT)\nhshare $(DAT)\nhushare
! ELSE
DLB =
! ENDIF

#
#  Make Rules.
#

.SUFFIXES: .exe .o .til .uu .c .y .l

#
# Rules for files in src
#


.c{$(OBJ)}.o:
	@$(cc) $(CFLAGSG)  $(NTSUB) -Fo$@ $<

{$(SRC)}.c{$(OBJ)}.o:
	@$(cc) $(CFLAGSG)  $(NTSUB)  -Fo$@  $<

#
# Rules for files in sys\share
#

{$(SSYS)}.c{$(OBJ)}.o:
	@$(cc) $(CFLAGSG)  -Fo$@  $<

#
# Rules for files in sys\winnt
#

{$(NTSYS)}.c{$(OBJ)}.o:
	@$(cc) $(CFLAGSG)  -Fo$@  $<

{$(NTSYS)}.h{$(INCL)}.h:
	@copy $< $@

#
# Rules for files in util
#

{$(UTIL)}.c{$(OBJ)}.o:
	@$(cc) $(CFLAGSU) $(NTSUB) -Fo$@ $<

#
# Rules for files in win\share
#

{$(WSHR)}.c{$(OBJ)}.o:
	@$(cc) $(CFLAGSG)  -Fo$@ $<

{$(WSHR)}.h{$(INCL)}.h:
	@copy $< $@

#{$(WSHR)}.txt{$(DAT)}.txt:
#	@copy $< $@


#
# Rules for files in win\tty
#

{$(TTY)}.c{$(OBJ)}.o:
	@$(cc) $(CFLAGSG)  -Fo$@  $<

#
# Rules for files in win\win32
#

{$(WIN32)}.c{$(OBJ)}.o:
	@$(cc) $(CFLAGSG) -Fo$@  $<


#
# NETHACK OBJECTS
# 
# This section creates shorthand macros for many objects
# referenced later on in the Makefile.
#


DEFFILE = $(NTSYS)\$(GAME).def

#
# Shorten up the location for some files
#

O  = $(OBJ)^\

U  = $(UTIL)^\

W  = $(WIN32)^\

#
# Utility Objects.
#

MAKESRC        = $(U)makedefs.c

SPLEVSRC       = $(U)lev_yacc.c	$(U)lev_$(LEX).c $(U)lev_main.c  $(U)panic.c

DGNCOMPSRC     = $(U)dgn_yacc.c	$(U)dgn_$(LEX).c $(U)dgn_main.c

MAKEOBJS       = $(O)makedefs.o $(O)monst.o $(O)objects.o

SPLEVOBJS      = $(O)lev_yacc.o	$(O)lev_$(LEX).o $(O)lev_main.o \
		 $(O)alloc.o	$(O)decl.o	$(O)drawing.o \
		 $(O)monst.o	$(O)objects.o	$(O)panic.o

DGNCOMPOBJS    = $(O)dgn_yacc.o	$(O)dgn_$(LEX).o $(O)dgn_main.o \
		 $(O)alloc.o	$(O)panic.o

RECOVOBJS      = $(O)recover.o

#
# These are not invoked during a normal game build in 3.3.0
#
TEXT_IO        = $(O)tiletext.o	$(O)tiletxt.o	$(O)drawing.o \
		 $(O)decl.o	$(O)monst.o	$(O)objects.o

GIFREADERS     = $(O)gifread.o	$(O)alloc.o $(O)panic.o

PPMWRITERS     = $(O)ppmwrite.o $(O)alloc.o $(O)panic.o

TILEFILES      = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt

#
#  Object files for the game itself.
#

VOBJ01 = $(O)allmain.o  $(O)alloc.o    $(O)apply.o    $(O)artifact.o
VOBJ02 = $(O)attrib.o   $(O)ball.o     $(O)bones.o    $(O)botl.o    
VOBJ03 = $(O)cmd.o      $(O)dbridge.o  $(O)decl.o     $(O)detect.o  
VOBJ04 = $(O)dig.o      $(O)display.o  $(O)do.o       $(O)do_name.o 
VOBJ05 = $(O)do_wear.o  $(O)dog.o      $(O)dogmove.o  $(O)dokick.o  
VOBJ06 = $(O)dothrow.o  $(O)drawing.o  $(O)dungeon.o  $(O)eat.o     
VOBJ07 = $(O)end.o      $(O)engrave.o  $(O)exper.o    $(O)explode.o 
VOBJ08 = $(O)extralev.o $(O)files.o    $(O)fountain.o $(O)hack.o    
VOBJ09 = $(O)hacklib.o  $(O)invent.o   $(O)light.o    $(O)lock.o    
VOBJ10 = $(O)mail.o     $(O)main.o     $(O)makemon.o  $(O)mcastu.o  
VOBJ11 = $(O)mhitm.o    $(O)mhitu.o    $(O)minion.o   $(O)mklev.o   
VOBJ12 = $(O)mkmap.o    $(O)mkmaze.o   $(O)mkobj.o    $(O)mkroom.o  
VOBJ13 = $(O)mon.o      $(O)mondata.o  $(O)monmove.o  $(O)monst.o   
VOBJ14 = $(O)monstr.o   $(O)mplayer.o  $(O)mthrowu.o  $(O)muse.o    
VOBJ15 = $(O)music.o    $(O)o_init.o   $(O)objects.o  $(O)objnam.o  
VOBJ16 = $(O)options.o  $(O)pager.o    $(O)pickup.o   $(O)pline.o   
VOBJ17 = $(O)polyself.o $(O)potion.o   $(O)pray.o     $(O)priest.o  
VOBJ18 = $(O)quest.o    $(O)questpgr.o $(RANDOM)      $(O)read.o    
VOBJ19 = $(O)rect.o     $(O)region.o   $(O)restore.o  $(O)rip.o     
VOBJ20 = $(O)rnd.o      $(O)role.o     $(O)rumors.o   $(O)save.o    
VOBJ21 = $(O)shk.o      $(O)shknam.o   $(O)sit.o      $(O)sounds.o  
VOBJ22 = $(O)sp_lev.o   $(O)spell.o    $(O)steal.o    $(O)steed.o   
VOBJ23 = $(O)teleport.o $(O)timeout.o  $(O)topten.o   $(O)track.o   
VOBJ24 = $(O)trap.o     $(O)u_init.o   $(O)uhitm.o    $(O)vault.o   
VOBJ25 = $(O)vis_tab.o  $(O)vision.o   $(O)weapon.o   $(O)were.o    
VOBJ26 = $(O)wield.o    $(O)windows.o  $(O)wizard.o   $(O)worm.o    
VOBJ27 = $(O)worn.o     $(O)write.o    $(O)zap.o     
VOBJ28 = $(O)gypsy.o    $(O)tech.o

DLBOBJ = $(O)dlb.o

TTYOBJ = $(O)topl.o     $(O)getline.o  $(O)wintty.o

#WOBJ   = $(O)nhprocs.o  $(O)winmain.o  $(O)win32msg.o
WOBJ   =

SOBJ   = $(O)winnt.o    $(O)sys.o      $(O)nttty.o    $(O)unix.o  \
	   $(SOUND) 	$(O)mapimail.o $(O)nhlan.o

OBJS   = $(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) $(DLBOBJ)

TILOBJ = $(TILEGAME)

VVOBJ  = $(O)version.o

ALLOBJ  = $(TILOBJ) $(SOBJ) $(DLBOBJ)  $(TTYOBJ) $(WOBJ) $(OBJS) $(VVOBJ)

#
# Header objects
#

#NTCONF_H    = $(INCL)\ntwarn.h $(INCL)\ntconf.h $(INCL)\micro.h \
NTCONF_H    = $(INCL)\ntconf.h $(INCL)\micro.h \
	      $(INCL)\system.h $(INCL)\config.h
PERMONST_H  = $(INCL)\monattk.h $(INCL)\monflag.h
YOUPROP_H   = $(INCL)\prop.h $(PERMONST_H) $(INCL)\pm.h
YOU_H       = $(INCL)\attrib.h $(INCL)\monst.h $(YOUPROP_H)
DECL_H      = $(INCL)\quest.h $(INCL)\spell.h $(INCL)\color.h \
              $(INCL)\obj.h $(YOU_H) $(INCL)\onames.h

CONFIG_H    = $(INCL)\tradstdc.h $(INCL)\coord.h $(NTCONF_H)

HACK_H      = $(CONFIG_H) $(INCL)\dungeon.h $(INCL)\align.h $(INCL)\monsym.h \
              $(INCL)\mkroom.h $(INCL)\objclass.h $(DECL_H) $(INCL)\trap.h \
              $(INCL)\flag.h $(INCL)\rm.h $(INCL)\vision.h $(INCL)\mondata.h \
              $(INCL)\wintype.h $(INCL)\engrave.h $(INCL)\rect.h \
              $(INCL)\winprocs.h $(INCL)\trampoli.h \
              $(INCL)\align.h 
TILE_H      = ..\win\share\tile.h $(TILEHDR)
ALIGN_H     = $(INCL)\align.h
ARTIFACT_H  = $(INCL)\artifact.h
ARTILIST_H  = $(INCL)\artilist.h
COLOR_H     = $(INCL)\color.h
DATE_H      = $(INCL)\date.h
DLB_H       = $(INCL)\dlb.h
DGN_FILE_H  = $(INCL)\dgn_file.h
EGYP_H      = $(INCL)\egyp.h
EMIN_H      = $(INCL)\emin.h
EPRI_H      = $(INCL)\epri.h
ESHK_H      = $(INCL)\eshk.h
EDOG_H      = $(INCL)\edog.h
FUNC_TAB_H  = $(INCL)\func_tab.h
LEV_H       = $(INCL)\lev.h
LEV_COMP_H  = $(INCL)\lev_comp.h
MAIL_H      = $(INCL)\mail.h
MFNDPOS_H   = $(INCL)\mfndpos.h
MONSYM_H    = $(INCL)\monsym.h
NHLAN_H     = $(INCL)\nhlan.h
OBJ_H       = $(INCL)\obj.h
OBJCLASS_H  = $(INCL)\objclass.h
OBJECTS_H   = $(INCL)\objects.h
PROP_H      = $(INCL)\prop.h
QTEXT_H     = $(INCL)\qtext.h
QUEST_H     = $(INCL)\quest.h
SKILLS_H    = $(INCL)\skills.h
SP_LEV_H    = $(INCL)\sp_lev.h
TERMCAP_H   = $(INCL)\tcap.h
VAULT_H     = $(INCL)\vault.h
VIS_TAB_H   = $(INCL)\vis_tab.h
WINTTY_H    = $(INCL)\wintty.h
WIN32API_H  = $(INCL)\win32api.h
WIN32_H     = $(INCL)\nhwin32.h
PATCHLEVEL_H   = $(INCL)\patchlevel.h

DATABASE = $(DAT)\data.base

#
#  The name of the game.
#

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


#######################################################################
#
#  TARGETS

#
#  The default make target (so just typing 'nmake' is useful).
#
default : $(GAMEFILE)

#
#  The main target.
#

$(GAME): $(O)obj.tag $(O)utility.tag $(TILEBMP) envchk $(GAMEFILE)
	@echo $(GAME) is up to date.

#
#  Everything
#

all :	install

install: envchk $(GAME) $(O)install.tag
	 @echo Done.

$(O)install.tag: 	$(DAT)\data	$(DAT)\rumors	 $(DAT)\dungeon \
	 	$(DAT)\oracles	$(DAT)\quest.dat $(O)sp_lev.tag $(DLB)
! IF ("$(USE_DLB)"=="Y")
	copy $(DAT)\nhshare       $(GAMEDIR)
	copy $(DAT)\nhushare      $(GAMEDIR)
	copy $(DAT)\license       $(GAMEDIR)
! ELSE
	copy $(DAT)\*.            $(GAMEDIR)
	copy $(DAT)\*.dat         $(GAMEDIR)
	copy $(DAT)\*.lev         $(GAMEDIR)
	if exist $(GAMEDIR)\makefile del $(GAMEDIR)\makefile
! ENDIF
	if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt
	if exist $(DOC)\$(GAME).txt copy $(DOC)\$(GAME).txt $(GAMEDIR)\$(GAME).txt
	if exist $(DOC)\recover.txt copy $(DOC)\recover.txt $(GAMEDIR)\recover.txt
	if exist $(DOC)\readme.txt copy $(DOC)\readme.txt $(GAMEDIR)\readme.txt
	if exist $(DOC)\slamfaq.txt copy $(DOC)\slamfaq.txt $(GAMEDIR)\slamfaq.txt
	if exist $(DOC)\history.txt copy $(DOC)\history.txt $(GAMEDIR)\history.txt
	@if exist $(SRC)\$(GAME).PDB copy $(SRC)\$(GAME).pdb $(GAMEDIR)\$(GAME).pdb
	@if exist $(SRC)\$(GAME).PDB echo NOTE: You may want to remove $(GAMEDIR)\$(GAME).pdb to conserve space
	-copy $(NTSYS)\winnt.cnf   $(GAMEDIR)\$(GAME).cnf
	copy $(U)recover.exe  $(GAMEDIR)
! IF ("$(TILEDEF)"!="")
        if exist $(TILEBMP) copy $(TILEBMP) $(GAMEDIR)
! ENDIF
	echo install done > $@

#	copy $(NTSYS)\winnt.hlp    $(GAMEDIR)

$(O)sp_lev.tag: $(O)utility.tag $(DAT)\bigroom.des  $(DAT)\castle.des \
	$(DAT)\endgame.des $(DAT)\gehennom.des $(DAT)\knox.des   \
	$(DAT)\medusa.des  $(DAT)\oracle.des   $(DAT)\tower.des  \
	$(DAT)\yendor.des  $(DAT)\arch.des     $(DAT)\barb.des   \
	$(DAT)\caveman.des $(DAT)\healer.des   $(DAT)\knight.des \
	$(DAT)\monk.des    $(DAT)\priest.des   $(DAT)\ranger.des \
	$(DAT)\rogue.des   $(DAT)\samurai.des  $(DAT)\sokoban.des \
	$(DAT)\beholder.des $(DAT)\blkmar.des   $(DAT)\grund.des   \
	$(DAT)\dragons.des  $(DAT)\flame.des    $(DAT)\frnknstn.des\
	$(DAT)\giants.des   $(DAT)\guild.des    $(DAT)\ice.des     \
	$(DAT)\lich.des     $(DAT)\mall-1.des   $(DAT)\mall-2.des  \
	$(DAT)\mines.des    $(DAT)\mtemple.des  $(DAT)\newmall.des \
	$(DAT)\necro.des    $(DAT)\nightmar.des $(DAT)\nymph.des   \
	$(DAT)\kobold-1.des $(DAT)\kobold-2.des $(DAT)\rats.des    \
	$(DAT)\sea.des      $(DAT)\slayer.des   $(DAT)\spiders.des \
	$(DAT)\stor-1.des   $(DAT)\stor-2.des   $(DAT)\stor-3.des  \
	$(DAT)\tomb.des     $(DAT)\yeoman.des                      \
	$(DAT)\tourist.des $(DAT)\valkyrie.des $(DAT)\wizard.des
	cd $(DAT)
	$(U)lev_comp bigroom.des
	$(U)lev_comp castle.des
	$(U)lev_comp endgame.des
	$(U)lev_comp gehennom.des
	$(U)lev_comp knox.des
	$(U)lev_comp mines.des
	$(U)lev_comp medusa.des
	$(U)lev_comp oracle.des
	$(U)lev_comp sokoban.des
	$(U)lev_comp tower.des
	$(U)lev_comp yendor.des
	$(U)lev_comp arch.des
	$(U)lev_comp barb.des
	$(U)lev_comp caveman.des
	$(U)lev_comp healer.des
	$(U)lev_comp knight.des
	$(U)lev_comp monk.des
	$(U)lev_comp priest.des
	$(U)lev_comp ranger.des
	$(U)lev_comp rogue.des
	$(U)lev_comp samurai.des
	$(U)lev_comp beholder.des
	$(U)lev_comp blkmar.des
	$(U)lev_comp grund.des
	$(U)lev_comp dragons.des
	$(U)lev_comp flame.des
	$(U)lev_comp frnknstn.des
	$(U)lev_comp giants.des
	$(U)lev_comp guild.des
	$(U)lev_comp ice.des
	$(U)lev_comp kobold-1.des
	$(U)lev_comp kobold-2.des
	$(U)lev_comp lich.des
	$(U)lev_comp mall-1.des
	$(U)lev_comp mall-2.des
	$(U)lev_comp mtemple.des
	$(U)lev_comp necro.des
	$(U)lev_comp newmall.des
	$(U)lev_comp nightmar.des
	$(U)lev_comp nymph.des
	$(U)lev_comp rats.des
	$(U)lev_comp sea.des
	$(U)lev_comp slayer.des
	$(U)lev_comp spiders.des
	$(U)lev_comp stor-1.des
	$(U)lev_comp stor-2.des
	$(U)lev_comp stor-3.des
	$(U)lev_comp tomb.des
	$(U)lev_comp yeoman.des
	$(U)lev_comp tourist.des
	$(U)lev_comp valkyrie.des
	$(U)lev_comp wizard.des
	cd $(SRC)
	echo sp_levs done > $(O)sp_lev.tag

$(O)utility.tag: $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \
		$(SRC)\monstr.c		$(SRC)\vis_tab.c  \
		$(INCL)\filename.h \
		$(U)lev_comp.exe	$(VIS_TAB_H) \
		$(U)dgn_comp.exe $(U)recover.exe  $(TILEUTIL)
             @echo utilities made >$@
	     @echo utilities made.

tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe
	@echo Optional tile development utilities are up to date.

#  The section for linking the NetHack image looks a little strange at 
#  first, especially if you are used to UNIX makes, or NDMAKE.  It is 
#  Microsoft nmake specific, and it gets around the problem of the 
#  link command line being too long for the linker.  An "in-line" linker 
#  response file is generated temporarily.
#
#  It takes advantage of the following features of nmake:
#
#  Inline files : 
#			Specifying the "<<" means to start an inline file.
#                 	Another "<<" at the start of a line closes the 
#                 	inline file.
#
#  Substitution within Macros:
#                       $(mymacro:string1=string2) replaces every
#                       occurrence of string1 with string2 in the 
#                       macro mymacro.  Special ascii key codes may be 
#                       used in the substitution text by preceding it 
#                       with ^ as we have done below.  Every occurence
#                       of a <tab> in $(ALLOBJ) is replaced by 
#                       <+><return><tab>.
#
#  DO NOT INDENT THE << below!
#

#
#  The main target.
#

$(GAMEFILE) :  $(RESFILE) $(ALLOBJ)
	@echo Linking....
	@$(link) $(LFLAGSG) -out:$@ @<<$(GAME).lnk
		$(ALLOBJ:^	=^
		) 
		$(RESFILE)
		$(conlibs)
<<
	@if exist $(O)install.tag del $(O)install.tag
	@if exist $(GAMEDIR)\$(GAME).bak del $(GAMEDIR)\$(GAME).bak

$(RESFILE) : $(GAME).rc $(GAME)_.ico $(WIN32API_H) $(INCL)\nhwin32.h
	rc -r $(GAME).rc

$(GAME)_.ico : $(NTSYS)\$(GAME).ico
	@copy $(NTSYS)\$(GAME).ico $@

$(GAME).rc : $(WIN32)\nhwin32.rc
	@copy $(WIN32)\nhwin32.rc $@

#
#  Secondary Targets.
#
    
#
# Makedefs Stuff
#

$(U)makedefs.exe:	$(MAKEOBJS)
	@$(link) $(LFLAGSU) -out:$@ $(MAKEOBJS) $(conlibs)

$(O)makedefs.o: $(CONFIG_H)	$(PERMONST_H)   $(OBJCLASS_H) \
		 $(MONSYM_H)    $(QTEXT_H)	$(PATCHLEVEL_H) \
		 $(U)makedefs.c
	@$(cc) $(CFLAGSU) $(NTSUB) -Fo$@ $(U)makedefs.c

#
#  date.h should be remade every time any of the source or include
#  files is modified.
#

$(INCL)\date.h : $(U)makedefs.exe
	$(U)makedefs -v

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

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

#$(INCL)\trap.h : $(U)makedefs.exe
#	$(U)makedefs -t

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

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

$(SRC)\vis_tab.c: $(U)makedefs.exe
	$(U)makedefs -z

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

#
# Level Compiler Stuff
#

#LEVCFLAGS=-c -nologo -DWINVER=0x0400 -DWIN32 -D_WIN32 -D_MT -MT -I..\include -nologo -Z7 -Od -DDLB
LEVCFLAGS= $(CFLAGSU)

$(U)lev_comp.exe: $(SPLEVOBJS)
	@echo Linking $@...
	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
 		$(SPLEVOBJS:^	=^
		)
		$(conlibs)
<<

$(O)lev_yacc.o: $(HACK_H)   $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c
	@$(cc) $(LEVCFLAGS) -W0 $(NTSUB) -Fo$@ $(U)lev_yacc.c

$(O)lev_$(LEX).o: $(HACK_H)   $(INCL)\lev_comp.h $(SP_LEV_H) \
               $(U)lev_$(LEX).c
	@$(cc) $(LEVCFLAGS) -W0 $(NTSUB) -Fo$@ $(U)lev_$(LEX).c

$(O)lev_main.o:	$(U)lev_main.c $(HACK_H)   $(SP_LEV_H)
	@$(cc) $(LEVCFLAGS) -W0 $(NTSUB) -Fo$@ $(U)lev_main.c


$(U)lev_yacc.c $(INCL)\lev_comp.h : $(U)lev_comp.y
!	IF "$(DO_YACC)"=="YACC_ACT"
	   chdir $(UTIL)
	   $(YACC) -d lev_comp.y
	   copy $(YTABC) lev_yacc.c
	   copy $(YTABH) $(INCL)\lev_comp.h
	   @del $(YTABC)
	   @del $(YTABH)
	   chdir $(SRC)
!	ELSE
	   @echo $(U)lev_comp.y has changed.
	   @echo To update $(U)lev_yacc.c and $(INCL)\lev_comp.h run $(YACC).
	   @echo ---
	   @echo For now, we will copy the prebuilt lev_yacc.c and 
	   @echo lev_comp.h from $(SSYS) into $(UTIL) and use them.
	   @copy $(SSYS)\lev_yacc.c $(U)lev_yacc.c >nul
	   @copy $(SSYS)\lev_comp.h $(INCL)\lev_comp.h >nul
	   @echo /**/ >>$(U)lev_yacc.c
	   @echo /**/ >>$(INCL)\lev_comp.h
!	ENDIF

$(U)lev_$(LEX).c: $(U)lev_comp.l
!	IF "$(DO_LEX)"=="LEX_ACT"
	   chdir $(UTIL)
	   $(LEX) $(FLEXSKEL) lev_comp.l
	   copy $(LEXYYC) $@
	   @del $(LEXYYC)
	   chdir $(SRC)
!	ELSE
	   @echo $(U)lev_comp.l has changed. To update $@ run $(LEX).
	   @echo ---
	   @echo For now, we will copy the prebuilt lev_lex.c 
	   @echo from $(SSYS) into $(UTIL) and use it.
	   @copy $(SSYS)\lev_lex.c $@ >nul
	   @echo /**/ >>$@
!	ENDIF

#
# Dungeon Stuff
#

$(U)dgn_comp.exe: $(DGNCOMPOBJS)
    @echo Linking $@...
	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
		$(DGNCOMPOBJS:^	=^
		)
		$(conlibs)
<<

$(O)dgn_yacc.o:	$(HACK_H)   $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c
	@$(cc) $(LEVCFLAGS) -W0 $(NTSUB) -Fo$@ $(U)dgn_yacc.c

$(O)dgn_$(LEX).o: $(HACK_H)   $(DGN_FILE_H)  $(INCL)\dgn_comp.h \
	$(U)dgn_$(LEX).c
	@$(cc) $(LEVCFLAGS) -W0 $(NTSUB) -Fo$@ $(U)dgn_$(LEX).c

$(O)dgn_main.o:	$(HACK_H) $(U)dgn_main.c
	@$(cc) $(LEVCFLAGS) -W0 $(NTSUB) -Fo$@ $(U)dgn_main.c

$(U)dgn_yacc.c $(INCL)\dgn_comp.h : $(U)dgn_comp.y
!	IF "$(DO_YACC)"=="YACC_ACT"
	   chdir $(UTIL)
	   $(YACC) -d dgn_comp.y
	   copy $(YTABC) dgn_yacc.c
	   copy $(YTABH) $(INCL)\dgn_comp.h
	   @del $(YTABC)
	   @del $(YTABH)
	   chdir $(SRC)
!	ELSE
	   @echo $(U)dgn_comp.y has changed. To update dgn_yacc.c and 
	   @echo $(INCL)\dgn_comp.h run $(YACC).
	   @echo ---
	   @echo For now, we will copy the prebuilt $(U)dgn_yacc.c and 
	   @echo dgn_comp.h from $(SSYS) into $(UTIL) and use them.
	   @copy $(SSYS)\dgn_yacc.c $(U)dgn_yacc.c >nul
	   @copy $(SSYS)\dgn_comp.h $(INCL)\dgn_comp.h >nul
	   @echo /**/ >>$(U)dgn_yacc.c
	   @echo /**/ >>$(INCL)\dgn_comp.h
!	ENDIF

$(U)dgn_$(LEX).c: $(U)dgn_comp.l
!	IF "$(DO_LEX)"=="LEX_ACT"
	   chdir $(UTIL)
	   $(LEX) $(FLEXSKEL)  dgn_comp.l
	   copy $(LEXYYC) $@
	   @del $(LEXYYC)
	   chdir $(SRC)
!	ELSE
	   @echo $(U)dgn_comp.l has changed. To update $@ run $(LEX).
	   @echo ---
	   @echo For now, we will copy the prebuilt dgn_lex.c 
	   @echo from $(SSYS) into $(UTIL) and use it.
	   @copy $(SSYS)\dgn_lex.c $@ >nul
	   @echo /**/ >>$@
!	ENDIF


$(O)obj.tag:
	@if not exist $(O)*.* mkdir $(OBJ)
	@echo directory $(OBJ) created >$@

#
#
envchk:
!	IF "$(CL)"!=""
	   @echo Warning, the CL Environment variable is defined:
	   @echo CL=$(CL)
!	ENDIF
!	IF "$(TILEGAME)"!=""
	   @echo ----
	   @echo NOTE: This build will include tile support.
	   @echo ----
!	ENDIF

#
# SECONDARY TARGETS
#

#
# Header files NOT distributed in ..\include
#

$(INCL)\nhwin32.h: $(WIN32)\nhwin32.h
	copy $(WIN32)\nhwin32.h $@

$(INCL)\win32api.h: $(NTSYS)\win32api.h
	copy $(NTSYS)\win32api.h $@

#$(INCL)\ntwarn.h: $(NTSYS)\ntwarn.h
#	copy $(NTSYS)\ntwarn.h $@

#$(INCL)\pctiles.h: $(NTSYS)\pctiles.h
#	copy $(NTSYS)\pctiles.h $@

#$(INCL)\pcvideo.h: $(NTSYS)\pcvideo.h
#	copy $(NTSYS)\pcvideo.h $@

#
#  Recover Utility
#

$(U)recover.exe: $(RECOVOBJS)
	@$(link) $(LFLAGSU) -out:$@ $(RECOVOBJS) $(conlibs)

#
#  Tile Mapping
#

$(SRC)\tile.c: $(U)tilemap.exe
	@echo A new $@ has been created
	@$(U)tilemap

$(U)tilemap.exe: $(O)tilemap.o
	@$(link) $(LFLAGSU) -out:$@ $(O)tilemap.o $(conlibs)

$(O)tilemap.o: $(WSHR)\tilemap.c $(HACK_H)
	@$(cc) $(CFLAGSU) $(NTSUB) -Fo$@ $(WSHR)\tilemap.c


#
# Tile Utilities
#

#
#  Optional (for development)
#

$(U)gif2txt.exe: $(GIFREADERS) $(TEXT_IO)
    @echo Linking $@...
	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
		$(GIFREADERS:^	=^
		)
		$(TEXT_IO:^	=^
		)
		$(conlibs)
<<

$(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO)
    @echo Linking $@...
	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
		$(PPMWRITERS:^	=^
		)
		$(TEXT_IO:^	=^
		)
		$(conlibs)
<<

#
#  Required for tile support
#

$(TILEBMP): $(TILEUTIL) $(TILEFILES)
	@echo Creating binary tile files (this may take some time)
	@$(U)tile2bmp $(TILEBMP)

$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
    @echo Linking $@...
	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
		$(O)tile2bmp.o
		$(TEXT_IO:^  =^
		)
		$(conlibs)
<<

$(O)tile2bmp.o: $(WIN32)\tile2bmp.c $(HACK_H) $(TILE_H) $(WIN32API_H)
	@$(cc) $(CFLAGSG) -I$(WSHR) $(NTSUB) /DPACKED_FILE /Fo$@ $(WIN32)\tile2bmp.c

#
# DLB stuff
#
nhdat:	$(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(DAT)\options \
	$(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp \
	$(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\dungeon \
	$(DAT)\license $(O)sp_lev.tag
	cd $(DAT)
	echo data >dlb.lst
	echo oracles >>dlb.lst
	echo options >>dlb.lst
	echo quest.dat >>dlb.lst
	echo rumors >>dlb.lst
	echo help >>dlb.lst
	echo hh >>dlb.lst
	echo cmdhelp >>dlb.lst
	echo history >>dlb.lst
	echo opthelp >>dlb.lst
	echo wizhelp >>dlb.lst
	echo dungeon >>dlb.lst
	echo license >>dlb.lst
	for %%N in (*.lev) do echo %%N >>dlb.lst
	$(U)dlb_main cIf dlb.lst $(SRC)\nhdat
	cd $(SRC)

$(DAT)\nhshare:	$(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(DAT)\options \
	$(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp \
	$(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\gypsy.txt \
	$(DAT)\license
	cd $(DAT)
	echo data >dlb.lst
	echo oracles >>dlb.lst
	echo options >>dlb.lst
	echo rumors >>dlb.lst
	echo help >>dlb.lst
	echo hh >>dlb.lst
	echo cmdhelp >>dlb.lst
	echo history >>dlb.lst
	echo opthelp >>dlb.lst
	echo wizhelp >>dlb.lst
	echo gypsy.txt >>dlb.lst
	echo license >>dlb.lst
	$(U)dlb_main cIf dlb.lst $(SRC)\nhdat
	cd $(SRC)

$(DAT)\nhushare:	$(U)dlb_main.exe $(DAT)\quest.dat \
	$(DAT)\dungeon $(O)sp_lev.tag
	cd $(DAT)
	echo quest.dat >>dlb.lst
	echo dungeon >>dlb.lst
	for %%N in (*.lev) do echo %%N >>dlb.lst
	$(U)dlb_main cIf dlb.lst nhushare
	cd $(SRC)

$(U)dlb_main.exe: $(DLBOBJ) $(O)dlb.o
	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
		$(O)dlb_main.o
		$(O)dlb.o
		$(O)alloc.o
		$(O)panic.o
		$(conlibs)
<<

$(O)dlb.o:	$(O)dlb_main.o $(O)alloc.o $(O)panic.o $(DLB_H)
	@$(cc) $(CFLAGSG) $(NTSUB) /Fo$@ $(SRC)\dlb.c
	
$(O)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(DLB_H)
	@$(cc) $(CFLAGSG) $(NTSUB) /Fo$@ $(UTIL)\dlb_main.c

#
# Housekeeping
#

spotless: clean
	rmdir $(OBJ)
	if exist $(DATE_H)    del $(DATE_H)
	if exist $(INCL)\onames.h  del $(INCL)\onames.h
	if exist $(INCL)\pm.h      del $(INCL)\pm.h
	if exist $(VIS_TAB_H) del $(VIS_TAB_H)
	if exist $(SRC)\vis_tab.c  del $(SRC)\vis_tab.c
	if exist $(SRC)\tile.c     del $(SRC)\tile.c
	if exist $(U)*.lnk         del $(U)*.lnk
	if exist $(U)*.map         del $(U)*.map
	if exist $(DAT)\data       del $(DAT)\data
	if exist $(DAT)\rumors     del $(DAT)\rumors
	if exist $(DAT)\???-fil?.lev	del $(DAT)\???-fil?.lev
	if exist $(DAT)\???-goal.lev	del $(DAT)\???-goal.lev
	if exist $(DAT)\???-loca.lev	del $(DAT)\???-loca.lev
	if exist $(DAT)\???-strt.lev	del $(DAT)\???-strt.lev
	if exist $(DAT)\air.lev		del $(DAT)\air.lev
	if exist $(DAT)\asmodeus.lev	del $(DAT)\asmodeus.lev
	if exist $(DAT)\astral.lev	del $(DAT)\astral.lev
	if exist $(DAT)\baalz.lev	del $(DAT)\baalz.lev
	if exist $(DAT)\bigroom.lev	del $(DAT)\bigroom.lev
	if exist $(DAT)\castle.lev	del $(DAT)\castle.lev
	if exist $(DAT)\data		del $(DAT)\data
	if exist $(DAT)\dungeon		del $(DAT)\dungeon
	if exist $(DAT)\dungeon.pdf	del $(DAT)\dungeon.pdf
	if exist $(DAT)\earth.lev	del $(DAT)\earth.lev
	if exist $(DAT)\fakewiz?.lev	del $(DAT)\fakewiz?.lev
	if exist $(DAT)\fire.lev	del $(DAT)\fire.lev
	if exist $(DAT)\juiblex.lev	del $(DAT)\juiblex.lev
	if exist $(DAT)\knox.lev	del $(DAT)\knox.lev
	if exist $(DAT)\medusa-?.lev	del $(DAT)\medusa-?.lev
	if exist $(DAT)\mine*.lev	del $(DAT)\mine*.lev
	if exist $(DAT)\options		del $(DAT)\options
	if exist $(DAT)\oracle.lev	del $(DAT)\oracle.lev
	if exist $(DAT)\oracles		del $(DAT)\oracles
	if exist $(DAT)\orcus.lev	del $(DAT)\orcus.lev
	if exist $(DAT)\rumors		del $(DAT)\rumors
	if exist $(DAT)\quest.dat	del $(DAT)\quest.dat
	if exist $(DAT)\sanctum.lev	del $(DAT)\sanctum.lev
	if exist $(DAT)\soko?-?.lev	del $(DAT)\soko?-?.lev
	if exist $(DAT)\tower?.lev	del $(DAT)\tower?.lev
	if exist $(DAT)\valley.lev	del $(DAT)\valley.lev
	if exist $(DAT)\water.lev	del $(DAT)\water.lev
	if exist $(DAT)\wizard?.lev	del $(DAT)\wizard?.lev
	if exist $(O)sp_lev.tag	        del $(O)sp_lev.tag
	if exist $(SRC)\monstr.c        del $(SRC)\monstr.c
	if exist $(SRC)\vis_tab.c       del $(SRC)\vis_tab.c
	if exist $(U)recover.exe        del $(U)recover.exe

clean:
	if exist $(O)*.o del $(O)*.o
	if exist $(O)*.tag del $(O)*.tag
	if exist $(O)utility.tag   del $(O)utility.tag
	if exist $(U)makedefs.exe  del $(U)makedefs.exe
	if exist $(U)lev_comp.exe  del $(U)lev_comp.exe
	if exist $(U)dgn_comp.exe  del $(U)dgn_comp.exe
	if exist $(SRC)\*.lnk      del $(SRC)\*.lnk
	if exist $(SRC)\*.map      del $(SRC)\*.map
! IF ("$(TILEDEF)"!="")
	if exist $(TILEBMP)        del $(TILEBMP)
! ENDIF

#
# OTHER DEPENDENCIES
#

#
# dat dependencies
#

$(DAT)\data: $(O)utility.tag    $(DATABASE)
	$(U)makedefs -d

$(DAT)\rumors: $(O)utility.tag    $(DAT)\rumors.tru   $(DAT)\rumors.fal
	$(U)makedefs -r

$(DAT)\quest.dat: $(O)utility.tag  $(DAT)\quest.txt
	$(U)makedefs -q

$(DAT)\oracles: $(O)utility.tag    $(DAT)\oracles.txt
	$(U)makedefs -h

$(DAT)\dungeon: $(O)utility.tag  $(DAT)\dungeon.def
	$(U)makedefs -e
	cd $(DAT)
	$(U)dgn_comp dungeon.pdf
	cd $(SRC)

#
#  Util Dependencies.
#

$(O)panic.o:  $(U)panic.c $(CONFIG_H)
	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@ $(U)panic.c

$(O)recover.o: $(CONFIG_H) $(U)recover.c $(INCL)\win32api.h
	@$(cc) $(CFLAGSU) $(NTSUB) -Fo$@ $(U)recover.c

#
#  from win\share
#

$(O)tiletxt.o: $(WSHR)\tilemap.c $(HACK_H)
	@$(cc) $(CFLAGSG) $(NTSUB) /DTILETEXT -Fo$@ $(WSHR)\tilemap.c

$(O)gifread.o: $(WSHR)\gifread.c  $(CONFIG_H) $(TILE_H)
	@$(cc) $(CFLAGSG) -I$(WSHR) $(NTSUB) -Fo$@ $(WSHR)\gifread.c

$(O)ppmwrite.o: $(WSHR)\ppmwrite.c $(CONFIG_H) $(TILE_H)
	@$(cc) $(CFLAGSG) -I$(WSHR) $(NTSUB) -Fo$@ $(WSHR)\ppmwrite.c

$(O)tiletext.o: $(WSHR)\tiletext.c  $(CONFIG_H) $(TILE_H)
	@$(cc) $(CFLAGSG) -I$(WSHR) $(NTSUB) -Fo$@ $(WSHR)\tiletext.c

#
#  from win\tty
#
$(O)getline.o: $(TTY)\getline.c $(HACK_H) $(WINTTY_H) $(INCL)\func_tab.h
	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(TTY)\getline.c
$(O)termcap.o: $(TTY)\termcap.c $(HACK_H) $(WINTTY_H) $(INCL)\tcap.h
	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(TTY)\termcap.c
$(O)topl.o:    $(TTY)\topl.c $(HACK_H) $(WINTTY_H) $(INCL)\tcap.h
	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(TTY)\topl.c
$(O)wintty.o: $(CONFIG_H) $(TTY)\wintty.c $(WINTTY_H) $(INCL)\dlb.h \
		$(INCL)\patchlevel.h $(INCL)\tcap.h
	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(TTY)\wintty.c

#
#  from win\win32
#

$(O)nhprocs.o:  $(WIN32)\nhprocs.c  $(HACK_H) $(WIN32_H) \
		$(FUNC_TAB_H) $(WIN32API_H)
	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@  $(WIN32)\nhprocs.c

$(O)winmain.o:  $(WIN32)\winmain.c  $(HACK_H) $(WIN32_H) $(WIN32API_H)
	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@  $(WIN32)\winmain.c

$(O)win32msg.o:  $(WIN32)\win32msg.c  $(HACK_H) $(WIN32_H) $(WIN32API_H)
	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@  $(WIN32)\win32msg.c

#
# from sys\share
#
$(O)main.o: $(SSYS)\pcmain.c $(HACK_H) $(WIN32API_H) $(INCL)\dlb.h
	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(SSYS)\pcmain.c
$(O)sys.o: $(SSYS)\pcsys.c $(HACK_H)
	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(SSYS)\pcsys.c
#$(O)tty.o: $(SSYS)\pctty.c $(HACK_H) $(WINTTY_H)
#	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(SSYS)\pctty.c
$(O)unix.o: $(SSYS)\pcunix.c $(HACK_H)
	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(SSYS)\pcunix.c
$(O)random.o: $(SSYS)\random.c $(HACK_H)
	@$(CC) $(CFLAGSG) $(NTSUB) -Fo$@ $(SSYS)\random.c
$(O)nhlan.o:	$(HACK_H) $(NHLAN_H) $(SSYS)\nhlan.c
	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@ $(SSYS)\nhlan.c


#
# from sys\winnt
#

$(O)nttty.o:   $(NTSYS)\nttty.c   $(HACK_H) $(WINTTY_H) \
                $(TILE_H) $(WIN32API_H)
	@$(cc) $(CFLAGSG) -I$(WSHR) $(NTSUB) -Fo$@  $(NTSYS)\nttty.c
$(O)winnt.o: $(NTSYS)\winnt.c   $(HACK_H) $(WIN32API_H)
	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@  $(NTSYS)\winnt.c
$(O)ntsound.o: $(NTSYS)\ntsound.c   $(HACK_H)
	@$(cc) $(CFLAGSG)  $(NTSUB) -Fo$@ $(NTSYS)\ntsound.c
$(O)mapimail.o: $(NTSYS)\mapimail.c   $(HACK_H) $(NHLAN_H)
	@$(cc) $(CFLAGSG) -DMAPI_VERBOSE  $(NTSUB) -Fo$@ $(NTSYS)\mapimail.c

#
# from src
#

#$(O)alloc.o: $(SRC)\alloc.c    $(CONFIG_H)
#	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@ $(SRC)\alloc.c
#$(O)end.o: $(SRC)\end.c      $(HACK_H) $(ESHK_H) $(DLB_H)
#	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@ $(SRC)\end.c
#$(O)version.o: $(SRC)\version.c  $(HACK_H) $(DATE_H)  $(PATCHLEVEL_H)
#	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@ $(SRC)\version.c
#$(O)vis_tab.o: $(SRC)\vis_tab.c  $(HACK_H) $(VIS_TAB_H)
#	@$(cc) $(CFLAGSG) $(NTSUB) -Fo$@ $(SRC)\vis_tab.c

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

# end of file
