# NetHack 3.7	Makefile.GCC	$NHDT-Date: 1596498268 2020/08/03 23:44:28 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.53 $
#	Copyright (c) NetHack PC Development Team 1996-2022.
#	PC NetHack 3.7 Makefile for djgpp V2
#
#	Gnu gcc compiler for msdos (djgpp)
#	Requires Gnu Make utility (V3.79.1 or greater) supplied with djgpp
#
#	For questions or comments: devteam@nethack.org
#
#	In addition to your C compiler,
#
#       if you want to change     you will need a
#       files with suffix         workalike for
#	  .y	                     yacc
#	  .l	                     lex
#
#	Note that flex (lex) and bison (yacc) are included with the
#	djgpp distribution and work quite well.	 This makefile assumes
#	you have them installed correctly.

# Game Installation Variables
# NOTE: Make sure GAMEDIR exists before make is started.

GAME = nethack
# The GNU Make has a problem if you include a drive spec below (unfortunately).
GAMEDIR =../binary

# Optional PDCurses support
#    Uncomment these and set them appropriately if you want to
#    include curses port support alongside TTY support in your
#    NetHack.exe binary. 
#
#    You'll have to set PDCURSES_H to the correct location of the 
#    PDCurses header (.h) files and PDCURSES_C to the location
#    of your PDCurses C files which must already be resident on 
#    your machine.
#
ifdef WANT_WIN_CURSES
ADD_CURSES=Y
ifdef WANT_DOSVGA
PDCURSES_TOP=../lib/pdcurmod
PDCDOS = $(PDCURSES_TOP)/dosvga
else
PDCURSES_TOP=../lib/pdcurses
PDCDOS = $(PDCURSES_TOP)/dos
endif
endif

#---------------------------------------------------------------
ifeq "$(LUA_VERSION)" "5.3.5"
LUAVER=535
else
LUAVER=546
endif
#---------------------------------------------------------------
# Location of LUA
#
# Original source needs to be obtained from: 
#    http://www.lua.org/ftp/lua-5.4.6.tar.gz
#
#    This build assumes that the LUA sources are located
#    at the specified location. If they are actually elsewhere
#    you'll need to specify the correct spot below in order to
#    successfully build NetHack-3.7.
#
ADD_LUA=Y
LUATOP=../lib/lua$(LUAVER)
#

#---------------------------------------------------------------
# Location of terminus-fonts
#
FONTTOP=../lib/terminus
#==============================================================================
# This marks the end of the BUILD DECISIONS section.
#==============================================================================
#
# Directories, gcc likes unix style directory specs
#

OBJ  = o
DAT  = ../dat
DOC  = ../doc
INCL = ../include
MSYS = ../sys/msdos
SRC  = ../src
SSHR = ../sys/share
UTIL = ../util
WIN  = ../win/tty
WCURSES = ../win/curses
WSHR = ../win/share

#
#  Executables.

CC    = gcc
LINK  = gcc
MAKEBIN  = make

#
# Special libraries and how to link them in.

LIBS = -lpc

# If TERMLIB is defined in pcconf.h, comment out the upper line and
# uncomment the lower.	Note that you must build the termc library
# and place it in djgpp's lib directory.  See termcap.zip for details

TERMLIB =
#TERMLIB = -ltermc

LIBRARIES = $(LIBS) $(TERMLIB)

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

USE_DLB = Y

# djgpp includes ls.exe and touch.exe in fil41b.zip from the v2gnu 
# folder so be sure to include that when downloading djgpp. Doing
# so will make changing this unnecessary.

LS = ls -1		# ls.exe from djgpp distribution
#LS = dir /l/b		# DOS command

# To build a binary without any graphics
# suitable for blind players,
# set SUPPRESS_GRAPHICS to Y
# (Note: binary will require ANSI.SYS driver or equivalent loaded)
# SUPPRESS_GRAPHICS = Y
SUPPRESS_GRAPHICS = 

# ZLIB Support
# To support zlib compression in bones and save files, you must
# define ZLIB_COMP in include/config.h.
# You must also have a zlib library to link NetHack with, and
# for the djgpp build, you need one compatible with djgpp.
# At the time that this was written (post-NetHack 3.4.3) the 
# following URL was a valid place to get a pre-built djgpp library
# to add to your djgpp tools directory tree.
# http://www.delorie.com/pub/djgpp/current/v2tk/zlib114b.zip
#
# If you defined ZLIB_COMP in include/config.h to build in support
# for ZLIB compression, you need to uncomment the line below.
#ZLIB= -lz

#===============================================
#======= End of Modification Section ===========
#===============================================
################################################
#                                              #
# Nothing below here should have to be changed.#
#                                              #
################################################

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

# Changing this conditional block is not recommended
ifeq "$(USE_DLB)" "Y"
DLBFLG = -DDLB
else
DLBFLG =
endif

TERMLIB =
# Build NetHack suitable for blind players

#==========================================
#================ MACROS ==================
#==========================================
# This section creates shorthand macros for many objects
# referenced later on in the Makefile.
#
# Have windows path styles available for use in commands
#
W_OBJ     =$(subst /,\, $(OBJ))
W_INCL    =$(subst /,\, $(INCL))
W_DAT     =$(subst /,\, $(DAT))
W_DOC     =$(subst /,\, $(DOC))
W_UTIL    =$(subst /,\, $(UTIL))
W_SRC     =$(subst /,\, $(SRC))
W_SSYS    =$(subst /,\, $(SSYS))
W_MSWSYS  =$(subst /,\, $(MSWSYS))
W_TTY     =$(subst /,\, $(TTY))
W_MSWIN   =$(subst /,\, $(MSWIN))
ifeq "$(ADD_CURSES)" "Y"
W_WCURSES =$(subst /,\, $(WCURSES))
endif
W_WSHR    =$(subst /,\, $(WSHR))
W_GAMEDIR =$(subst /,\, $(GAMEDIR))

#
# Shorten up the location for some files
#

O  = $(OBJ)/

U  = $(UTIL)/

#==========================================
#  Utility Objects.
#==========================================

VGAOBJ      = $(O)vidvga.o $(O)vidvesa.o $(O)font.o

MAKESRC	    = makedefs.c

MAKEDEFSOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o $(O)alloc.o \
               $(O)date.o $(O)panic.o

RECOVOBJS   = $(O)recover.o


#==========================================
#  Tile related object files.
#==========================================

ifeq ($(SUPPRESS_GRAPHICS),Y)
TILOBJ       =
TILOBJ2      =
TEXTIO       =
TEXTIO2      =
TILE_BMP     =
TILEUTIL     = 
TILEFILES    = 
TILEFILES2   = 
GIFREADERS   = 
GIFREAD2     = 
PPMWRITERS   = 
PPMWRIT2     = 

else

TILOBJ      = $(O)tile.o $(VGAOBJ)

TILOBJ2     = $(O)tileset.o $(O)bmptiles.o $(O)giftiles.o

TEXTIO      = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o $(O)monst.o \
		$(O)objects.o $(O)stubvid.o

TEXTIO2     = $(O)tiletex2.o $(O)tiletxt2.o $(O)drawing.o $(O)monst.o \
		$(O)objects.o $(O)stubvid.o

TILE_BMP    = $(DAT)/nhtiles.bmp

TILEUTIL    = $(TILOBJ) $(U)tile2bin.exe $(U)til2bin2.exe $(TILE_BMP)

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

TILEFILES2  = $(WSHR)/monthin.txt $(WSHR)/objthin.txt $(WSHR)/oththin.txt

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

GIFREAD2    = $(O)gifread2.o $(O)alloc.o $(O)panic.o

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

PPMWRIT2    = $(O)ppmwrit2.o $(O)alloc.o $(O)panic.o
endif

#REGEX = $(O)pmatchregex.o
#REGEX = $(O)cppregex.o
REGEX = $(O)posixreg.o

DLBOBJ = $(O)dlb.o

#  Object files for the game itself.


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

SOBJ   = $(O)msdos.o    $(O)pcsys.o    $(O)tty.o	    $(O)unix.o \
	 $(O)video.o    $(O)vidtxt.o  $(O)pckeys.o

VVOBJ  = $(O)version.o

LUAOBJ = $(O)nhlua.o    $(O)nhlsel.o    $(O)nhlobj.o
LUA_QTEXT_FILE = "quest.lua"

ifeq "$(ADD_CURSES)" "Y"
CURSESOBJ= $(O)cursdial.o $(O)cursinit.o $(O)cursinvt.o $(O)cursmain.o \
	   $(O)cursmesg.o $(O)cursmisc.o $(O)cursstat.o $(O)curswins.o
else
CURSESOBJ=
endif

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) \
	$(CURSESOBJ) $(LUAOBJ)

ALLOBJ = $(VOBJ) $(SOBJ) $(TILOBJ) $(TILOBJ2) $(VVOBJ)

#===============-=================================================
# LUA library
# Source from http://www.lua.org/ftp/lua-5.4.6.tar.gz
#=================================================================

LUASRC   = $(LUATOP)/src
LUALIB   = $(O)lua$(LUAVER)s.a
LUAINCL  = -I$(LUASRC)
#LUAFLAGS = unix added -lm here?
LUATARGETS = lua.exe luac.exe $(LUALIB)

LUASRCFILES =   lapi.c lauxlib.c lbaselib.c lcode.c    \
		lcorolib.c lctype.c ldblib.c ldebug.c ldo.c      \
		ldump.c lfunc.c lgc.c linit.c liolib.c llex.c    \
		lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c \
		loslib.c lparser.c lstate.c lstring.c lstrlib.c  \
		ltable.c ltablib.c ltm.c lundump.c lutf8lib.c    \
		lvm.c lzio.c

LUAOBJFILES1 =  $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o \
		$(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o   \
		$(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o
LUAOBJFILES2 =	$(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o          \
		$(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o  \
		$(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o
LUAOBJFILES3 =	$(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \
		$(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o
LUAOBJFILES = $(LUAOBJFILES1) $(LUAOBJFILES2) $(LUAOBJFILES3)

ifeq "$(ADD_CURSES)" "Y"
#==========================================
# PDCurses build macros
#==========================================
PDCURSES_CURSES_H	= $(PDCURSES_TOP)/curses.h
PDCURSES_CURSPRIV_H	= $(PDCURSES_TOP)/curspriv.h
PDCURSES_HEADERS	= $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H)
PDCSRC                  = $(PDCURSES_TOP)/pdcurses
PDCLIBOBJS1 = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o            \
	$(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o     \
	$(O)getch.o
PDCLIBOBJS2 = $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o $(O)initscr.o \
	$(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o        \
	$(O)keyname.o $(O)mouse.o
PDCLIBOBJS3 = $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o $(O)panel.o \
	$(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \
	$(O)slk.o $(O)termattr.o
PDCLIBOBJS4 = $(O)touch.o $(O)util.o $(O)window.o $(O)debug.o
PDCLIBOBJS = $(PDCLIBOBJS1) $(PDCLIBOBJS2) $(PDCLIBOBJS3) $(PDCLIBOBJS4)

PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o \
	$(O)pdcscrn.o $(O)pdcsetsc.o $(O)pdcutil.o

#PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \
#	  $(O)pdcsetsc.o $(O)pdcutil.o

PDCLIB = $(O)pdcurses.a

PDCINCL = -I$(PDCURSES_TOP) -I$(PDCSRC) -I$(PDCDOS)
else
PDCLIB = 
PDCINCL =
endif

#==========================================
# Header file macros
#==========================================

PATCHLEV_H = $(INCL)/patchlev.h
DGN_FILE_H = $(INCL)/align.h	$(INCL)/dgn_file.h
DUNGEON_H  = $(INCL)/align.h	$(INCL)/dungeon.h
MONDATA_H  = $(INCL)/align.h	$(INCL)/mondata.h
MONST_H	   = $(INCL)/align.h	$(INCL)/monst.h $(INCL)/mextra.h
PERMONST_H = $(INCL)/monattk.h	$(INCL)/monflag.h   $(INCL)/align.h   \
	    $(INCL)/permonst.h
REGION_H   = $(INCL)/region.h
RM_H	   = $(INCL)/align.h	$(INCL)/rm.h
SKILLS_H   = $(INCL)/skills.h
SP_LEV_H   = $(INCL)/align.h	$(INCL)/sp_lev.h
YOUPROP_H  = $(PERMONST_H)	$(MONDATA_H)	    $(INCL)/prop.h     \
	    $(INCL)/youprop.h
YOU_H	   = $(MONST_H)		$(YOUPROP_H)	    $(INCL)/align.h    \
	     $(INCL)/attrib.h	$(INCL)/you.h
DISPLAY_H  = $(MONDATA_H)	$(INCL)/vision.h    $(INCL)/display.h
PCCONF_H   = $(INCL)/micro.h	$(INCL)/cstd.h    $(INCL)/pcconf.h   \
	    $(MSYS)/pcvideo.h
CONFIG_H   = $(GLOBAL_H)	$(INCL)/fnamesiz.h  $(INCL)/tradstdc.h \
	     $(INCL)/config1.h $(INCL)/config.h
DECL_H	   = $(YOU_H)		$(INCL)/spell.h	    $(INCL)/color.h    \
	     $(INCL)/obj.h	$(INCL)/objects.h                      \
	      $(INCL)/decl.h
GLOBAL_H   = $(PCCONF_H)	$(INCL)/coord.h	   $(INCL)/global.h
HACK_H	   = $(CONFIG_H)	$(INCL)/context.h  $(DUNGEON_H)	       \
	     $(DECL_H)	      	$(DISPLAY_H)	   $(INCL)/sym.h       \
	     $(INCL)/defsym.h   $(INCL)/mkroom.h   $(INCL)/objclass.h  \
	     $(INCL)/trap.h     $(INCL)/flag.h     $(RM_H)             \
	     $(INCL)/vision.h   $(INCL)/wintype.h  $(INCL)/engrave.h   \
	     $(INCL)/rect.h     $(INCL)/hack.h     $(REGION_H)         \
	     $(INCL)/sys.h
DLB_H      = $(INCL)/dlb.h

ifeq ($(SUPPRESS_GRAPHICS),Y)
TILE_H     =
else
TILE_H	   = $(WSHR)/tile.h $(INCL)/tileset.h
endif

ifeq ($(USE_DLB),Y)
DLB = dlb
DLBOBJS = $(O)dlb_main.o $(O)dlb.o $(O)alloc.o $(O)panic.o
else
DLB =
DLBOBJS =
endif

ifdef DJGPP
DJ1 = $(dir $(DJGPP))
CWSDPMI = $(subst /,\,$(DJ1))bin\CWSDPMI.*
endif

#==========================================
# More compiler setup macros
#==========================================
#
ifeq "$(ADD_CURSES)" "Y"
CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE"
ifdef WANT_DOSVGA
CURSESDEF += -DCURSES_UNICODE -DPDC_WIDE
endif
else
CURSESDEF=
CURSESLIB=
endif

INCLDIR=$(PDCINCL) -I../include -I../sys/msdos $(LUAINCL)

# Debugging
#cflags = -pg -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
#LFLAGS = -pg

cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
LFLAGS =

# Debugging
#cflags = -g -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DTILES_IN_GLYPHMAP
#LFLAGS = -g

#    Normal
cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DTILES_IN_GLYPHMAP
LFLAGS =

#==========================================
#================ RULES ==================
#==========================================

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

#==========================================
# Rules for files in src
#==========================================

$(OBJ)/%.o : /%.c
	$(CC) $(cflags) -o$@ $<

$(OBJ)/%.o : $(SRC)/%.c
	$(CC) $(cflags) -o$@ $<

#==========================================
# Rules for files in sys/share
#==========================================

$(OBJ)/%.o : $(SSHR)/%.c
	$(CC) $(cflags) -o$@ $<

#==========================================
# Rules for files in sys/msdos
#==========================================

$(OBJ)/%.o : $(MSYS)/%.c
	$(CC) $(cflags) -I../sys/msdos -o$@ $<

#==========================================
# Rules for files in util
#==========================================

$(OBJ)/%.o : $(UTIL)/%.c
	$(CC) $(cflags) -o$@ $<

#==========================================
# Rules for files in win/share
#==========================================

$(OBJ)/%.o : $(WSHR)/%.c
	$(CC) $(cflags) -I../win/share -o$@ $<

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

#==========================================
# Rules for files in win/tty
#==========================================

$(OBJ)/%.o : $(TTY)/%.c
	$(CC) $(cflags) -o$@ $<

#==========================================
# Rules for files in win/curses
#==========================================

$(OBJ)/%.o : $(WCURSES)/%.c
	$(CC) -DPDC_NCMOUSE $(cflags) -o$@  $<

#==========================================
# Rules for files in PDCurses
#==========================================

$(OBJ)/%.o : $(PDCURSES_TOP)/%.c
	$(CC) $(cflags)  -o$@  $<

$(OBJ)/%.o : $(PDCSRC)/%.c
	$(CC) $(cflags)  -o$@  $<

$(OBJ)/%.o : $(PDCDOS)/%.c
	$(CC) $(cflags)  -o$@  $<

#==========================================
# Rules for LUA files
#==========================================

$(OBJ)/%.o : $(LUASRC)/%.c
	$(CC) $(cflags)  -o$@  $<

#==========================================
#  Primary Targets.
#==========================================

#  The default target.

all :   install

install: $(GAMEFILE) $(O)install.tag 
	@echo Done.

default: $(GAMEFILE)

util: $(O)utility.tag

$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h    $(INCL)/objects.h \
	$(TILEUTIL)
	$(subst /,\,echo utilities made > $@)

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

recover: $(U)recover.exe
	@$(subst /,\,if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR))
	@$(subst /,\,if exist $(DOC)/recover.txt copy $(DOC)/recover.txt $(GAMEDIR))

$(O)install.tag: $(O)dat.tag $(O)fonts.tag $(GAMEFILE)
ifeq ($(USE_DLB),Y)
	@$(subst /,\,copy $(DAT)/nhdat $(GAMEDIR))
	@$(subst /,\,copy $(DAT)/license $(GAMEDIR))
else
	@$(subst /,\,copy $(DAT)/*. $(GAMEDIR))
	@$(subst /,\,copy $(DAT)/*.dat $(GAMEDIR))
	@$(subst /,\,copy $(DAT)/*.lua $(GAMEDIR))
	@$(subst /,\,copy $(MSYS)/msdoshlp.txt $(GAMEDIR))
	@$(subst /,\,if exist $(GAMEDIR)/makefile. del $(GAMEDIR)/makefile.)
endif
ifdef TERMLIB
	@$(subst /,\,copy $(SSHR)/termcap $(GAMEDIR))
endif
	@$(subst /,\,if exist $(TILE_BMP) copy $(TILE_BMP) $(GAMEDIR))
	@$(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR))
	@$(subst /,\,copy $(SSHR)/NetHack.cnf  $(GAMEDIR)/defaults.nh)
	-@$(subst /,\,touch $(GAMEDIR)/record)
	@$(subst /,\,copy $(DOC)/guideb*.txt  $(GAMEDIR))
	@$(subst /,\,copy $(MSYS)/sysconf  $(GAMEDIR))
	@$(subst /,\,if not exist $(GAMEDIR)/sysconf touch $(GAMEDIR)/sysconf)
	@$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR))
ifdef CWSDPMI
	@$(subst /,\,if exist $(CWSDPMI) copy $(CWSDPMI) $(GAMEDIR))
else
	@$(subst /,\,echo Could not find a copy of CWSDPMI.EXE to put into $(GAMEDIR))
endif
	@$(subst /,\,copy $(MSYS)/fonts/*.psf  $(GAMEDIR))
	@$(subst /,\,echo install done > $@)

#==========================================
#  The main target.
#==========================================

$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) $(LUATARGETS) \
	$(O)utility.tag $(ALLOBJ)
	 @if exist temp.a del temp.a
	 @ar ruS temp.a $(VOBJ01)
	 @ar ruS temp.a $(VOBJ02)
	 @ar ruS temp.a $(VOBJ03)
	 @ar ruS temp.a $(VOBJ04)
	 @ar ruS temp.a $(VOBJ05)
	 @ar ruS temp.a $(VOBJ06)
	 @ar ruS temp.a $(VOBJ07)
	 @ar ruS temp.a $(VOBJ08)
	 @ar ruS temp.a $(VOBJ09)
	 @ar ruS temp.a $(VOBJ10)
	 @ar ruS temp.a $(VOBJ11)
	 @ar ruS temp.a $(VOBJ12)
	 @ar ruS temp.a $(VOBJ13)
	 @ar ruS temp.a $(VOBJ14)
	 @ar ruS temp.a $(VOBJ15)
	 @ar ruS temp.a $(VOBJ16)
	 @ar ruS temp.a $(VOBJ17)
	 @ar ruS temp.a $(VOBJ18)
	 @ar ruS temp.a $(VOBJ19)
	 @ar ruS temp.a $(VOBJ20)
	 @ar ruS temp.a $(VOBJ21)
	 @ar ruS temp.a $(VOBJ22)
	 @ar ruS temp.a $(VOBJ23)
	 @ar ruS temp.a $(VOBJ24)
	 @ar ruS temp.a $(VOBJ25)
	 @ar ruS temp.a $(SOBJ)
	 @ar ruS temp.a $(TILOBJ)
	 @ar ruS temp.a $(TILOBJ2)
	 @ar ruS temp.a $(VVOBJ)
	 @ar ruS temp.a $(LUAOBJ)
ifeq "$(ADD_CURSES)" "Y"
	 @ar ruS temp.a $(CURSESOBJ)
endif
	@ranlib temp.a
	$(LINK) $(LFLAGS) -o$(GAME).exe temp.a \
	$(PDCLIB) $(LUALIB) $(LIBRARIES) $(ZLIB)
	@$(subst /,\,stubedit $(GAME).exe minstack=2048K)
	@$(subst /,\,copy $(GAME).exe $(GAMEFILE))
	@$(subst /,\,del $(GAME).exe)

#==========================================
#=========== SECONDARY TARGETS ============
#==========================================
#
#  The following include 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 : $(U)makedefs.exe
	-$(subst /,\,$(U)makedefs -v)

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

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

#==========================================
#  Makedefs Stuff
#==========================================

$(U)makedefs.exe:  $(MAKEDEFSOBJS)
	$(LINK) $(LFLAGS) -o$@ $(MAKEDEFSOBJS)

$(O)makedefs.o:  $(CONFIG_H)	$(PERMONST_H)	   $(INCL)/objclass.h \
		$(INCL)/sym.h   $(INCL)/defsym.h $(U)makedefs.c

#==========================================
#  Recover Utility
#==========================================

$(U)recover.exe:   $(RECOVOBJS)
	$(LINK) $(LFLAGS) -o$@ $(O)recover.o

$(O)recover.o:   $(CONFIG_H) $(U)recover.c
	$(CC) $(cflags) -o$@ $(U)recover.c

#==========================================
#  Header file moves required for tile support
#==========================================

ifeq ($(SUPPRESS_GRAPHICS),Y)

else
#
#  Tile Mapping
#

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

TILEMAPOBJS = $(O)tilemap.o $(O)monst.o $(O)objects.o $(O)drawing.o

$(U)tilemap.exe: $(TILEMAPOBJS)
	$(LINK) $(LFLAGS) -o$@ $(TILEMAPOBJS)

$(O)tilemap.o: $(WSHR)/tilemap.c $(HACK_H) $(TILE_H)
	$(CC) $(cflags) -I$(WSHR) -I$(MSYS) -o$@ $(WSHR)/tilemap.c

endif

#==========================================
#   Tile Utilities
#  Required for tile support
#==========================================

$(DAT)/nhtiles.bmp: $(TILEFILES) $(U)tile2bmp.exe
	@echo Creating binary tile files (this may take some time)
	@$(subst /,\,chdir $(DAT))
	@$(subst /,\,$(U)tile2bmp.exe $@)
	@$(subst /,\,chdir $(SRC))

$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXTIO)
	-rm -f temp.a
	@ar ru temp.a $(TEXTIO)
	$(LINK) $(LFLAGS) -o$@ $(O)tile2bmp.o temp.a

$(U)tile2bin.exe: $(O)tile2bin.o $(TEXTIO)
	-rm -f temp.a
	@ar ru temp.a $(TEXTIO)
	$(LINK) $(LFLAGS) -o$@ $(O)tile2bin.o temp.a

$(U)til2bin2.exe: $(O)til2bin2.o $(TEXTIO2)
	-rm -f temp.a
	@ar ru temp.a $(TEXTIO2)
	$(LINK) $(LFLAGS) -o$@ $(O)til2bin2.o temp.a

$(U)thintile.exe: $(O)thintile.o 
	$(LINK) $(LFLAGS) -o$@ $(O)thintile.o

$(O)thintile.o:  $(HACK_H) $(WSHR)/tile.h $(WSHR)/thintile.c
	$(CC) $(cflags) -o$@ $(WSHR)/thintile.c

$(O)thintile.tag: $(U)thintile.exe $(TILEFILES)
	@$(subst /,\,$(U)thintile.exe)
	@$(subst /,\,echo thintiles created >$@)

$(O)tile2bmp.o:  $(HACK_H) $(TILE_H) $(WSHR)/tile2bmp.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(WSHR)/tile2bmp.c

$(O)tile2bin.o:  $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/tile2bin.c

$(O)til2bin2.o:  $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE_X=8 -DOVERVIEW_FILE -o$@ $(MSYS)/tile2bin.c

$(O)tiletext.o:  $(CONFIG_H) $(TILE_H) $(WSHR)/tiletext.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(WSHR)/tiletext.c

$(O)tiletex2.o:  $(CONFIG_H) $(TILE_H) $(WSHR)/tiletext.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILE_X=8 -o$@ $(WSHR)/tiletext.c

$(O)tiletxt.o: $(CONFIG_H) $(TILE_H) $(WSHR)/tilemap.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILETEXT -o$@ $(WSHR)/tilemap.c
  
$(O)tiletxt2.o: $(CONFIG_H) $(TILE_H) $(WSHR)/tilemap.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -DTILETEXT -DTILE_X=8 -o$@ $(WSHR)/tilemap.c
#
# Optional GIF Utilities (for development)
#

$(U)gif2txt.exe: $(GIFREADERS) $(TEXTIO)
	$(LINK) $(LFLAGS) -o$@ $(GIFREADERS) $(TEXTIO)

$(U)gif2txt2.exe: $(GIFREAD2) $(TEXTIO2)
	$(LINK) $(LFLAGS) -o$@ $(GIFREAD2) $(TEXTIO2)

$(U)txt2ppm.exe: $(PPMWRITERS) $(TEXTIO)
	$(LINK) $(LFLAGS) -o$@ $(PPMWRITERS) $(TEXTIO)

$(U)txt2ppm2.exe: $(PPMWRIT2) $(TEXTIO2)
	$(LINK) $(LFLAGS) -o$@ $(PPMWRIT2) $(TEXTIO2)

$(O)gifread.o: $(CONFIG_H) $(WSHR)/tile.h $(WSHR)/gifread.c

$(O)gifread2.o: $(CONFIG_H) $(WSHR)/tile.h $(WSHR)/gifread.c
	$(CC) $(cflags) -DTILE_X=8 -o$@ $(WSHR)/gifread.c

ppmwrite.c: $(WSHR)/ppmwrite.c
	@$(subst /,\,copy $(WSHR)/ppmwrite.c .)

$(O)ppmwrite.o: $(CONFIG_H)	$(WSHR)/tile.h

$(O)ppmwrit2.o:  $(CONFIG_H) $(WSHR)/tile.h ppmwrite.c
	$(CC) $(cflags) -DTILE_X=8 -o$@ ppmwrite.c

#
#  Optional tile viewer (development sources only)
#

$(U)viewtib.exe: $(O)viewtib.o
	$(LINK) $(LFLAGS) -o$@ $(O)viewtib.o $(LIBRARIES)

$(O)viewtib.o: $(MSYS)/viewtib.c

#==========================================
# PDCurses Library
#==========================================

$(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS)
	ar rcS $@ $(PDCLIBOBJS1)
	ar rcS $@ $(PDCLIBOBJS2)
	ar rcS $@ $(PDCLIBOBJS3)
	ar rcS $@ $(PDCLIBOBJS4)
	ar rcs $@ $(PDCOBJS)

#==========================================
#  Other Util Dependencies.
#==========================================

$(O)alloc.o: $(CONFIG_H)	 alloc.c
	$(CC) $(cflags) -o$@ alloc.c

$(O)drawing.o: $(CONFIG_H) drawing.c $(MSYS)/pcvideo.h
	$(CC) $(cflags) -I$(MSYS) -o$@ drawing.c

$(O)decl.o: $(CONFIG_H) decl.c
	$(CC) $(cflags) -o$@ decl.c

$(O)monst.o: $(CONFIG_H) $(PERMONST_H) $(INCL)/sym.h   \
	$(INCL)/defsym.h $(INCL)/color.h	 monst.c
	$(CC) $(cflags) -o$@ monst.c

$(O)objects.o: $(CONFIG_H)	      $(INCL)/obj.h	 $(INCL)/objclass.h \
	$(INCL)/prop.h	    $(INCL)/color.h    objects.c
	$(CC) $(cflags) -o$@ objects.c

$(O)panic.o:   $(CONFIG_H)	  $(U)panic.c

#============================================================
# make data.base an 8.3 filename to prevent an make warning
#============================================================

DATABASE = $(DAT)/data.bas


$(O)dat.tag: $(DAT)/nhdat
	@$(subst /,\,echo dat done >$@)

$(DAT)/data: $(O)utility.tag	$(DATABASE)
	@$(subst /,\,$(U)makedefs.exe -d)

$(DAT)/rumors:	     $(O)utility.tag    $(DAT)/rumors.tru	$(DAT)/rumors.fal
	@$(subst /,\,$(U)makedefs.exe -r)

$(DAT)/oracles:	     $(O)utility.tag    $(DAT)/oracles.txt
	@$(subst /,\,$(U)makedefs.exe -h)

$(DAT)/bogusmon:     $(O)utility.tag    $(DAT)/bogusmon.txt
	@$(subst /,\,$(U)makedefs.exe -s)

$(DAT)/engrave:	     $(O)utility.tag    $(DAT)/engrave.txt
	@$(subst /,\,$(U)makedefs.exe -s)

$(DAT)/epitaph:	     $(O)utility.tag    $(DAT)/epitaph.txt
	@$(subst /,\,$(U)makedefs.exe -s)

$(O)sp_lev.tag: $(O)utility.tag
	@$(subst /,\,echo sp_levs done > $@)

#==========================================
# DLB stuff
#==========================================

#note that dir below assumes bin/dir.exe from djgpp distribution
#
$(DAT)/nhdat:	$(U)dlb_main.exe $(DAT)/data $(DAT)/rumors \
		$(DAT)/oracles \
		$(QUEST_DAT) \
		$(O)sp_lev.tag \
		$(DAT)/bogusmon $(DAT)/engrave $(DAT)/epitaph $(DAT)/tribute
	@$(subst /,\,echo dat done >$(O)dat.tag)
	@$(subst /,\,cd $(DAT))
	@$(subst /,\,copy $(MSYS)/msdoshlp.txt .)
	@$(LS) data oracles options rumors help hh >dlb.lst
	@$(LS) cmdhelp history opthelp optmenu wizhelp license msdoshlp.txt >>dlb.lst
	@$(LS) bogusmon engrave epitaph tribute >>dlb.lst
	$(LS) $(subst /,\,*.lua) >>dlb.lst
	@$(subst /,\,$(U)dlb_main cvIf dlb.lst nhdat)
	@$(subst /,\,cd $(SRC))

$(U)dlb_main.exe: $(DLBOBJS)
	$(LINK) $(LFLAGS) -o$@ $(DLBOBJS)

$(O)dlb_main.o: $(U)dlb_main.c $(INCL)/config.h $(DLB_H)
	$(CC) $(cflags) -o$@ $(U)dlb_main.c

#=============================================================
# LUA
#=============================================================

lua.exe: $(O)lua.o $(LUALIB) 
	$(CC) $(LFLAGS) -o$@ $(O)lua.o $(LUALIB)

luac.exe: $(O)luac.o $(O)lua$(LUAVER)s.a
	$(CC) $(LFLAGSU) -o$@ $(O)luac.o $(LUALIB)

$(O)lua$(LUAVER)s.a: $(LUAOBJFILES)
	ar rcS $@ $(LUAOBJFILES1)
	ar rcS $@ $(LUAOBJFILES2)
	ar rcs $@ $(LUAOBJFILES3)

$(O)lua.o: $(LUASRC)/lua.c
$(O)luac.o: $(LUASRC)/luac.c

#==========================================
#  Fonts for Unicode support
#==========================================

$(O)fonts.tag: lua.exe $(MSYS)/fonts/makefont.lua
	lua $(MSYS)/fonts/makefont.lua $(FONTTOP)/ter-u16b.bdf $(MSYS)/fonts/ter-u16b.psf
	lua $(MSYS)/fonts/makefont.lua $(FONTTOP)/ter-u16v.bdf $(MSYS)/fonts/ter-u16v.psf
	lua $(MSYS)/fonts/makefont.lua $(FONTTOP)/ter-u18b.bdf $(MSYS)/fonts/ter-u18b.psf
	lua $(MSYS)/fonts/makefont.lua $(FONTTOP)/ter-u20b.bdf $(MSYS)/fonts/ter-u20b.psf
	lua $(MSYS)/fonts/makefont.lua $(FONTTOP)/ter-u22b.bdf $(MSYS)/fonts/ter-u22b.psf
	lua $(MSYS)/fonts/makefont.lua $(FONTTOP)/ter-u24b.bdf $(MSYS)/fonts/ter-u24b.psf
	lua $(MSYS)/fonts/makefont.lua $(FONTTOP)/ter-u28b.bdf $(MSYS)/fonts/ter-u28b.psf
	lua $(MSYS)/fonts/makefont.lua $(FONTTOP)/ter-u32b.bdf $(MSYS)/fonts/ter-u32b.psf
	@echo Fonts done >$(O)fonts.tag

#==========================================
#  Housekeeping.
#==========================================

clean:
	$(subst /,\,if exist $(O)*.o del $(O)*.o)
	$(subst /,\,if exist $(O)dat.tag del $(O)dat.tag)
	$(subst /,\,if exist $(O)fonts.tag del $(O)fonts.tag)
	$(subst /,\,if exist $(MSYS)/fonts/*.psf del $(MSYS)/fonts/*.psf)
	$(subst /,\,if exist $(O)install.tag del $(O)install.tag)
	$(subst /,\,if exist $(O)$(GAME).lnk del $(O)$(GAME).lnk)
	$(subst /,\,if exist $(O)obj.tag del $(O)obj.tag)
	$(subst /,\,if exist $(O)sp_lev.tag del $(O)sp_lev.tag)
	$(subst /,\,if exist $(O)thintile.tag del $(O)thintile.tag)
	$(subst /,\,if exist $(O)utility.tag del $(O)utility.tag)
	$(subst /,\,if exist temp.a del temp.a)

spotless: clean

	$(subst /,\,if exist $(U)makedefs.exe del $(U)makedefs.exe)
	$(subst /,\,if exist $(U)recover.exe del $(U)recover.exe)
	$(subst /,\,if exist $(U)tilemap.exe del $(U)tilemap.exe)
	$(subst /,\,if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe)
	$(subst /,\,if exist $(U)tile2bin.exe del $(U)tile2bin.exe)
	$(subst /,\,if exist $(U)til2bin2.exe del $(U)til2bin2.exe)
	$(subst /,\,if exist $(U)thintile.exe del $(U)thintile.exe)
	$(subst /,\,if exist $(U)dlb_main.exe del $(U)dlb_main.exe)
	$(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h)
	$(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h)
	$(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h)
	$(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c)
	$(subst /,\,if exist $(DAT)/options del $(DAT)/options)
	$(subst /,\,if exist $(DAT)/data del $(DAT)/data)
	$(subst /,\,if exist $(DAT)/rumors del $(DAT)/rumors)
	$(subst /,\,if exist $(DAT)/oracles del $(DAT)/oracles)
ifndef LUA_QTEXT_FILE
	$(subst /,\,if exist $(DAT)/quest.dat del $(DAT)/quest.dat)
endif
	$(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon)
	$(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave)
	$(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph)
	$(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst)
	$(subst /,\,if exist $(DAT)/nhdat del $(DAT)/nhdat)
	$(subst /,\,if exist $(TILE_BMP) del $(TILE_BMP))
	$(subst /,\,if exist $(WSHR)/monthin.txt del $(WSHR)/monthin.txt)
	$(subst /,\,if exist $(WSHR)/objthin.txt del $(WSHR)/objthin.txt)
	$(subst /,\,if exist $(WSHR)/oththin.txt del $(WSHR)/oththin.txt)

#==========================================
# Create directory for holding object files
#==========================================

$(O)obj.tag:
	-$(subst /,\,@if not exist $(OBJ)/*.* mkdir $(OBJ))
	@$(subst /,\,@echo directory created > $@)

#===========================================
# Work around some djgpp long file name woes
#===========================================

$(PATCHLEV_H):
	@$(subst /,\,if not exist $@ copy $(INCL)/patchlevel.h $(INCL)/patchlev.h)

#==========================================
# Game Dependencies
#==========================================

# sys/share
$(O)main.o:	 $(HACK_H) $(DLB_H) $(SSHR)/pcmain.c
	$(CC) $(cflags) -o$@ $(SSHR)/pcmain.c

$(O)tty.o:	 $(HACK_H) $(INCL)/wintty.h $(SSHR)/pctty.c
	$(CC) $(cflags) -o$@ $(SSHR)/pctty.c

$(O)unix.o:	 $(HACK_H) $(SSHR)/pcunix.c
	$(CC) $(cflags) -o$@ $(SSHR)/pcunix.c

#$(O)pcsys.o : $(HACK_H) $(SSHR)/pcsys.c
#	$(CC) $(cflags) -o$@ $(SSHR)/pcsys.c

$(O)posixreg.o : $(HACK_H) $(SSHR)/posixreg.c
	$(CC) $(cflags) -o$@ $(SSHR)/posixreg.c

#$(O)cppregex.o : $(HACK_H) $(SSHR)/cppregex.cpp
#	gpp $(cflags) -std=c++11 -o$@ $(SSHR)/cppregex.cpp

$(O)pmatchre.o : $(HACK_H) $(SSHR)/pmatchre.c
	$(CC) $(cflags) -o$@ $(SSHR)/pmatchre.c

# sys/msdos
$(O)msdos.o : $(HACK_H)  $(MSYS)/msdos.c
#	$(CC) $(cflags) -o$@ $(MSYS)/msdos.c

$(O)pckeys.o : $(HACK_H)  $(MSYS)/pckeys.c
#	$(CC) $(cflags) -o$@ $(MSYS)/pckeys.c

$(O)pctiles.o : $(HACK_H)  $(MSYS)/pctiles.c $(MSYS)/portio.h
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/pctiles.c

$(O)video.o : $(HACK_H)  $(MSYS)/pcvideo.h $(MSYS)/portio.h $(MSYS)/video.c
#	$(CC) $(cflags) -o$@ -I$(MSYS) $(MSYS)/video.c

$(O)vidvga.o : $(HACK_H)  $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidvga.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/vidvga.c

$(O)vidvesa.o : $(HACK_H)  $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidvesa.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/vidvesa.c

$(O)vidtxt.o : $(HACK_H)  $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidtxt.c
#	$(CC) $(cflags) -o$@ -I$(MSYS) $(MSYS)/vidtxt.c

$(O)font.o : $(HACK_H)  $(MSYS)/font.h $(MSYS)/font.c
	$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/font.c

$(O)stubvid.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/video.c
	$(CC) $(cflags) -I$(MSYS) -DSTUBVIDEO -o$@ $(MSYS)/video.c

# Dependencies

$(O)pmatchre.o: $(SSHR)/pmatchre.c $(HACK_H)
$(O)tileset.o: $(WSHR)/tileset.c $(HACK_H)
$(O)bmptiles.o: $(WSHR)/bmptiles.c $(INCL)/config.h $(INCL)/tileset.h $(INCL)/integer.h
$(O)giftiles.o: $(WSHR)/giftiles.c $(INCL)/config.h $(INCL)/tileset.h $(INCL)/integer.h
$(O)dlb.o: dlb.c $(CONFIG_H) $(INCL)/dlb.h
	$(CC) $(cflags) -I../sys/msdos -o$@ dlb.c

#
# The rest are stolen from sys/unix/Makefile.src,
# with the following changes:
#  * The CONFIG_H and HACK_H sections commented out.
#  * dlb.o is commented out because there's a rule above that includes
#    a .h file in ../sys/msdos.
#  * Window.o for X11 is commented out.
# Other than that, these dependencies are untouched.
# That means that there is some irrelevant stuff in here, but maintenance should be
# easier.
#
TARGETPFX=$(O)
TARGET_CC=$(CC)
TARGET_CFLAGS=$(cflags)
#
# DO NOT DELETE THIS LINE OR CHANGE ANYTHING BEYOND IT

# config.h timestamp
#$(CONFIG_H): ../include/config.h ../include/config1.h ../include/patchlevel.h \
#		../include/tradstdc.h ../include/integer.h \
#		../include/global.h ../include/coord.h ../include/vmsconf.h \
#		../include/cstd.h ../include/nhlua.h ../include/unixconf.h \
#		../include/pcconf.h ../include/micro.h ../include/windconf.h \
#		../include/warnings.h ../include/fnamesiz.h
#	touch $(CONFIG_H)
# hack.h timestamp
#$(HACK_H): ../include/hack.h $(CONFIG_H) ../include/lint.h ../include/align.h \
#		../include/dungeon.h ../include/wintype.h ../include/sym.h \
#		../include/defsym.h ../include/mkroom.h ../include/artilist.h \
#		../include/objclass.h ../include/objects.h \
#		../include/youprop.h ../include/prop.h ../include/permonst.h \
#		../include/monattk.h ../include/monflag.h \
#		../include/monsters.h ../include/mondata.h \
#		../include/context.h ../include/rm.h ../include/botl.h \
#		../include/rect.h ../include/region.h ../include/trap.h \
#		../include/display.h ../include/vision.h ../include/color.h \
#		../include/decl.h ../include/quest.h ../include/spell.h \
#		../include/obj.h ../include/engrave.h ../include/you.h \
#		../include/attrib.h ../include/monst.h ../include/mextra.h \
#		../include/skills.h ../include/timeout.h ../include/flag.h \
#		../include/winprocs.h ../include/sys.h
#	touch $(HACK_H)
#
$(TARGETPFX)pcmain.o: ../sys/share/pcmain.c $(HACK_H) ../include/dlb.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pcmain.c
$(TARGETPFX)pcsys.o: ../sys/share/pcsys.c $(HACK_H) ../include/wintty.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pcsys.c
$(TARGETPFX)pctty.o: ../sys/share/pctty.c $(HACK_H) ../include/wintty.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pctty.c
$(TARGETPFX)pcunix.o: ../sys/share/pcunix.c $(HACK_H) ../include/wintty.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pcunix.c
$(TARGETPFX)pmatchregex.o: ../sys/share/pmatchregex.c $(HACK_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/pmatchregex.c
$(TARGETPFX)posixregex.o: ../sys/share/posixregex.c $(HACK_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/posixregex.c
$(TARGETPFX)random.o: ../sys/share/random.c $(HACK_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/random.c
$(TARGETPFX)ioctl.o: ../sys/share/ioctl.c $(HACK_H) ../include/tcap.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/ioctl.c
$(TARGETPFX)unixtty.o: ../sys/share/unixtty.c $(HACK_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/share/unixtty.c
$(TARGETPFX)unixmain.o: ../sys/unix/unixmain.c $(HACK_H) ../include/dlb.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/unix/unixmain.c
$(TARGETPFX)unixunix.o: ../sys/unix/unixunix.c $(HACK_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/unix/unixunix.c
$(TARGETPFX)unixres.o: ../sys/unix/unixres.c $(CONFIG_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../sys/unix/unixres.c
$(TARGETPFX)getline.o: ../win/tty/getline.c $(HACK_H) ../include/wintty.h \
		../include/func_tab.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/tty/getline.c
$(TARGETPFX)termcap.o: ../win/tty/termcap.c $(HACK_H) ../include/wintty.h \
		../include/tcap.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/tty/termcap.c
$(TARGETPFX)topl.o: ../win/tty/topl.c $(HACK_H) ../include/tcap.h \
		../include/wintty.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/tty/topl.c
$(TARGETPFX)wintty.o: ../win/tty/wintty.c $(HACK_H) ../include/dlb.h \
		../include/tcap.h ../include/wintty.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/tty/wintty.c
$(TARGETPFX)cursmain.o: ../win/curses/cursmain.c $(HACK_H) ../include/wincurs.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursmain.c
$(TARGETPFX)curswins.o: ../win/curses/curswins.c $(HACK_H) \
		../include/wincurs.h ../win/curses/curswins.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/curswins.c
$(TARGETPFX)cursmisc.o: ../win/curses/cursmisc.c $(HACK_H) \
		../include/wincurs.h ../win/curses/cursmisc.h \
		../include/func_tab.h ../include/dlb.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursmisc.c
$(TARGETPFX)cursdial.o: ../win/curses/cursdial.c $(HACK_H) \
		../include/wincurs.h ../win/curses/cursdial.h \
		../include/func_tab.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursdial.c
$(TARGETPFX)cursstat.o: ../win/curses/cursstat.c $(HACK_H) \
		../include/wincurs.h ../win/curses/cursstat.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursstat.c
$(TARGETPFX)cursinit.o: ../win/curses/cursinit.c $(HACK_H) \
		../include/wincurs.h ../win/curses/cursinit.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursinit.c
$(TARGETPFX)cursmesg.o: ../win/curses/cursmesg.c $(HACK_H) \
		../include/wincurs.h ../win/curses/cursmesg.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursmesg.c
$(TARGETPFX)cursinvt.o: ../win/curses/cursinvt.c $(HACK_H) \
		../include/wincurs.h ../win/curses/cursinvt.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/curses/cursinvt.c
#$(TARGETPFX)Window.o: ../win/X11/Window.c ../include/xwindowp.h \
#		../include/xwindow.h $(CONFIG_H) ../include/lint.h \
#		../include/winX.h ../include/color.h ../include/wintype.h
#	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/Window.c
$(TARGETPFX)dialogs.o: ../win/X11/dialogs.c $(CONFIG_H) ../include/lint.h \
		../include/winX.h ../include/color.h ../include/wintype.h
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/dialogs.c
$(TARGETPFX)winX.o: ../win/X11/winX.c $(HACK_H) ../include/winX.h \
		../include/dlb.h ../include/xwindow.h ../win/X11/nh72icon \
		../win/X11/nh56icon ../win/X11/nh32icon
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winX.c
$(TARGETPFX)winmap.o: ../win/X11/winmap.c ../include/xwindow.h $(HACK_H) \
		../include/dlb.h ../include/winX.h ../include/tile2x11.h
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmap.c
$(TARGETPFX)winmenu.o: ../win/X11/winmenu.c $(HACK_H) ../include/winX.h
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmenu.c
$(TARGETPFX)winmesg.o: ../win/X11/winmesg.c ../include/xwindow.h $(HACK_H) \
		../include/winX.h
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmesg.c
$(TARGETPFX)winmisc.o: ../win/X11/winmisc.c $(HACK_H) ../include/func_tab.h \
		../include/winX.h
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winmisc.c
$(TARGETPFX)winstat.o: ../win/X11/winstat.c $(HACK_H) ../include/winX.h \
		../include/xwindow.h
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winstat.c
$(TARGETPFX)wintext.o: ../win/X11/wintext.c $(HACK_H) ../include/winX.h \
		../include/xwindow.h
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/wintext.c
$(TARGETPFX)winval.o: ../win/X11/winval.c $(HACK_H) ../include/winX.h
	$(TARGET_CC) $(TARGET_CFLAGS) $(X11CFLAGS) -c -o $@ ../win/X11/winval.c
$(TARGETPFX)tile.o: tile.c $(HACK_H)
$(TARGETPFX)winshim.o: ../win/shim/winshim.c $(HACK_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/shim/winshim.c
$(TARGETPFX)cppregex.o: ../sys/share/cppregex.cpp $(CONFIG_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../sys/share/cppregex.cpp
$(TARGETPFX)qt_bind.o: ../win/Qt/qt_bind.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
		../win/Qt/qt_kde0.h ../win/Qt/qt_click.h ../win/Qt/qt_delay.h \
		../win/Qt/qt_xcmd.h ../win/Qt/qt_key.h ../win/Qt/qt_map.h \
		../win/Qt/qt_win.h ../win/Qt/qt_clust.h ../win/Qt/qt_menu.h \
		../win/Qt/qt_rip.h ../win/Qt/qt_msg.h ../win/Qt/qt_plsel.h \
		../win/Qt/qt_svsel.h ../win/Qt/qt_set.h ../win/Qt/qt_stat.h \
		../win/Qt/qt_icon.h ../win/Qt/qt_streq.h ../win/Qt/qt_line.h \
		../win/Qt/qt_yndlg.h ../win/Qt/qt_str.h ../include/dlb.h \
		$(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_bind.cpp
$(TARGETPFX)qt_click.o: ../win/Qt/qt_click.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_click.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_click.cpp
$(TARGETPFX)qt_clust.o: ../win/Qt/qt_clust.cpp ../win/Qt/qt_clust.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_clust.cpp
$(TARGETPFX)qt_delay.o: ../win/Qt/qt_delay.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_delay.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_delay.cpp
$(TARGETPFX)qt_glyph.o: ../win/Qt/qt_glyph.cpp $(HACK_H) \
		../include/tile2x11.h ../win/Qt/qt_pre.h ../win/Qt/qt_post.h \
		../win/Qt/qt_glyph.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
		../win/Qt/qt_kde0.h ../win/Qt/qt_set.h ../win/Qt/qt_inv.h \
		../win/Qt/qt_map.h ../win/Qt/qt_win.h ../win/Qt/qt_clust.h \
		../win/Qt/qt_str.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_glyph.cpp
$(TARGETPFX)qt_icon.o: ../win/Qt/qt_icon.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_icon.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_icon.cpp
$(TARGETPFX)qt_inv.o: ../win/Qt/qt_inv.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_inv.h ../win/Qt/qt_glyph.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_set.h \
		../win/Qt/qt_bind.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_inv.cpp
$(TARGETPFX)qt_key.o: ../win/Qt/qt_key.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_key.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_key.cpp
$(TARGETPFX)qt_line.o: ../win/Qt/qt_line.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_line.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_line.cpp
$(TARGETPFX)qt_main.o: ../win/Qt/qt_main.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
		qt_main.moc ../win/Qt/qt_bind.h ../win/Qt/qt_glyph.h \
		../win/Qt/qt_inv.h ../win/Qt/qt_key.h ../win/Qt/qt_map.h \
		../win/Qt/qt_win.h ../win/Qt/qt_clust.h ../win/Qt/qt_msg.h \
		../win/Qt/qt_set.h ../win/Qt/qt_stat.h ../win/Qt/qt_icon.h \
		../win/Qt/qt_str.h qt_kde0.moc $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_main.cpp
$(TARGETPFX)qt_map.o: ../win/Qt/qt_map.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_map.h ../win/Qt/qt_win.h \
		../win/Qt/qt_clust.h qt_map.moc ../win/Qt/qt_click.h \
		../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h \
		$(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_map.cpp
$(TARGETPFX)qt_menu.o: ../win/Qt/qt_menu.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_menu.h ../win/Qt/qt_win.h \
		../win/Qt/qt_rip.h qt_menu.moc ../win/Qt/qt_key.h \
		../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_streq.h \
		../win/Qt/qt_line.h ../win/Qt/qt_str.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_menu.cpp
$(TARGETPFX)qt_msg.o: ../win/Qt/qt_msg.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_msg.h ../win/Qt/qt_win.h \
		qt_msg.moc ../win/Qt/qt_map.h ../win/Qt/qt_clust.h \
		../win/Qt/qt_set.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
		../win/Qt/qt_kde0.h ../win/Qt/qt_str.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_msg.cpp
$(TARGETPFX)qt_plsel.o: ../win/Qt/qt_plsel.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_plsel.h qt_plsel.moc \
		../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
		../win/Qt/qt_glyph.h ../win/Qt/qt_set.h ../win/Qt/qt_str.h \
		$(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_plsel.cpp
$(TARGETPFX)qt_rip.o: ../win/Qt/qt_rip.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_rip.h ../win/Qt/qt_bind.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h \
		$(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_rip.cpp
$(TARGETPFX)qt_set.o: ../win/Qt/qt_set.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h qt_set.moc \
		../win/Qt/qt_glyph.h ../win/Qt/qt_xcmd.h ../win/Qt/qt_str.h \
		$(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_set.cpp
$(TARGETPFX)qt_stat.o: ../win/Qt/qt_stat.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_stat.h ../win/Qt/qt_win.h \
		../win/Qt/qt_icon.h qt_stat.moc ../win/Qt/qt_set.h \
		../win/Qt/qt_bind.h ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h \
		../win/Qt/qt_str.h ../win/Qt/qt_xpms.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_stat.cpp
$(TARGETPFX)qt_str.o: ../win/Qt/qt_str.cpp ../win/Qt/qt_str.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_str.cpp
$(TARGETPFX)qt_streq.o: ../win/Qt/qt_streq.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_streq.h ../win/Qt/qt_line.h \
		../win/Qt/qt_str.h ../win/Qt/qt_set.h ../win/Qt/qt_bind.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_streq.cpp
$(TARGETPFX)qt_svsel.o: ../win/Qt/qt_svsel.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_svsel.h ../win/Qt/qt_bind.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_str.h \
		$(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_svsel.cpp
$(TARGETPFX)qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_win.h ../win/Qt/qt_bind.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_click.h \
		../win/Qt/qt_glyph.h ../win/Qt/qt_inv.h ../win/Qt/qt_key.h \
		../win/Qt/qt_icon.h ../win/Qt/qt_map.h ../win/Qt/qt_clust.h \
		../win/Qt/qt_menu.h ../win/Qt/qt_rip.h ../win/Qt/qt_msg.h \
		../win/Qt/qt_set.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_win.cpp
$(TARGETPFX)qt_xcmd.o: ../win/Qt/qt_xcmd.cpp $(HACK_H) ../include/func_tab.h \
		../win/Qt/qt_pre.h ../win/Qt/qt_post.h ../win/Qt/qt_xcmd.h \
		qt_xcmd.moc ../win/Qt/qt_key.h ../win/Qt/qt_bind.h \
		../win/Qt/qt_main.h ../win/Qt/qt_kde0.h ../win/Qt/qt_set.h \
		../win/Qt/qt_str.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_xcmd.cpp
$(TARGETPFX)qt_yndlg.o: ../win/Qt/qt_yndlg.cpp $(HACK_H) ../win/Qt/qt_pre.h \
		../win/Qt/qt_post.h ../win/Qt/qt_yndlg.h qt_yndlg.moc \
		../win/Qt/qt_key.h ../win/Qt/qt_str.h $(QTn_H)
	$(TARGET_CXX) $(TARGET_CXXFLAGS) -c -o $@ ../win/Qt/qt_yndlg.cpp
qt_kde0.moc: ../win/Qt/qt_kde0.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_kde0.h
qt_main.moc: ../win/Qt/qt_main.h ../win/Qt/qt_kde0.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_main.h
qt_map.moc: ../win/Qt/qt_map.h ../win/Qt/qt_win.h ../win/Qt/qt_clust.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_map.h
qt_menu.moc: ../win/Qt/qt_menu.h ../win/Qt/qt_win.h ../win/Qt/qt_rip.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_menu.h
qt_msg.moc: ../win/Qt/qt_msg.h ../win/Qt/qt_win.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_msg.h
qt_plsel.moc: ../win/Qt/qt_plsel.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_plsel.h
qt_set.moc: ../win/Qt/qt_set.h ../win/Qt/qt_bind.h ../win/Qt/qt_main.h \
		../win/Qt/qt_kde0.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_set.h
qt_stat.moc: ../win/Qt/qt_stat.h ../win/Qt/qt_win.h ../win/Qt/qt_icon.h \
		$(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_stat.h
qt_xcmd.moc: ../win/Qt/qt_xcmd.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_xcmd.h
qt_yndlg.moc: ../win/Qt/qt_yndlg.h $(QTn_H)
	$(MOCPATH) -o $@ ../win/Qt/qt_yndlg.h
$(TARGETPFX)wc_chainin.o: ../win/chain/wc_chainin.c $(HACK_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/chain/wc_chainin.c
$(TARGETPFX)wc_chainout.o: ../win/chain/wc_chainout.c $(HACK_H)
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/chain/wc_chainout.c
$(TARGETPFX)wc_trace.o: ../win/chain/wc_trace.c $(HACK_H) ../include/wintty.h \
		../include/func_tab.h
	$(TARGET_CC) $(TARGET_CFLAGS) -c -o $@ ../win/chain/wc_trace.c
$(TARGETPFX)allmain.o: allmain.c $(HACK_H)
$(TARGETPFX)alloc.o: alloc.c $(CONFIG_H)
$(TARGETPFX)apply.o: apply.c $(HACK_H)
$(TARGETPFX)artifact.o: artifact.c $(HACK_H) ../include/artifact.h
$(TARGETPFX)attrib.o: attrib.c $(HACK_H)
$(TARGETPFX)ball.o: ball.c $(HACK_H)
$(TARGETPFX)bones.o: bones.c $(HACK_H)
$(TARGETPFX)botl.o: botl.c $(HACK_H)
$(TARGETPFX)cmd.o: cmd.c $(HACK_H) ../include/func_tab.h
$(TARGETPFX)dbridge.o: dbridge.c $(HACK_H)
$(TARGETPFX)decl.o: decl.c $(HACK_H)
$(TARGETPFX)detect.o: detect.c $(HACK_H) ../include/artifact.h
$(TARGETPFX)dig.o: dig.c $(HACK_H)
$(TARGETPFX)display.o: display.c $(HACK_H)
#$(TARGETPFX)dlb.o: dlb.c $(CONFIG_H) ../include/dlb.h
$(TARGETPFX)do.o: do.c $(HACK_H)
$(TARGETPFX)do_name.o: do_name.c $(HACK_H)
$(TARGETPFX)do_wear.o: do_wear.c $(HACK_H)
$(TARGETPFX)dog.o: dog.c $(HACK_H)
$(TARGETPFX)dogmove.o: dogmove.c $(HACK_H) ../include/mfndpos.h
$(TARGETPFX)dokick.o: dokick.c $(HACK_H)
$(TARGETPFX)dothrow.o: dothrow.c $(HACK_H)
$(TARGETPFX)drawing.o: drawing.c $(CONFIG_H) ../include/color.h \
		../include/rm.h ../include/objclass.h ../include/defsym.h \
		../include/objects.h ../include/wintype.h ../include/sym.h
$(TARGETPFX)dungeon.o: dungeon.c $(HACK_H) ../include/dgn_file.h \
		../include/dlb.h
$(TARGETPFX)eat.o: eat.c $(HACK_H)
$(TARGETPFX)end.o: end.c $(HACK_H) ../include/dlb.h
$(TARGETPFX)engrave.o: engrave.c $(HACK_H)
$(TARGETPFX)exper.o: exper.c $(HACK_H)
$(TARGETPFX)explode.o: explode.c $(HACK_H)
$(TARGETPFX)extralev.o: extralev.c $(HACK_H)
$(TARGETPFX)files.o: files.c $(HACK_H) ../include/dlb.h ../include/wintty.h \
		#zlib.h
$(TARGETPFX)fountain.o: fountain.c $(HACK_H)
$(TARGETPFX)hack.o: hack.c $(HACK_H)
$(TARGETPFX)hacklib.o: hacklib.c $(HACK_H)
$(TARGETPFX)insight.o: insight.c $(HACK_H)
$(TARGETPFX)invent.o: invent.c $(HACK_H)
$(TARGETPFX)isaac64.o: isaac64.c $(CONFIG_H) ../include/isaac64.h
$(TARGETPFX)light.o: light.c $(HACK_H)
$(TARGETPFX)lock.o: lock.c $(HACK_H)
$(TARGETPFX)mail.o: mail.c $(HACK_H) ../include/mail.h
$(TARGETPFX)makemon.o: makemon.c $(HACK_H)
$(TARGETPFX)mcastu.o: mcastu.c $(HACK_H)
$(TARGETPFX)mdlib.o: mdlib.c $(CONFIG_H) ../include/permonst.h \
		../include/align.h ../include/monattk.h ../include/monflag.h \
		../include/monsters.h ../include/objclass.h \
		../include/defsym.h ../include/objects.h ../include/wintype.h \
		../include/sym.h ../include/artilist.h ../include/dungeon.h \
		../include/obj.h ../include/monst.h ../include/mextra.h \
		../include/you.h ../include/attrib.h ../include/prop.h \
		../include/skills.h ../include/context.h ../include/flag.h \
		../include/dlb.h
$(TARGETPFX)mhitm.o: mhitm.c $(HACK_H) ../include/artifact.h
$(TARGETPFX)mhitu.o: mhitu.c $(HACK_H) ../include/artifact.h
$(TARGETPFX)minion.o: minion.c $(HACK_H)
$(TARGETPFX)mklev.o: mklev.c $(HACK_H)
$(TARGETPFX)mkmap.o: mkmap.c $(HACK_H) ../include/sp_lev.h
$(TARGETPFX)mkmaze.o: mkmaze.c $(HACK_H) ../include/sp_lev.h
$(TARGETPFX)mkobj.o: mkobj.c $(HACK_H)
$(TARGETPFX)mkroom.o: mkroom.c $(HACK_H)
$(TARGETPFX)mon.o: mon.c $(HACK_H) ../include/mfndpos.h
$(TARGETPFX)mondata.o: mondata.c $(HACK_H)
$(TARGETPFX)monmove.o: monmove.c $(HACK_H) ../include/mfndpos.h \
		../include/artifact.h
$(TARGETPFX)monst.o: monst.c $(CONFIG_H) ../include/permonst.h \
		../include/align.h ../include/monattk.h ../include/monflag.h \
		../include/monsters.h ../include/wintype.h ../include/sym.h \
		../include/defsym.h ../include/color.h
$(TARGETPFX)mplayer.o: mplayer.c $(HACK_H)
$(TARGETPFX)mthrowu.o: mthrowu.c $(HACK_H)
$(TARGETPFX)muse.o: muse.c $(HACK_H)
$(TARGETPFX)music.o: music.c $(HACK_H)
$(TARGETPFX)nhlua.o: nhlua.c $(HACK_H) ../include/dlb.h
$(TARGETPFX)nhlsel.o: nhlsel.c $(HACK_H) ../include/sp_lev.h
$(TARGETPFX)nhlobj.o: nhlobj.c $(HACK_H) ../include/sp_lev.h
$(TARGETPFX)o_init.o: o_init.c $(HACK_H)
$(TARGETPFX)objects.o: objects.c $(CONFIG_H) ../include/obj.h \
		../include/prop.h ../include/skills.h ../include/color.h \
		../include/objclass.h ../include/defsym.h ../include/objects.h
$(TARGETPFX)objnam.o: objnam.c $(HACK_H)
$(TARGETPFX)options.o: options.c $(CONFIG_H) ../include/objclass.h \
		../include/defsym.h ../include/objects.h ../include/flag.h \
		$(HACK_H) ../include/tcap.h ../include/optlist.h
$(TARGETPFX)pager.o: pager.c $(HACK_H) ../include/dlb.h
$(TARGETPFX)pickup.o: pickup.c $(HACK_H)
$(TARGETPFX)pline.o: pline.c $(HACK_H)
$(TARGETPFX)polyself.o: polyself.c $(HACK_H)
$(TARGETPFX)potion.o: potion.c $(HACK_H)
$(TARGETPFX)pray.o: pray.c $(HACK_H)
$(TARGETPFX)priest.o: priest.c $(HACK_H) ../include/mfndpos.h
$(TARGETPFX)quest.o: quest.c $(HACK_H)
$(TARGETPFX)questpgr.o: questpgr.c $(HACK_H) ../include/dlb.h \
		../include/wintty.h
$(TARGETPFX)read.o: read.c $(HACK_H)
$(TARGETPFX)rect.o: rect.c $(HACK_H)
$(TARGETPFX)region.o: region.c $(HACK_H)
$(TARGETPFX)restore.o: restore.c $(HACK_H) ../include/tcap.h
$(TARGETPFX)rip.o: rip.c $(HACK_H)
$(TARGETPFX)rnd.o: rnd.c $(HACK_H) ../include/isaac64.h
$(TARGETPFX)role.o: role.c $(HACK_H)
$(TARGETPFX)rumors.o: rumors.c $(HACK_H) ../include/dlb.h
$(TARGETPFX)save.o: save.c $(HACK_H)
$(TARGETPFX)sfstruct.o: sfstruct.c $(HACK_H)
$(TARGETPFX)shk.o: shk.c $(HACK_H)
$(TARGETPFX)shknam.o: shknam.c $(HACK_H)
$(TARGETPFX)sit.o: sit.c $(HACK_H) ../include/artifact.h
$(TARGETPFX)sounds.o: sounds.c $(HACK_H)
$(TARGETPFX)sp_lev.o: sp_lev.c $(HACK_H) ../include/sp_lev.h
$(TARGETPFX)spell.o: spell.c $(HACK_H)
$(TARGETPFX)steal.o: steal.c $(HACK_H)
$(TARGETPFX)steed.o: steed.c $(HACK_H)
$(TARGETPFX)symbols.o: symbols.c $(HACK_H) ../include/tcap.h
$(TARGETPFX)sys.o: sys.c $(HACK_H)
$(TARGETPFX)teleport.o: teleport.c $(HACK_H)
$(TARGETPFX)timeout.o: timeout.c $(HACK_H)
$(TARGETPFX)topten.o: topten.c $(HACK_H) ../include/dlb.h
$(TARGETPFX)track.o: track.c $(HACK_H)
$(TARGETPFX)trap.o: trap.c $(HACK_H)
$(TARGETPFX)u_init.o: u_init.c $(HACK_H)
$(TARGETPFX)utf8map.o: utf8map.c $(HACK_H)
$(TARGETPFX)uhitm.o: uhitm.c $(HACK_H)
$(TARGETPFX)vault.o: vault.c $(HACK_H)
$(TARGETPFX)version.o: version.c $(HACK_H) ../include/dlb.h
$(TARGETPFX)vision.o: vision.c $(HACK_H)
$(TARGETPFX)weapon.o: weapon.c $(HACK_H)
$(TARGETPFX)were.o: were.c $(HACK_H)
$(TARGETPFX)wield.o: wield.c $(HACK_H)
$(TARGETPFX)windows.o: windows.c $(HACK_H) ../include/wintty.h
$(TARGETPFX)wizard.o: wizard.c $(HACK_H)
$(TARGETPFX)worm.o: worm.c $(HACK_H)
$(TARGETPFX)worn.o: worn.c $(HACK_H)
$(TARGETPFX)write.o: write.c $(HACK_H)
$(TARGETPFX)zap.o: zap.c $(HACK_H)
# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
