#       $Id: Makefile.gcc,v 1.49 2004/01/20 20:58:47 entro-p Exp $
#       Copyright (c) NetHack PC Development Team 1993-2003
#       Copyright (c) Karl Garrison 1999
#       Copyright (c) Slash'EM Development Team 1999-2003
#
#       Slash'EM 0.0.7 Makefile for MinGW 2.0 and above and Gtk+ 2.0 and above
#  
#       Win32 systems tested:
#				- Windows 95
#				- Windows 2000 SP1
#
#       Win32 compilers tested:
#				- MinGW 2.0.0-3
#
#	Win32 libraries tested:
#				- Gtk+ Development Environment 2.2.4.1
#
#       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 sys/winnt/Install.gcc file included 
#       with the distribution.
#
#       Note that compiling will fail under WinNT (including Win2k and XP) if
#       the command line gets too long (eg., your directory names are longer
#       than the default).

# Game Installation Variables

GAME = slashem
# The GNU Make has a problem if you include a drive spec below (unfortunately).
GAMEDIR = \games\slam32d

#
# Directories
#

# These are for MinGW's GCC,  which gets confused by \ 
DDAT  = ../dat
DUTIL = ../util
DSRC  = ../src
DINCL = ../include
NTSYS = ../sys/winnt
MW32GTK = /win-gtk

# Normal dos commands get confused by \\
DAT  = ..\dat
DOC  = ..\doc
INCL = ..\include
WSYS = ..\sys\winnt
SRC  = ..\src
SSHR = ..\sys\share
UTIL = ..\util
WTTY = ..\win\tty
WIN32 = ..\win\win32
WGTK = ..\win\gtk
WSHR = ..\win\share

#
#  Executables.

CC     = gcc
RC     = windres
LINK   = gcc

#
# The MinGW switch needed to specify Microsoft packing & alignment rules
# (use gcc --target-help if you're not sure)
MS_BITFIELDS = -mms-bitfields
# MS_BITFIELDS = -fnative-struct

# The copy, del and echo commands don't work from a makefile since they are
# internal shell commands rather than external utilities.  We can get around
# this by specifying an external utility that performs the same function like
# the cp and rm commands from Cygwin32, or xcopy for copy.  Another way to do
# it is to call the shell explicitly and use the /c option to run the built-in
# command.  All of these examples appear below.

#COPY = command.com /c copy
#COPY = cmd.exe /c copy	# Same as above, but for Windows NT
#COPY = xcopy		# MSDOS xcopy command (asks if target File or Dir)
#COPY = cp		# UNIX copy command
COPY = copy /y		# MSDOS copy command (gets confused by '+')
RCOPY = xcopy /y /s
#RCOPY = cp -r
#DEL = command.com /c del
#DEL = cmd.exe /c del	# Same as above, but for Windows NT
#DEL = rm -f 		# UNIX del command
DEL = del 		# MSDOS del command
#RDEL = deltree		# Win 95 recursive del command
RDEL = rd /s /q		# Win 2K recursive del command
#RDEL = rm -rf
# Echo is very sensitive to trailing spaces so comments should be avoided
# on the following lines, which define Win95, NT, UNIX and MS-DOS versions.
#ECHO = command.com /c echo
#ECHO = cmd.exe /c echo
#ECHO = echo.exe
ECHO = echo
#LS = ls -1		# ls.exe from djgpp distribution
LS = dir /l/b/-p	# DOS command WAC - disable pause for dos6
#LS = *dir /l/b/z	# 4DOS command - cuts through ALIASes

#
#  Yacc/Lex ... if you got 'em.
#
# If you have yacc/lex or a work-alike set YACC_LEX to Y
#
YACC_LEX = N

# If YACC_LEX is Y above, set the following to values appropriate for
# your tools.
#
YACC   = bison -y -o y_tab.c
LEX    = flex
# Win32 versions
#YTABC  = y.tab.c
#YTABH  = y.tab.h
#LEXYYC = lex.yy.c
# DJGPP bison/lex doesn't use LFN
YTABC  = y_tab.c
YTABH  = y_tab.h
LEXYYC = lexyy.c

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

USE_DLB = Y

# 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

#
# Uncomment the line below if you want to compile with the native
# MS-Windows graphics windowsystem.  You will also need to define
# MSWIN_GRAPHICS in config.h.

# USE_MSWIN = Y

#
# Uncomment the line below if you want to compile with the GTK windowsystem.
# You will also need to define GTK_GRAPHICS in config.h.

# USE_GTK = Y

#
# Uncomment the line below if you want to compile with the proxy system.
# You will also need to define PROXY_GRAPHICS in config.h.

# USE_PROXY = Y

#
# Uncomment USE_GTK, USE_PROXY and the line below if you want to build a
# proxified GTK interface.  You will also need to define GTK_PROXY in config.h.

# USE_PROXIFIED = Y

#
# Uncomment the line below if you want to compile with the internal malloc
# routines (used to test for memory leaks).
# You will also need to define MONITOR_HEAP and INTERNAL_MALLOC in config.h
#
# Warning: Doing this increases the risk of a non-recoverable game crash.

# USE_NHALLOC = Y


#############################################################################
#
# nothing below this line should have to be changed
#

SOUND = ntsound.o

#SOUND =

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

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

#
#  Flags.
#
ifeq ($(SUPPRESS_GRAPHICS),Y)
TERMLIB =
# Build NetHack suitable for blind players

# Debugging
#CFLAGS = -pg -c -I../include $(DLBFLG) -DSUPPRESS_GRAPHICS
#LFLAGS = -pg

CFLAGS = -c -O -I../include $(DLBFLG) -DSUPPRESS_GRAPHICS
LFLAGS =

else

# Debugging
#CFLAGS = -pg -c -I..\include $(DLBFLG)
#LFLAGS = -pg

#    Normal
CFLAGS = -c -O -I../include $(DLBFLG)
LFLAGS =

# Comment out this line if you have also commented out TTY_GRAPHICS in config.h
CFLAGS += -DWIN32CON
endif

# The pkg-config executable
PKG_CONFIG = $(MW32GTK)/bin/pkg-config
# A semi-colon seperated list of directories to add to the path when
# calling pkg-config so that MS-Windows can find the DLLs needed.
PKG_CONFIG_DLL = $(MW32GTK)/lib
# A semi-colon seperated list of directories to add to PKG_CONFIG_PATH
# so that pkg-config can find the package config files (eg., gtk+-2.0.pc).
PKG_CONFIG_PATH = $(MW32GTK)/lib/pkgconfig
# The pkg-config commands
GTKCFLAGS = $(PKG_CONFIG) --cflags gtk+-2.0 libpng
GTKLIBS = $(PKG_CONFIG) --libs gtk+-2.0 libpng

# Select Windowing system(s) below
# GTK windowing system
WINGTKCFLAGS=

# Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired
# combination of windowing systems.  Also set windowing systems in config.h.
#
# files for a straight tty port using no native windowing system
WINTTYSRC = ../win/tty/getline.c ../win/tty/termcap.c ../win/tty/topl.c \
	../win/tty/wintty.c 
WINTTYOBJ = getline.o termcap.o topl.o wintty.o 
#
# files for a native MS-Windows port
# (tile.c is included in the defn. for WINCSRC, below)
ifeq ($(USE_MSWIN),Y)
WINMSCFLAGS=-I../win/win32 -D_WIN32_IE=0x0400
WINMSSRC = ../win/win32/mswproc.c ../win/win32/winhack.c ../win/win32/mhdlg.c \
	../win/win32/mhaskyn.c ../win/win32/mhfont.c ../win/win32/mhinput.c \
	../win/win32/mhmain.c ../win/win32/mhmsgwnd.c ../win/win32/mhsplash.c \
	../win/win32/mhstatus.c ../win/win32/mhtext.c ../win/win32/mhmenu.c \
	../win/win32/mhmap.c ../win/win32/mhrip.c
WINMSOBJ1 = mswproc.o winhack.o mhdlg.o mhaskyn.o mhfont.o mhinput.o mhmain.o
WINMSOBJ2 = mhmsgwnd.o mhsplash.o mhstatus.o mhtext.o mhmenu.o mhmap.o mhrip.o
endif
#
# files for a GTK port
# (tile.c is included in the defn. for WINCSRC, below)
ifeq ($(USE_GTK),Y)
WINGTKSRC = ../win/gtk/gtk.c ../win/gtk/gtkgetlin.c ../win/gtk/gtkstatus.c \
	../win/gtk/gtkmenu.c ../win/gtk/gtkyn.c ../win/gtk/gtkextcmd.c \
	../win/gtk/gtkmap.c ../win/gtk/gtkmessage.c ../win/gtk/gtkmisc.c \
	../win/gtk/xshmmap.c ../win/gtk/gtktile.c ../win/gtk/gtkhackrc.c \
	../win/gtk/gtkprefs.c ../win/gtk/gtkprogress.c ../win/gtk/gtkint.c \
	../win/gtk/gtkext.c
WINGTKOBJ1 = gtk.o gtkgetlin.o gtkstatus.o gtkmenu.o gtkyn.o gtkextcmd.o \
	gtkmap.o gtkmessage.o gtkmisc.o xshmmap.o
WINGTKOBJ2 = gtktile.o gtkhackrc.o gtkprefs.o gtkprogress.o gtkint.o gtkext.o
endif
#
# Files for a proxy interface.
ifeq ($(USE_PROXY),Y)
WINPROXYSRC = ../win/proxy/winproxy.c ../win/proxy/callback.c
WINPROXYOBJ = winproxy.o callback.o
endif
#
# Common files for proxy window interface and window servers.
PROXYCOMSRC = ../win/proxy/nhext.c ../win/proxy/nhxdr.c \
	../win/proxy/nhextxdr.c ../win/proxy/nhextio.c ../win/proxy/nhextnb.c \
	../win/proxy/compxdr.c
PROXYCOMOBJ = nhext.o nhxdr.o nhextxdr.o nhextio.o nhextnb.o compxdr.o
# Common files that are also shared with non-proxy window interfaces
PROXYSHRSRC = ../win/proxy/md5.c
PROXYSHROBJ = md5.o
# Files for the proxy utility modules. These are provided for use with window
# ports that support the proxy interface. The GTK window interface needs
# these files regardless of whether proxy support is enabled or not.
PROXYUTLSRC = ../win/proxy/dlbh.c ../win/proxy/mapid.c \
	../win/proxy/riputil.c ../win/proxy/getopt.c ../win/proxy/glyphmap.c
PROXYUTLOBJ = dlbh.o mapid.o riputil.o getopt.o glyphmap.o
#
# Files for plug-in window interfaces. These are needed to support external
# window ports and provide the interface to the game executable.  Currently,
# only the GTK window interface supports plug-in window interfaces.
PROXYCLNTSRC = ../win/proxy/proxysvc.c ../win/proxy/proxycb.c \
	../win/proxy/prxymap.c ../win/proxy/prxychar.c ../win/proxy/prxytile.c \
	../win/proxy/prxyconn.c
PROXYCLNTOBJ = proxysvc.o proxycb.o prxymap.o prxychar.o prxytile.o prxyconn.o

WINSRC = $(WINTTYSRC)
WOBJ01 = $(WINTTYOBJ)
WOBJ02 =
WOBJ03 =
WOBJ04 =

CCOMPILE = $(CC) $(MS_BITFIELDS)

ifeq ($(USE_MSWIN),Y)
USE_GUI = Y
WINSRC += $(WINMSSRC)
WOBJ02 += $(WINMSOBJ1)
WOBJ03 += $(WINMSOBJ2)
WOBJ04 += winres.o tile.o
LFLAGS += -mwindows -Wl,-Map,slashem.map -v
else	# USE_MSWIN
ifeq ($(USE_GTK),Y)
USE_GUI = Y
USE_PNG = Y
WINSRC += $(WINGTKSRC)
WOBJ02 += $(WINGTKOBJ1)
WOBJ03 += $(WINGTKOBJ2)
LFLAGS += -mwindows
ifneq ($(USE_PROXY),Y)
WINSRC += $(PROXYUTLSRC) $(PROXYSHRSRC)
WOBJ04 += tile.o
WOBJ05 += $(PROXYUTLOBJ) $(PROXYSHROBJ)
endif	# USE_PROXY
endif	# USE_GTK
endif	# USE_MSWIN

ifeq ($(USE_PROXY),Y)
USE_PNG = Y
WINSRC += $(WINPROXYSRC) $(PROXYUTLSRC) $(PROXYCOMSRC) $(PROXYSHRSRC)
WOBJ02 += $(WINPROXYOBJ)
WOBJ03 += $(PROXYCOMOBJ) $(PROXYSHROBJ)
ifneq ($(USE_MSWIN),Y)
WOBJ04 += tile.o
endif
WOBJ05 += $(PROXYUTLOBJ)
endif

ifeq ($(USE_PROXIFIED),Y)
WINSRC += $(PROXYCLNTSRC)
WOBJ04 += $(PROXYCLNTOBJ)
endif

WINOBJ = $(WOBJ01) $(WOBJ02) $(WOBJ03) $(WOBJ04) $(WOBJ05)

#
# The definition of WINLIB (below) must also be changed to match
# WINSRC & WINOBJ.
#

WINTTYLIB =

# libraries for native MS-Windows
ifeq ($(USE_MSWIN),Y)
WINMSLIB = libcomctl32.a libgdi32.a
endif

# libraries for GTK
# Note: cc-gtk handles Gtk+ and its dependencies.
ifeq ($(USE_GTK),Y)
WINGTKLIB =
endif

ifeq ($(USE_PROXY),Y)
WINPROXYLIB = libwsock32.a
endif

WINLIB = $(WINTTYLIB)

ifeq ($(USE_MSWIN),Y)
WINLIB += $(WINMSLIB)
endif

ifeq ($(USE_GTK),Y)
WINLIB +=$(WINGTKLIB)
endif

ifeq ($(USE_PROXY),Y)
WINLIB += $(WINPROXYLIB)
endif

# Shareable (architecture independent) data files which are not candidates
# for inclusion in DLB libraries (ND). Port specific files per discussions
# in Install.GTK and Install.pxy
CNF_SHARE_GTKND = gltile16.png gltile32.png gltile64.png rip.xpm credit.xpm
CNF_SHARE_PROXYND = gltile16.png gltile32.png gltile64.png \
		gltile16.map gltile32.map gltile64.map

ifeq ($(USE_GTK),Y)
CNF_SHARE_DATND += $(CNF_SHARE_GTKND)
endif

ifeq ($(USE_PROXY),Y)
CNF_SHARE_DATND += $(CNF_SHARE_PROXYND)
endif

ifeq ($(USE_PNG),Y)
CCGTK = cc-gtk -v -c $(CCOMPILE)
endif

#
#  Utility Objects.
#

ifeq ($(USE_NHALLOC),Y)
NHALLOCOBJ = nhalloc.o
NHALLOCDLL = nhalloc.dll
NHALLOCA = nhalloc.a
else
NHALLOCOBJ =
NHALLOCDLL =
NHALLOCA =
endif

MAKESRC	    = makedefs.c

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

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

MAKEOBJS    = makedefs.o  monst.o	 objects.o alloc.o panic.o $(NHALLOCOBJ)

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

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

RECOVOBJS   = recover.o


#  Tile related object files.

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

else

TEXTIO      = tiletext.o tiletxt.o drawing.o decl.o monst.o objects.o \
              panic.o alloc.o $(NHALLOCOBJ)

TEXTIO2     = tiletex2.o tiletxt2.o drawing.o decl.o monst.o objects.o \
              panic.o alloc.o $(NHALLOCOBJ)


PLANAR_TIB  = NetHack1.tib

OVERVIEW_TIB = NetHacko.tib

DLBOBJ = dlb.o
endif


#  Object files for the game itself.

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

SOBJ   = winnt.o    pcsys.o    pcunix.o   nttty.o    random.o \
	 $(SOUND)   nhlan.o
#	 $(SOUND)   mapimail.o nhlan.o

SYSLIB = libwinmm.a

VVOBJ  = version.o

VOBJ   = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \
	$(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \
	$(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \
	$(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \
	$(VOBJ21) $(VOBJ22) $(VOBJ23)

ALLOBJ = $(VOBJ) $(SOBJ) $(VVOBJ) $(WINOBJ)

#
#  Header Objects.
#

DGN_FILE_H = $(INCL)\align.h	$(INCL)\dgn_file.h
DUNGEON_H  = $(INCL)\align.h	$(INCL)\dungeon.h
EMIN_H	   = $(DUNGEON_H)	$(INCL)\emin.h
EPRI_H	   = $(DUNGEON_H)	$(INCL)\align.h	    $(INCL)\epri.h
ESHK_H	   = $(DUNGEON_H)	$(INCL)\eshk.h
MONDATA_H  = $(INCL)\align.h	$(INCL)\mondata.h
MONST_H	   = $(INCL)\align.h	$(INCL)\monst.h
NHLAN_H    = $(INCL)\nhlan.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
VAULT_H	   = $(DUNGEON_H)	$(INCL)\vault.h
YOUPROP_H  = $(PERMONST_H)	$(MONDATA_H)	    $(INCL)\prop.h    \
	     $(INCL)\pm.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
NTCONF_H   = $(INCL)\micro.h	$(INCL)\system.h    $(INCL)\ntconf.h
CONFIG_H   = $(GLOBAL_H)	$(INCL)\tradstdc.h  $(INCL)\config1.h \
	     $(INCL)\config.h
DECL_H	   = $(YOU_H)		$(INCL)\spell.h	    $(INCL)\color.h   \
	     $(INCL)\obj.h	$(INCL)\onames.h    $(INCL)\pm.h      \
	     $(INCL)\decl.h
GLOBAL_H   = $(NTCONF_H)	$(INCL)\coord.h	    $(INCL)\global.h
HACK_H	   = $(CONFIG_H)	$(DUNGEON_H)	    $(DECL_H)	      \
	     $(DISPLAY_H)	$(INCL)\monsym.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)\trampoli.h
DLB_H      = $(INCL)\dlb.h

#ifeq ($(SUPPRESS_GRAPHICS),Y)
#TILE_H     =
#else
#TILE_H	   = $(INCL)\tile.h $(INCL)\pctiles.h
#endif

ifeq ($(USE_DLB),Y)
DLB = $(DAT)\nhshare $(DAT)\nhushare
DLBOBJS = dlb_main.o dlb.o alloc.o panic.o $(NHALLOCOBJ)
else
DLB =
DLBOBJS =
endif

#
#  Make Rules.
#

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

.c.o:
	$(CCOMPILE) $(CFLAGS) -o$@ $<

#.phony: dlb

#
#  Primary Targets.
#

#  The default target.

default: $(GAMEFILE)

all: install.tag

util: utility.tag

install: install.tag

utility.tag: $(INCL)\date.h $(INCL)\trap.h    $(INCL)\onames.h	       \
	$(INCL)\pm.h	  monstr.c   vis_tab.c	$(INCL)\filename.h\
	lev_comp.exe	 dgn_comp.exe	 recover.exe $(TILEUTIL)
	$(ECHO) utilities made > utility.tag

install.tag: $(GAMEFILE) dat.tag
ifeq ($(USE_DLB),Y)
	$(COPY) $(DAT)\nhshare				$(GAMEDIR)
	$(COPY) $(DAT)\nhushare				$(GAMEDIR)
	$(COPY) $(DAT)\license				$(GAMEDIR)
	$(COPY) $(DAT)\opthelp				$(GAMEDIR)
else
	$(COPY) $(DAT)\*.				$(GAMEDIR)
	$(COPY) $(DAT)\*.dat				$(GAMEDIR)
	$(COPY) $(DAT)\*.lev				$(GAMEDIR)
#	$(DEL) $(GAMEDIR)\makefile.
endif
ifeq ($(USE_GTK),Y)
	$(COPY) $(subst /,\,$(WGTK)\GTKRC.w32		$(GAMEDIR)\gtkrc)
	$(COPY) $(subst /,\,rip.xpm			$(GAMEDIR))
	$(COPY) $(subst /,\,credit.xpm			$(GAMEDIR))
	$(COPY) $(subst /,\,$(WSYS)\winnt.cnf		$(GAMEDIR)\defaults.nh)
else
	$(COPY) $(subst /,\,$(WSYS)\defaults.nh		$(GAMEDIR)\defaults.nh)
endif
ifeq ($(USE_PROXY),Y)
	$(COPY) $(subst /,\,gltile16.map		$(GAMEDIR))
	$(COPY) $(subst /,\,gltile32.map		$(GAMEDIR))
	$(COPY) $(subst /,\,gltile64.map		$(GAMEDIR))
endif
ifeq ($(USE_PNG),Y)
	$(COPY) $(subst /,\,gltile16.png		$(GAMEDIR))
	$(COPY) $(subst /,\,gltile32.png		$(GAMEDIR))
	$(COPY) $(subst /,\,gltile64.png		$(GAMEDIR))
endif
ifeq ($(USE_NHALLOC),Y)
	$(COPY) $(subst /,\,nhalloc.dll			$(GAMEDIR))
endif
	$(COPY) $(subst /,\,recover.exe			$(GAMEDIR))
	$(COPY) $(subst /,\,$(DOC)\guidebook.txt	$(GAMEDIR))
	$(COPY) $(subst /,\,$(DOC)\recover.txt		$(GAMEDIR))
	$(COPY) $(subst /,\,$(DOC)\slashem.txt		$(GAMEDIR))
	$(ECHO) install done > install.tag

#  The main target.

gamedir.tag:
	$(subst /,\,@if not exist $(GAMEDIR)/*.* echo creating directory $(GAMEDIR))
	$(subst /,\,@if not exist $(GAMEDIR)/*.* mkdir $(GAMEDIR))
	$(subst /,\,@echo directory created > $@)

FORCE:

ifeq ($(USE_PNG),Y)
cc-gtk.h:	FORCE
	@echo #define PKG_CONFIG_DLL "$(PKG_CONFIG_DLL)" > cc-gtk.h
	@echo #define PKG_CONFIG_PATH "$(PKG_CONFIG_PATH)" >> cc-gtk.h
	@echo #define GTKCFLAGS "$(GTKCFLAGS)" >> cc-gtk.h
	@echo #define GTKLIBS "$(GTKLIBS)" >> cc-gtk.h

cc-gtk.exe:	$(WGTK)\cc-gtk.c cc-gtk.h
	$(COPY) $(WGTK)\cc-gtk.c .
	$(CC) -o$@ cc-gtk.c
endif

ifeq ($(USE_GTK),Y)
$(GAMEFILE): cc-gtk.exe gamedir.tag utility.tag $(NHALLOCDLL) $(NHALLOCA) \
		$(ALLOBJ) $(GAME).lnk $(GAMEDIR)/nhdefkey.dll \
		$(GAMEDIR)/nh340key.dll $(GAMEDIR)/nhraykey.dll
	cc-gtk -l $(LINK) $(LFLAGS) $(GTKGCCFLAGS) -o$(GAME).exe $(GAME).lnk
	$(COPY) $(GAME).exe $(GAMEFILE)
	$(DEL) $(GAME).exe
else
$(GAMEFILE): gamedir.tag utility.tag $(NHALLOCDLL) $(NHALLOCA) \
		$(ALLOBJ) $(GAME).lnk $(GAMEDIR)/nhdefkey.dll \
		$(GAMEDIR)/nh340key.dll $(GAMEDIR)/nhraykey.dll
	$(LINK) $(LFLAGS) $(GTKGCCFLAGS) -o$(GAME).exe $(GAME).lnk
	$(COPY) $(GAME).exe $(GAMEFILE)
	$(DEL) $(GAME).exe
endif

nhdefkey.o:
	$(CCOMPILE) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nhdefkey.c

$(GAMEDIR)/nhdefkey.dll: nhdefkey.o gamedir.tag
	@echo Linking $@
	$(CCOMPILE) -shared -Wl,--export-all-symbols \
		-Wl,--add-stdcall-alias -o $@ $<

nh340key.o:
	$(CCOMPILE) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nh340key.c

$(GAMEDIR)/nh340key.dll: nh340key.o gamedir.tag
	@echo Linking $@
	$(CCOMPILE) -shared -Wl,--export-all-symbols \
		-Wl,--add-stdcall-alias -o $@ $<

nhraykey.o:
	$(CCOMPILE) $(CFLAGS) -DBUILD_DLL -o$@ $(NTSYS)/nhraykey.c

$(GAMEDIR)/nhraykey.dll: nhraykey.o gamedir.tag
	@echo Linking $@
	$(CCOMPILE) -shared -Wl,--export-all-symbols \
		-Wl,--add-stdcall-alias -o $@ $<

$(GAME).lnk: $(ALLOBJ)
	@echo INPUT( $(VOBJ01) )> $@
	@echo INPUT( $(VOBJ02) )>> $@
	@echo INPUT( $(VOBJ03) )>> $@
	@echo INPUT( $(VOBJ04) )>> $@
	@echo INPUT( $(VOBJ05) )>> $@
	@echo INPUT( $(VOBJ06) )>> $@
	@echo INPUT( $(VOBJ07) )>> $@
	@echo INPUT( $(VOBJ08) )>> $@
	@echo INPUT( $(VOBJ09) )>> $@
	@echo INPUT( $(VOBJ10) )>> $@
	@echo INPUT( $(VOBJ11) )>> $@
	@echo INPUT( $(VOBJ12) )>> $@
	@echo INPUT( $(VOBJ13) )>> $@
	@echo INPUT( $(VOBJ14) )>> $@
	@echo INPUT( $(VOBJ15) )>> $@
	@echo INPUT( $(VOBJ16) )>> $@
	@echo INPUT( $(VOBJ17) )>> $@
	@echo INPUT( $(VOBJ18) )>> $@
	@echo INPUT( $(VOBJ19) )>> $@
	@echo INPUT( $(VOBJ20) )>> $@
	@echo INPUT( $(VOBJ21) )>> $@
	@echo INPUT( $(VOBJ22) )>> $@
	@echo INPUT( $(VOBJ23) )>> $@
	@echo INPUT( $(SOBJ)   )>> $@
	@echo INPUT( $(VVOBJ)  )>> $@
	@echo INPUT( $(WOBJ01) )>> $@
ifneq ($(WOBJ02),)
	@echo INPUT( $(WOBJ02) )>> $@
endif
ifneq ($(WOBJ03),)
	@echo INPUT( $(WOBJ03) )>> $@
endif
ifneq ($(WOBJ04),)
	@echo INPUT( $(WOBJ04) )>> $@
endif
ifneq ($(WOBJ05),)
	@echo INPUT( $(WOBJ05) )>> $@
endif
ifneq ($(WINLIB),)
	@echo INPUT( $(WINLIB) )>> $@
endif
ifneq ($(SYSLIB),)
	@echo INPUT( $(SYSLIB) )>> $@
endif
ifeq ($(USE_NHALLOC),Y)
	@echo INPUT( nhalloc.a )>> $@
endif

#
#  Housekeeping.
#

clean:
	-$(DEL) *.o
	-$(DEL) *.map
	-$(DEL) nhalloc.*
	-$(DEL) dlb_main.exe

spotless: clean
	-$(DEL) gamedir.tag
	-$(DEL) utility.tag
	-$(DEL) install.tag
	-$(DEL) dat.tag
	-$(DEL) cc-gtk.h
	-$(DEL) cc-gtk.c
	-$(DEL) cc-gtk.exe
	-$(DEL) $(GAME).lnk
	-$(DEL) makedefs.exe
	-$(DEL) lev_comp.exe
	-$(DEL) dgn_comp.exe
	-$(DEL) txtmerge.exe
	-$(DEL) magtile.exe
	-$(DEL) bigtile.exe
	-$(DEL) txtbg.exe
	-$(DEL) mapmerge.exe
	-$(DEL) tile2x11.exe
	-$(DEL) x11bigtiles
	-$(DEL) x11big3dtiles
	-$(DEL) x11tiles
	-$(DEL) x11bigtiles.map
	-$(DEL) x11big3dtiles.map
	-$(DEL) x11tiles.map
	-$(DEL) tile2png.exe
	-$(DEL) gltile16.png
	-$(DEL) gltile32.png
	-$(DEL) gltile64.png
	-$(DEL) gltile16.map
	-$(DEL) gltile32.map
	-$(DEL) gltile64.map
	-$(DEL) gtkrc
	-$(DEL) *.xpm
	-$(DEL) tiletext.c
	-$(DEL) txtmerge.c
	-$(DEL) magtile.c
	-$(DEL) lev_flex.c
	-$(DEL) lev_yacc.c
	-$(DEL) dgn_flex.c
	-$(DEL) dgn_yacc.c
	-$(DEL) recover.exe
	-$(DEL) $(INCL)\onames.h
	-$(DEL) $(INCL)\pm.h
	-$(DEL) $(INCL)\vis_tab.h
	-$(DEL) $(INCL)\pcvideo.h
	-$(DEL) $(INCL)\pctiles.h
	-$(DEL) $(INCL)\portio.h
	-$(DEL) $(INCL)\tile.h
	-$(DEL) monstr.c
	-$(DEL) vis_tab.c
	-$(DEL) $(SRC)\panic.c
	-$(DEL) $(SRC)\makedefs.c
	-$(DEL) $(SRC)\recover.c
	-$(DEL) $(SRC)\lev_main.c
	-$(DEL) $(SRC)\dlb_main.c
	-$(DEL) $(SRC)\dgn_main.c
	-$(DEL) $(SRC)\wintty.c
	-$(DEL) $(SRC)\topl.c
	-$(DEL) $(SRC)\getline.c
	-$(DEL) $(SRC)\termcap.c
	-$(DEL) $(SRC)\tile2bin.c
	-$(DEL) $(SRC)\msdos.c
	-$(DEL) $(SRC)\pckeys.c
	-$(DEL) $(SRC)\video.c
	-$(DEL) $(SRC)\sound.c
	-$(DEL) $(SRC)\tilemap.c
	-$(DEL) $(SRC)\gifread.c
	-$(DEL) $(SRC)\ppmwrite.c
	-$(DEL) $(SRC)\pcmain.c
	-$(DEL) $(SRC)\pcunix.c
	-$(DEL) $(SRC)\pcsys.c
	-$(DEL) $(SRC)\tile.c
	-$(DEL) $(SRC)\gtk*.c
	-$(DEL) $(SRC)\xshmmap.c
	-$(DEL) $(SRC)\xshm.c
	-$(DEL) $(INCL)\date.h
	-$(DEL) $(INCL)\onames.h
	-$(DEL) $(INCL)\pm.h
	-$(DEL) $(INCL)\vis_tab.h
	-$(DEL) $(SRC)\nhlan.c
	-$(DEL) $(SRC)\winnt.c
	-$(DEL) $(SRC)\nttty.c
	-$(DEL) $(SRC)\ntsound.c
	-$(DEL) $(SRC)\mapimail.c
	-$(DEL) vis_tab.c
	-$(DEL) random.c
	-$(DEL) nhlan.c
	-$(DEL) *.lnk
	-$(DEL) *.def
	-$(DEL) *.map
	-$(DEL) *.lev
	-$(DEL) a.out
	-$(DEL) tilemap.exe
	-$(DEL) tile2bin.exe
	-$(DEL) $(DAT)\data
	-$(DEL) $(DAT)\*.lev
	-$(DEL) $(DAT)\data
	-$(DEL) $(DAT)\dungeon
	-$(DEL) $(DAT)\ttyoptions
	-$(DEL) $(DAT)\guioptions
	-$(DEL) $(DAT)\oracles
	-$(DEL) $(DAT)\rumors
	-$(DEL) $(DAT)\quest.dat
	-$(DEL) $(DAT)\nhshare
	-$(DEL) $(DAT)\nhushare
	-$(DEL) $(DAT)\dlb.lst
	-$(DEL) $(DAT)\msdoshlp.txt
	-$(DEL) $(DAT)\dlb_main.exe
	-$(DEL) $(DAT)\lev_comp.exe
	-$(DEL) $(DAT)\dgn_comp.exe
	-$(DEL) sp_lev.tag
	-$(DEL) $(PLANAR_TIB)
	-$(DEL) $(OVERVIEW_TIB)
	-$(DEL) pet_mark.xbm
	-$(DEL) $(WSHR)\monmag.txt
	-$(DEL) $(WSHR)\mon32.txt
	-$(DEL) $(WSHR)\objmag.txt 
	-$(DEL) $(WSHR)\obj32.txt
	-$(DEL) $(WSHR)\othmag.txt
	-$(DEL) $(WSHR)\oth32.txt
	-$(DEL) $(WSHR)\monbig.txt
	-$(DEL) $(WSHR)\mon3d.txt
	-$(DEL) $(WSHR)\objbig.txt
	-$(DEL) $(WSHR)\obj3d.txt
	-$(DEL) $(WSHR)\othbig.txt
	-$(DEL) $(WSHR)\oth3d.txt
	-$(DEL) $(WSHR)\mon32-t.txt
	-$(DEL) $(WSHR)\obj32-t.txt
	-$(DEL) $(WSHR)\oth32-t.txt

#
#  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 : makedefs.exe
	-makedefs -v

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

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

monstr.c: makedefs.exe
	-makedefs -m

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

vis_tab.c: makedefs.exe
	-makedefs -z

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

nhalloc.o:	$(CONFIG_H) alloc.c
	$(CCOMPILE) $(CFLAGS) -DNHALLOC_DLL -onhalloc.o alloc.c

nhalloc.def:
	@echo EXPORTS > nhalloc.def
	@echo malloc >> nhalloc.def
	@echo calloc >> nhalloc.def
	@echo realloc >> nhalloc.def
	@echo free >> nhalloc.def
	@echo monitor_heap_push >> nhalloc.def
	@echo monitor_heap_pop >> nhalloc.def
	@echo monitor_heap_set_subid >> nhalloc.def
	@echo monitor_heap_getmem >> nhalloc.def
	@echo monitor_heap_trace >> nhalloc.def
	@echo monitor_heap_mark >> nhalloc.def
	@echo monitor_heap_release >> nhalloc.def

nhalloc.dll:	nhalloc.def nhalloc.o panic.o
	$(CCOMPILE) -mdll -o junk.tmp -Wl,--base-file,base.tmp nhalloc.o panic.o
	$(DEL) junk.tmp
	dlltool --dllname nhalloc.dll --base-file base.tmp --output-exp nhalloc.exp --def nhalloc.def
	$(DEL) base.tmp
	$(CCOMPILE) -mdll -o nhalloc.dll nhalloc.o panic.o -Wl,nhalloc.exp
	$(DEL) nhalloc.exp

nhalloc.a:	nhalloc.def
	dlltool --dllname nhalloc.dll --def nhalloc.def --output-lib nhalloc.a -k

nhproxy.a:	$(PROXYCLNTOBJ) $(PROXYCOMOBJ) $(PROXYSHROBJ)
	-$(DEL) nhproxy.a
	ar rc nhproxy.a $(PROXYCLNTOBJ)
	ar r nhproxy.a $(PROXYCOMOBJ) $(PROXYSHROBJ)
	ranlib nhproxy.a

$(WIN32)\mnsel.bmp:	$(UTIL)\uudecode.exe $(WIN32)\mnsel.uu
	$(UTIL)\uudecode $(WIN32)\mnsel.uu
	$(COPY) mnsel.bmp $@
	$(DEL) mnsel.bmp

$(WIN32)\mnselcnt.bmp:	$(UTIL)\uudecode.exe $(WIN32)\mnselcnt.uu
	$(UTIL)\uudecode $(WIN32)\mnselcnt.uu
	$(COPY) mnselcnt.bmp $@
	$(DEL) mnselcnt.bmp

$(WIN32)\mnunsel.bmp:	$(UTIL)\uudecode.exe $(WIN32)\mnunsel.uu
	$(UTIL)\uudecode $(WIN32)\mnunsel.uu
	$(COPY) mnunsel.bmp $@
	$(DEL) mnunsel.bmp

$(WIN32)\petmark.bmp:	$(UTIL)\uudecode.exe $(WIN32)\petmark.uu
	$(UTIL)\uudecode $(WIN32)\petmark.uu
	$(COPY) petmark.bmp $@
	$(DEL) petmark.bmp

$(WIN32)\SlashEM.ico:	$(UTIL)\uudecode.exe $(WSYS)\seico.uu
	$(UTIL)\uudecode $(WSYS)\seico.uu
	$(COPY) SlashEM.ico $@
	$(DEL) SlashEM.ico

$(WIN32)\rip.bmp:	$(UTIL)\uudecode.exe $(WIN32)\rip.uu
	$(UTIL)\uudecode $(WIN32)\rip.uu
	$(COPY) rip.bmp $@
	$(DEL) rip.bmp

$(WIN32)\splash.bmp:	$(UTIL)\uudecode.exe $(WIN32)\splash.uu
	$(UTIL)\uudecode $(WIN32)\splash.uu
	$(COPY) splash.bmp $@
	$(DEL) splash.bmp

winres.o:	tiles.bmp $(WIN32)\winhack.rc $(WIN32)\mnsel.bmp \
		$(WIN32)\mnselcnt.bmp $(WIN32)\mnunsel.bmp $(WIN32)\rip.bmp \
		$(WIN32)\petmark.bmp $(WIN32)\SlashEM.ico $(WIN32)\splash.bmp
	$(RC) -o$@ --include-dir=$(WIN32) -DNODEBUG -i $(WIN32)\winhack.rc

#
#  Makedefs Stuff
#

makedefs.exe:  $(MAKEOBJS)
	$(LINK) $(LFLAGS) -mconsole -omakedefs.exe $(MAKEOBJS)

makedefs.c: $(UTIL)\makedefs.c
	$(COPY) $(UTIL)\makedefs.c .

makedefs.o:  $(CONFIG_H)	$(PERMONST_H)	   $(INCL)\objclass.h \
		$(INCL)\monsym.h   $(INCL)\qtext.h makedefs.c

#
#  Level Compiler Dependencies
#

lev_comp.exe:  $(SPLEVOBJS)
	@echo INPUT( $(SPLEVOBJS) )> tmp.lnk
	$(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -olev_comp.exe tmp.lnk
	@$(DEL) tmp.lnk

ifeq ($(YACC_LEX),Y)

lev_yacc.o:  $(HACK_H)	 $(SP_LEV_H)	lev_yacc.c
	$(CCOMPILE) $(CFLAGS) -o$@ lev_yacc.c

else

lev_yacc.o:  $(HACK_H)	 $(SP_LEV_H) $(INCL)\lev_comp.h lev_yacc.c
	$(CCOMPILE) $(CFLAGS) -o$@ lev_yacc.c

endif

lev_$(LEX).o:  $(HACK_H)   $(SP_LEV_H)	  $(INCL)\lev_comp.h \
	lev_$(LEX).c
	$(CCOMPILE) $(CFLAGS) -o$@ lev_$(LEX).c

lev_main.c:  $(UTIL)\lev_main.c
	$(COPY) $(UTIL)\lev_main.c .

lev_main.o:  $(HACK_H) lev_main.c

$(INCL)\lev_comp.h: lev_yacc.c

ifeq ($(YACC_LEX),Y)

lev_yacc.c:  $(UTIL)\lev_comp.y
	$(YACC) -d $(DUTIL)/lev_comp.y
	$(COPY) $(YTABC) $@
	$(COPY) $(YTABH) $(INCL)\lev_comp.h
	$(DEL) $(YTABC)
	$(DEL) $(YTABH)

lev_$(LEX).c:  $(UTIL)\lev_comp.l
	$(LEX) $(DUTIL)/lev_comp.l
	$(COPY) $(LEXYYC) $@
	$(DEL) $(LEXYYC)
else

lev_yacc.c: $(SSHR)\lev_yacc.c
	$(COPY) $(SSHR)\lev_yacc.c $@

$(INCL)\lev_comp.h: $(SSHR)\lev_comp.h
	$(COPY) $(SSHR)\lev_comp.h $@
	$(ECHO) /**/ >>$(INCL)\lev_comp.h

lev_$(LEX).c: $(SSHR)\lev_lex.c
	$(COPY) $(SSHR)\lev_lex.c $@

endif



#
#  Dungeon Dependencies
#

dgn_comp.exe:  $(DGNCOMPOBJS)
	@echo INPUT( $(DGNCOMPOBJS) )> tmp.lnk
	$(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -odgn_comp.exe tmp.lnk
	@$(DEL) tmp.lnk

ifeq ($(YACC_LEX),Y)

dgn_yacc.o:  $(HACK_H)	 $(DGN_FILE_H)	dgn_yacc.c
	$(CCOMPILE) $(CFLAGS) -o$@ dgn_yacc.c

else

dgn_yacc.o:  $(HACK_H)	 $(DGN_FILE_H)	$(INCL)\dgn_comp.h dgn_yacc.c
	$(CCOMPILE) $(CFLAGS) -o$@ dgn_yacc.c

endif

dgn_$(LEX).o:  $(HACK_H)   $(DGN_FILE_H)  $(INCL)\dgn_comp.h \
	dgn_$(LEX).c
	$(CCOMPILE) $(CFLAGS) -o$@ dgn_$(LEX).c

dgn_main.c:  $(UTIL)\dgn_main.c
	$(COPY) $(UTIL)\dgn_main.c .

dgn_main.o:  $(HACK_H)

$(INCL)\dgn_comp.h:  dgn_yacc.c

ifeq ($(YACC_LEX),Y)

dgn_yacc.c: $(UTIL)\dgn_comp.y
	$(YACC) -d $(DUTIL)/dgn_comp.y
	$(COPY) $(YTABC) $@
	$(COPY) $(YTABH) $(INCL)\dgn_comp.h
	$(DEL) $(YTABC)
	$(DEL) $(YTABH)

dgn_$(LEX).c:  $(UTIL)\dgn_comp.l
	$(LEX) $(DUTIL)/dgn_comp.l
	$(COPY) $(LEXYYC) $@
	$(DEL) $(LEXYYC)

else

dgn_yacc.c: $(SSHR)\dgn_yacc.c
	$(COPY) $(SSHR)\dgn_yacc.c $@

$(INCL)\dgn_comp.h: $(SSHR)\dgn_comp.h
	$(COPY) $(SSHR)\dgn_comp.h $@
	$(ECHO) /**/ >>$(INCL)\dgn_comp.h

dgn_$(LEX).c: $(SSHR)\dgn_lex.c
	$(COPY) $(SSHR)\dgn_lex.c $@
 
endif

#
#  Recover Utility
#

recover.exe:   $(RECOVOBJS)
	$(LINK) $(LFLAGS) -mconsole -orecover.exe recover.o

recover.c:  $(UTIL)\recover.c
	$(COPY) $(UTIL)\recover.c .

recover.o:   $(CONFIG_H) recover.c
	$(CCOMPILE) $(CFLAGS) -o$@ recover.c

#
#  Tiles
#

#  Headers

$(INCL)\tile.h: $(WSHR)\tile_t.h tilemap.exe
	tilemap.exe

#  Utilities

txtmerge.exe: txtmerge.o $(TEXTIO)
	@echo INPUT( txtmerge.o )> tmp.lnk
	@echo INPUT( $(TEXTIO) )>> tmp.lnk
	$(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -otxtmerge.exe tmp.lnk
	@$(DEL) tmp.lnk

tile2x11.exe: tile2x11.o $(TEXTIO)
	@echo INPUT( tile2x11.o )> tmp.lnk
	@echo INPUT( $(TEXTIO) )>> tmp.lnk
	$(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -otile2x11.exe tmp.lnk
	@$(DEL) tmp.lnk

tile2bmp.exe: tile2bmp.o $(TEXTIO)
	@echo INPUT( tile2bmp.o )> tmp.lnk
	@echo INPUT( $(TEXTIO) )>> tmp.lnk
	$(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -otile2bmp.exe tmp.lnk
	@$(DEL) tmp.lnk

tile2png.exe: tile2png.o $(TEXTIO)
	@echo INPUT( tile2png.o )> tmp.lnk
	@echo INPUT( $(TEXTIO) )>> tmp.lnk
	cc-gtk -l $(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -otile2png.exe tmp.lnk
	@$(DEL) tmp.lnk

magtile.exe: magtile.o $(TEXTIO)
	@echo INPUT( magtile.o )> tmp.lnk
	@echo INPUT( $(TEXTIO) )>> tmp.lnk
	$(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -omagtile.exe tmp.lnk
	@$(DEL) tmp.lnk

bigtile.exe: bigtile.o $(TEXTIO)
	@echo INPUT( bigtile.o )> tmp.lnk
	@echo INPUT( $(TEXTIO) )>> tmp.lnk
	$(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -obigtile.exe tmp.lnk
	@$(DEL) tmp.lnk

txtbg.exe: txtbg.o $(TEXTIO)
	@echo INPUT( txtbg.o )> tmp.lnk
	@echo INPUT( $(TEXTIO) )>> tmp.lnk
	$(LINK) $(LFLAGS) -mconsole $(GTKGCCFLAGS) -otxtbg.exe tmp.lnk
	@$(DEL) tmp.lnk

mapmerge.exe: mapmerge.o
	$(CCOMPILE) $(LFLAGS) -mconsole -omapmerge.exe mapmerge.o

tile.c: tilemap.exe
	tilemap.exe
	@echo A new $@ has been created

tilemap.exe: tilemap.o
	$(CCOMPILE) $(LFLAGS) -mconsole -otilemap.exe tilemap.o

tilemap.c: $(WSHR)\tilemap.c
	copy $(WSHR)\tilemap.c .

tilemap.o: $(WSHR)\tilemap.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -c ../win/share/tilemap.c


magtile.o: $(WSHR)\magtile.c $(INCL)\config.h $(INCL)\tile.h
	$(CCOMPILE) $(CFLAGS) -c $(WSHR)\magtile.c

bigtile.o: $(WSHR)\bigtile.c $(INCL)\config.h $(INCL)\tile.h
	$(CCOMPILE) $(CFLAGS) -c $(WSHR)\bigtile.c

txtbg.o: $(WSHR)\txtbg.c $(INCL)\config.h $(INCL)\tile.h
	$(CCOMPILE) $(CFLAGS) -c $(WSHR)\txtbg.c

mapmerge.o: $(WSHR)\mapmerge.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -c $(WSHR)\mapmerge.c

txtmerge.o: $(WSHR)\txtmerge.c $(INCL)\config.h $(INCL)\tile.h
	$(CCOMPILE) $(CFLAGS) -c ../win/share/txtmerge.c

tile2x11.o: ../win/X11/tile2x11.c $(INCL)\hack.h $(INCL)\tile.h \
						$(INCL)\tile2x11.h
	$(CCOMPILE) $(CFLAGS) -c ../win/X11/tile2x11.c

tile2bmp.o: ../win/share/tile2bmp.c $(INCL)\hack.h $(INCL)\tile.h \
						$(INCL)\win32api.h
	$(CCOMPILE) $(CFLAGS) -c ../win/share/tile2bmp.c

tile2png.o: cc-gtk.exe ../win/share/tile2png.c $(INCL)\hack.h $(INCL)\tile.h
	$(CCGTK) $(CFLAGS) -I$(MW32GTK)/include -c ../win/share/tile2png.c


x11tiles: tile2x11.exe ../win/share/monsters.txt ../win/share/objects.txt \
				../win/share/other.txt
	tile2x11 -o x11tiles $(WSHR)\monsters.txt $(WSHR)\objects.txt \
		$(WSHR)\other.txt

x11tiles.map: mapmerge.exe ../win/share/monsters.map ../win/share/objects.map \
				../win/share/other.map
	mapmerge x11tiles.map $(WSHR)\monsters.map $(WSHR)\objects.map \
		$(WSHR)\other.map

x11bigtiles:	tile2x11.exe ../win/share/mon32.txt \
		../win/share/obj32.txt ../win/share/oth32.txt
	tile2x11 -o x11bigtiles $(WSHR)\mon32.txt $(WSHR)\obj32.txt \
		$(WSHR)\oth32.txt

x11bigtiles.map:	x11tiles.map
	$(COPY) x11tiles.map x11bigtiles.map

x11big3dtiles:	tile2x11.exe ../win/share/mon3d.txt \
		../win/share/obj3d.txt ../win/share/oth3d.txt
	tile2x11 -o x11big3dtiles $(WSHR)\mon3d.txt $(WSHR)\obj3d.txt \
		$(WSHR)\oth3d.txt

x11big3dtiles.map:	x11tiles.map
	$(COPY) x11tiles.map x11big3dtiles.map

tiles.bmp:	tile2bmp.exe ../win/share/monsters.txt \
		../win/share/objects.txt ../win/share/other.txt
	tile2bmp $@ $(WSHR)\monsters.txt $(WSHR)\objects.txt \
		$(WSHR)\other.txt

tiles32.bmp:	tile2bmp.exe ../win/share/mon32.txt \
		../win/share/obj32.txt ../win/share/oth32.txt
	tile2bmp $@ $(WSHR)\mon32.txt $(WSHR)\obj32.txt \
		$(WSHR)\oth32.txt

gltile16.png: tile2png.exe ../win/share/monsters.txt ../win/share/objects.txt \
				../win/share/other.txt
	tile2png -o gltile16.png $(WSHR)\monsters.txt $(WSHR)\objects.txt \
		$(WSHR)\other.txt

gltile16.map: mapmerge.exe ../win/share/monsters.map ../win/share/objects.map \
				../win/share/other.map
	mapmerge gltile16.map $(WSHR)\monsters.map $(WSHR)\objects.map \
		$(WSHR)\other.map

gltile32.png:	tile2png.exe ../win/share/mon32.txt \
		../win/share/obj32.txt ../win/share/oth32.txt
	tile2png -o gltile32.png $(WSHR)\mon32.txt $(WSHR)\obj32.txt \
		$(WSHR)\oth32.txt

gltile32.map:	gltile16.map
	$(COPY) gltile16.map gltile32.map

gltile64.png:	tile2png.exe ../win/share/mon3d.txt \
		../win/share/obj3d.txt ../win/share/oth3d.txt
	tile2png -o gltile64.png $(WSHR)\mon3d.txt $(WSHR)\obj3d.txt \
		$(WSHR)\oth3d.txt

gltile64.map:	gltile16.map
	$(COPY) gltile16.map gltile64.map

$(WSHR)\monmag.txt:	magtile.exe ../win/share/monsters.txt
	magtile

$(WSHR)\objmag.txt:	magtile.exe ../win/share/objects.txt
	magtile

$(WSHR)\othmag.txt:	magtile.exe ../win/share/other.txt
	magtile

$(WSHR)\monbig.txt:	bigtile.exe ../win/share/mon32-t.txt \
				../win/share/obj32-t.txt \
				../win/share/oth32-t.txt
	bigtile

$(WSHR)\objbig.txt:	bigtile.exe ../win/share/mon32-t.txt \
				../win/share/obj32-t.txt \
				../win/share/oth32-t.txt
	bigtile

$(WSHR)\othbig.txt:	bigtile.exe ../win/share/mon32-t.txt \
				../win/share/obj32-t.txt \
				../win/share/oth32-t.txt
	bigtile

../win/share/mon32.txt:	txtbg.exe ../win/share/mon32-t.txt
	txtbg ../win/share/mon32-t.txt ../win/share/mon32.txt

../win/share/obj32.txt:	txtbg.exe ../win/share/obj32-t.txt
	txtbg ../win/share/obj32-t.txt ../win/share/obj32.txt

../win/share/oth32.txt:	txtbg.exe ../win/share/oth32-t.txt
	txtbg ../win/share/oth32-t.txt ../win/share/oth32.txt

../win/share/mon32-t.txt:	txtmerge.exe $(WSHR)\monmag.txt \
		$(WSHR)\mon32mi.txt $(WSHR)\mon32alg.txt \
		$(WSHR)\mon32aw.txt $(WSHR)\mon32se.txt $(WSHR)\palette.txt
	txtmerge -p $(WSHR)\palette.txt $(WSHR)\mon32-t.txt $(WSHR)\monmag.txt \
		-b $(WSHR)\mon32mi.txt -b $(WSHR)\mon32se.txt
	txtmerge $(WSHR)\mon32-t.txt $(WSHR)\mon32-t.txt \
		-bff00ff $(WSHR)\mon32alg.txt -bff00ff $(WSHR)\mon32aw.txt

../win/share/obj32-t.txt:	txtmerge.exe $(WSHR)\objmag.txt \
		$(WSHR)\obj32mi.txt $(WSHR)\obj32se.txt \
		$(WSHR)\obj32alg.txt $(WSHR)\palette.txt
	txtmerge -p $(WSHR)\palette.txt $(WSHR)\obj32-t.txt $(WSHR)\objmag.txt \
		-b $(WSHR)\obj32mi.txt
	txtmerge $(WSHR)\obj32-t.txt $(WSHR)\obj32-t.txt \
		-b $(WSHR)\obj32se.txt -bff00ff $(WSHR)\obj32alg.txt

../win/share/oth32-t.txt:	txtmerge.exe $(WSHR)\othmag.txt \
		$(WSHR)\oth32mi.txt $(WSHR)\oth32se.txt \
		$(WSHR)\oth32alg.txt $(WSHR)\palette.txt
	txtmerge -p $(WSHR)\palette.txt $(WSHR)\oth32-t.txt $(WSHR)\othmag.txt \
		-b $(WSHR)\oth32mi.txt
	txtmerge $(WSHR)\oth32-t.txt $(WSHR)\oth32-t.txt \
		-b $(WSHR)\oth32se.txt -bff00ff $(WSHR)\oth32alg.txt

../win/share/mon3d.txt:	txtmerge.exe $(WSHR)\monbig.txt \
		$(WSHR)\mon3dmi.txt $(WSHR)\palette.txt
	txtmerge -p $(WSHR)\palette.txt $(WSHR)\mon3d.txt $(WSHR)\monbig.txt \
		-b $(WSHR)\mon3dmi.txt

../win/share/obj3d.txt:	txtmerge.exe $(WSHR)\objbig.txt
	$(COPY) $(WSHR)\objbig.txt $(WSHR)\obj3d.txt

../win/share/oth3d.txt:	txtmerge.exe $(WSHR)\othbig.txt \
		$(WSHR)\oth3dmi.txt $(WSHR)\oth-2kmi.txt \
		$(WSHR)\oth3dse.txt $(WSHR)\palette.txt
	txtmerge -p $(WSHR)\palette.txt $(WSHR)\oth3d.txt $(WSHR)\othbig.txt \
		-b $(WSHR)\oth3dmi.txt
	txtmerge $(WSHR)\oth3d.txt $(WSHR)\oth3d.txt -b $(WSHR)\oth-2kmi.txt \
		-b $(WSHR)\oth3dse.txt

pet_mark.xbm: ../win/X11/pet_mark.xbm
	$(COPY) ..\win\X11\pet_mark.xbm pet_mark.xbm

rip.xpm: ../win/X11/rip.xpm
	$(COPY) ..\win\X11\rip.xpm rip.xpm

credit.xpm: ../dat/credit.xpm
	$(COPY) ..\dat\credit.xpm credit.xpm

tiletext.o:  $(CONFIG_H) $(INCL)\tile.h $(WSHR)\tiletext.c
	$(COPY) $(WSHR)\tiletext.c .
	$(CCOMPILE) $(CFLAGS) -o$@ tiletext.c

tiletxt.o: $(CONFIG_H)	$(INCL)\tile.h tilemap.c
	$(CCOMPILE) $(CFLAGS) -DTILETEXT -o$@ tilemap.c

uudecode.o: $(SSHR)\uudecode.c
	$(CCOMPILE) $(CFLAGS) -c $(SSHR)\uudecode.c

$(UTIL)\uudecode.exe:	uudecode.o
	$(CCOMPILE) $(LFLAGS) -mconsole -o$@ uudecode.o

#
#  Other Util Dependencies.
#

alloc.o: $(CONFIG_H)	 alloc.c
	$(CCOMPILE) $(CFLAGS) -oalloc.o alloc.c

drawing.o: $(CONFIG_H) drawing.c
	$(CCOMPILE) $(CFLAGS) -odrawing.o drawing.c

decl.o: $(CONFIG_H) decl.c
	$(CCOMPILE) $(CFLAGS) -odecl.o decl.c

monst.o: $(CONFIG_H)	     $(PERMONST_H)	$(ESHK_H)	   \
	$(EPRI_H)	      $(VAULT_H)	 $(INCL)\monsym.h   \
	$(INCL)\color.h	 monst.c
	$(CCOMPILE) $(CFLAGS) -omonst.o monst.c

objects.o: $(CONFIG_H)	      $(INCL)\obj.h	 $(INCL)\objclass.h \
	$(INCL)\prop.h	    $(INCL)\color.h    objects.c
	$(CCOMPILE) $(CFLAGS) -oobjects.o objects.c

panic.c:  $(UTIL)\panic.c
	$(COPY) $(UTIL)\panic.c .

panic.o:   $(CONFIG_H)	  panic.c

nhlan.c: $(SSHR)\nhlan.c
	$(COPY) $(SSHR)\nhlan.c .

nhlan.o: $(HACK_H) $(NHLAN_H) $(SSHR)\nhlan.c
	$(COPY) $(SSHR)\nhlan.c .
	$(CCOMPILE) $(CFLAGS) -o$@ nhlan.c

DATABASE = $(DAT)\data.base

dat.tag: $(DAT)\nhshare $(DAT)\nhushare $(CNF_SHARE_DATND)
	@echo dat done >dat.tag

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

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

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

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

sp_lev.tag:     utility.tag         $(DAT)\beholder.des $(DAT)\bigroom.des \
		$(DAT)\blkmar.des   $(DAT)\castle.des   $(DAT)\grund.des \
		$(DAT)\dragons.des  $(DAT)\endgame.des  $(DAT)\gehennom.des \
		$(DAT)\giants.des   $(DAT)\guild.des    $(DAT)\knox.des \
		$(DAT)\kobold-1.des $(DAT)\kobold-2.des $(DAT)\lich.des \
		$(DAT)\mall-1.des   $(DAT)\mall-2.des   $(DAT)\medusa.des \
		$(DAT)\sokoban.des  $(DAT)\mines.des    $(DAT)\mtemple.des \
		$(DAT)\newmall.des  $(DAT)\nymph.des    $(DAT)\oracle.des \
		$(DAT)\rats.des     $(DAT)\sea.des      $(DAT)\spiders.des \
		$(DAT)\stor-1.des   $(DAT)\stor-2.des   $(DAT)\stor-3.des \
		$(DAT)\tomb.des     $(DAT)\tower.des    $(DAT)\yendor.des \
		$(DAT)\arch.des     $(DAT)\barb.des 	$(DAT)\caveman.des \
		$(DAT)\flame.des    $(DAT)\healer.des   $(DAT)\ice.des \
		$(DAT)\knight.des   $(DAT)\monk.des     $(DAT)\necro.des \
		$(DAT)\priest.des   $(DAT)\rogue.des    $(DAT)\samurai.des \
		$(DAT)\tourist.des  $(DAT)\slayer.des   $(DAT)\valkyrie.des \
		$(DAT)\wizard.des   $(DAT)\yeoman.des   $(DAT)\frnknstn.des \
		$(DAT)\nightmar.des $(DAT)\ranger.des 
	lev_comp $(DDAT)/beholder.des
	lev_comp $(DDAT)/bigroom.des
	lev_comp $(DDAT)/blkmar.des
	lev_comp $(DDAT)/castle.des
	lev_comp $(DDAT)/grund.des
	lev_comp $(DDAT)/dragons.des
	lev_comp $(DDAT)/endgame.des
	lev_comp $(DDAT)/gehennom.des
	lev_comp $(DDAT)/giants.des
	lev_comp $(DDAT)/guild.des
	lev_comp $(DDAT)/knox.des
	lev_comp $(DDAT)/kobold-1.des
	lev_comp $(DDAT)/kobold-2.des
	lev_comp $(DDAT)/lich.des
	lev_comp $(DDAT)/mall-1.des
	lev_comp $(DDAT)/mall-2.des
	lev_comp $(DDAT)/medusa.des
	lev_comp $(DDAT)/sokoban.des
	lev_comp $(DDAT)/mines.des
	lev_comp $(DDAT)/mtemple.des
	lev_comp $(DDAT)/newmall.des
	lev_comp $(DDAT)/nymph.des
	lev_comp $(DDAT)/oracle.des
	lev_comp $(DDAT)/rats.des
	lev_comp $(DDAT)/sea.des
	lev_comp $(DDAT)/spiders.des
	lev_comp $(DDAT)/stor-1.des
	lev_comp $(DDAT)/stor-2.des
	lev_comp $(DDAT)/stor-3.des
	lev_comp $(DDAT)/tomb.des
	lev_comp $(DDAT)/tower.des
	lev_comp $(DDAT)/yendor.des
	lev_comp $(DDAT)/arch.des
	lev_comp $(DDAT)/barb.des
	lev_comp $(DDAT)/caveman.des
	lev_comp $(DDAT)/flame.des
	lev_comp $(DDAT)/healer.des
	lev_comp $(DDAT)/ice.des
	lev_comp $(DDAT)/knight.des
	lev_comp $(DDAT)/monk.des
	lev_comp $(DDAT)/necro.des
	lev_comp $(DDAT)/priest.des
	lev_comp $(DDAT)/rogue.des
	lev_comp $(DDAT)/samurai.des
	lev_comp $(DDAT)/tourist.des
	lev_comp $(DDAT)/slayer.des
	lev_comp $(DDAT)/valkyrie.des
	lev_comp $(DDAT)/wizard.des
	lev_comp $(DDAT)/yeoman.des
	lev_comp $(DDAT)/frnknstn.des
	lev_comp $(DDAT)/nightmar.des
	lev_comp $(DDAT)/ranger.des
	$(COPY) *.lev $(DAT)
	$(ECHO) sp_levs done > sp_lev.tag
	
$(DAT)\dungeon:	  utility.tag  $(DAT)\dungeon.def
	-makedefs -e
	dgn_comp $(DAT)\dungeon.pdf
#
# DLB stuff
#
$(DAT)\nhshare:	dlb_main.exe $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \
		$(DAT)\oracles $(DAT)\quest.dat sp_lev.tag
	$(ECHO) data >$(DAT)\dlb.lst
	$(ECHO) oracles >>$(DAT)\dlb.lst
ifeq ($(USE_GUI),Y)
	$(ECHO) guioptions >>$(DAT)\dlb.lst
else
	$(ECHO) ttyoptions >>$(DAT)\dlb.lst
endif
	$(ECHO) rumors >>$(DAT)\dlb.lst
	$(ECHO) help >>$(DAT)\dlb.lst
	$(ECHO) hh >>$(DAT)\dlb.lst
	$(ECHO) cmdhelp >>$(DAT)\dlb.lst
	$(ECHO) history >>$(DAT)\dlb.lst
	$(ECHO) opthelp >>$(DAT)\dlb.lst
	$(ECHO) wizhelp >>$(DAT)\dlb.lst
	$(ECHO) gypsy.txt >>$(DAT)\dlb.lst
	$(ECHO) license >>$(DAT)\dlb.lst
	dlb_main cvCIf $(DAT) dlb.lst nhshare

$(DAT)\nhushare:	dlb_main.exe $(DAT)\dungeon $(DAT)\quest.dat sp_lev.tag
	$(ECHO) dungeon > $(DAT)\dlb2.lst
	$(ECHO) quest.dat >>$(DAT)\dlb2.lst
	$(LS) $(DAT)\*.lev >>$(DAT)\dlb2.lst
	dlb_main cvCIf $(DAT) dlb2.lst nhushare


dlb_main.exe: $(DLBOBJS)
	$(LINK) $(LFLAGS) -mconsole -odlb_main.exe $(DLBOBJS)
	$(COPY) $@ $(DAT)\dlb_main.exe


dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(DLB_H)
	$(COPY) $(UTIL)\dlb_main.c .
	$(CCOMPILE) $(CFLAGS) -odlb_main.o dlb_main.c

#
# NT dependencies
#

nttty.o: $(HACK_H) $(TILE_H) $(INCL)/win32api.h $(NTSYS)/nttty.c
	$(CCOMPILE) $(CFLAGS) -o$@ $(NTSYS)/nttty.c
winnt.o: $(HACK_H) $(INCL)/win32api.h $(NTSYS)/winnt.c
	$(CCOMPILE) $(CFLAGS) -o$@ $(NTSYS)/winnt.c
ntsound.o: $(HACK_H) $(NTSYS)/ntsound.c
	$(CCOMPILE) $(CFLAGS) -o$@ $(NTSYS)/ntsound.c
mapimail.o: $(HACK_H) $(INCL)/nhlan.h $(NTSYS)/mapimail.c
	$(CCOMPILE) $(CFLAGS) -DMAPI_VERBOSE -o$@ $(NTSYS)/mapimail.c

#
# win/win32
#

mswproc.o: $(WIN32)/mswproc.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mswproc.c
winhack.o: $(WIN32)/winhack.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/winhack.c
mhdlg.o: $(WIN32)/mhdlg.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhdlg.c
mhaskyn.o: $(WIN32)/mhaskyn.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhaskyn.c
mhfont.o: $(WIN32)/mhfont.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhfont.c
mhinput.o: $(WIN32)/mhinput.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhinput.c
mhmain.o: $(WIN32)/mhmain.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhmain.c
mhmsgwnd.o: $(WIN32)/mhmsgwnd.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhmsgwnd.c
mhsplash.o: $(WIN32)/mhsplash.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhsplash.c
mhstatus.o: $(WIN32)/mhstatus.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhstatus.c
mhtext.o: $(WIN32)/mhtext.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhtext.c
mhmenu.o: $(WIN32)/mhmenu.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhmenu.c
mhmap.o: $(WIN32)/mhmap.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhmap.c
mhrip.o: $(WIN32)/mhrip.c
	$(CCOMPILE) $(CFLAGS) $(WINMSCFLAGS) -o$@ ../win/win32/mhrip.c

# The rest are stolen from sys/unix/Makefile.src,
# with the following changes:
#   * ../include changed to $(INCL)
#   * -c (which is included in CFLAGS) substituted
#       with -o$@
#   * $(CC) changed to $(CCOMPILE)
#   * Dependencies on win32api.h revealed
# but otherwise untouched.
# That means that there is some irrelevant stuff
# in here, but maintenance should be easier.
#
tos.o: ../sys/atari/tos.c $(HACK_H) $(INCL)/tcap.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/atari/tos.c
pcmain.o: ../sys/share/pcmain.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/win32api.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/share/pcmain.c
pcsys.o: ../sys/share/pcsys.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/share/pcsys.c
pctty.o: ../sys/share/pctty.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/share/pctty.c
pcunix.o: ../sys/share/pcunix.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/share/pcunix.c
random.o: ../sys/share/random.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/share/random.c
ioctl.o: ../sys/share/ioctl.c $(HACK_H) $(INCL)/tcap.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/share/ioctl.c
unixtty.o: ../sys/share/unixtty.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/share/unixtty.c
unixmain.o: ../sys/unix/unixmain.c $(HACK_H) $(INCL)/dlb.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/unix/unixmain.c
unixunix.o: ../sys/unix/unixunix.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/unix/unixunix.c
unixres.o: ../sys/unix/unixres.c $(CONFIG_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/unix/unixres.c
bemain.o: ../sys/be/bemain.c $(HACK_H) $(INCL)/dlb.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../sys/be/bemain.c
getline.o: ../win/tty/getline.c $(HACK_H) $(INCL)/func_tab.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/tty/getline.c
termcap.o: ../win/tty/termcap.c $(HACK_H) $(INCL)/tcap.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/tty/termcap.c
topl.o: ../win/tty/topl.c $(HACK_H) $(INCL)/tcap.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/tty/topl.c
wintty.o: ../win/tty/wintty.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/tcap.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/tty/wintty.c
Window.o: ../win/X11/Window.c $(INCL)/xwindowp.h $(INCL)/xwindow.h \
		$(CONFIG_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/Window.c
dialogs.o: ../win/X11/dialogs.c $(CONFIG_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/dialogs.c
winX.o: ../win/X11/winX.c $(HACK_H) $(INCL)/winX.h $(INCL)/dlb.h \
		$(INCL)/patchlevel.h ../win/X11/nh72icon \
		../win/X11/nh56icon ../win/X11/nh32icon
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/winX.c
winmap.o: ../win/X11/winmap.c $(INCL)/xwindow.h $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/winX.h $(INCL)/patchlevel.h $(INCL)/tile2x11.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/winmap.c
winmenu.o: ../win/X11/winmenu.c $(HACK_H) $(INCL)/winX.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/winmenu.c
winmesg.o: ../win/X11/winmesg.c $(INCL)/xwindow.h $(HACK_H) $(INCL)/winX.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/winmesg.c
winmisc.o: ../win/X11/winmisc.c $(HACK_H) $(INCL)/func_tab.h \
		$(INCL)/winX.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/winmisc.c
winstat.o: ../win/X11/winstat.c $(HACK_H) $(INCL)/winX.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/winstat.c
wintext.o: ../win/X11/wintext.c $(HACK_H) $(INCL)/winX.h $(INCL)/xwindow.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/wintext.c
winval.o: ../win/X11/winval.c $(HACK_H) $(INCL)/winX.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/X11/winval.c
gtk.o: ../win/gtk/gtk.c $(INCL)/md5.h $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h $(INCL)/func_tab.h \
		$(INCL)/dlb.h $(INCL)/patchlevel.h $(INCL)/proxycb.h \
		$(INCL)/prxyclnt.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtk.c
gtkgetlin.o: ../win/gtk/gtkgetlin.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkgetlin.c
gtkstatus.o: ../win/gtk/gtkstatus.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkstatus.c
gtkmenu.o: ../win/gtk/gtkmenu.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h $(INCL)/patchlevel.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkmenu.c
gtkyn.o: ../win/gtk/gtkyn.c $(INCL)/winGTK.h $(HACK_H) $(INCL)/nhxdr.h \
		$(INCL)/proxycom.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkyn.c
gtkextcmd.o: ../win/gtk/gtkextcmd.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h $(INCL)/proxycb.h \
		$(INCL)/func_tab.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkextcmd.c
gtkmap.o: ../win/gtk/gtkmap.c $(INCL)/winGTK.h $(HACK_H) $(INCL)/nhxdr.h \
		$(INCL)/proxycom.h $(INCL)/dlb.h $(INCL)/patchlevel.h \
		$(INCL)/proxycb.h $(INCL)/prxyclnt.h \
		../win/gtk/gtkprogress.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkmap.c
gtkmessage.o: ../win/gtk/gtkmessage.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkmessage.c
gtkmisc.o: ../win/gtk/gtkmisc.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h $(INCL)/proxycb.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkmisc.c
gtktile.o: ../win/gtk/gtktile.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h $(INCL)/dlb.h \
		$(INCL)/proxycb.h $(INCL)/prxyclnt.h \
		../win/gtk/gtkprogress.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtktile.c
xshmmap.o: ../win/gtk/xshmmap.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/xshmmap.c
gtkhackrc.o: ../win/gtk/gtkhackrc.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h $(INCL)/prxyclnt.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkhackrc.c
gtkprefs.o: ../win/gtk/gtkprefs.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkprefs.c
gtkprogress.o: ../win/gtk/gtkprogress.c $(INCL)/winGTK.h $(HACK_H) \
                $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		../win/gtk/gtkprogress.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkprogress.c
gtkext.o: ../win/gtk/gtkext.c $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/nhxdr.h $(INCL)/proxycom.h $(INCL)/prxyclnt.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkext.c
gtkint.o: ../win/gtk/gtkint.c $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/prxyclnt.h $(INCL)/winGTK.h $(HACK_H) \
		$(INCL)/func_tab.h $(INCL)/dlb.h $(INCL)/patchlevel.h
	$(CCGTK) $(CFLAGS) $(WINGTKCFLAGS) -o$@ ../win/gtk/gtkint.c
gnaskstr.o: ../win/gnome/gnaskstr.c ../win/gnome/gnaskstr.h \
		../win/gnome/gnmain.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnaskstr.c
gnbind.o: ../win/gnome/gnbind.c ../win/gnome/gnbind.h ../win/gnome/gnmain.h \
		../win/gnome/gnaskstr.h ../win/gnome/gnyesno.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnbind.c
gnglyph.o: ../win/gnome/gnglyph.c ../win/gnome/gnglyph.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnglyph.c
gnmain.o: ../win/gnome/gnmain.c ../win/gnome/gnmain.h ../win/gnome/gnsignal.h \
		../win/gnome/gnbind.h ../win/gnome/gnopts.h $(HACK_H) \
		$(INCL)/date.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnmain.c
gnmap.o: ../win/gnome/gnmap.c ../win/gnome/gnmap.h ../win/gnome/gnglyph.h \
		../win/gnome/gnsignal.h $(HACK_H)
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnmap.c
gnmenu.o: ../win/gnome/gnmenu.c ../win/gnome/gnmenu.h ../win/gnome/gnmain.h \
		../win/gnome/gnbind.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnmenu.c
gnmesg.o: ../win/gnome/gnmesg.c ../win/gnome/gnmesg.h ../win/gnome/gnsignal.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnmesg.c
gnopts.o: ../win/gnome/gnopts.c ../win/gnome/gnopts.h ../win/gnome/gnglyph.h \
		../win/gnome/gnmain.h ../win/gnome/gnmap.h $(HACK_H)
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnopts.c
gnplayer.o: ../win/gnome/gnplayer.c ../win/gnome/gnplayer.h \
		../win/gnome/gnmain.h $(HACK_H)
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnplayer.c
gnsignal.o: ../win/gnome/gnsignal.c ../win/gnome/gnsignal.h \
		../win/gnome/gnmain.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnsignal.c
gnstatus.o: ../win/gnome/gnstatus.c ../win/gnome/gnstatus.h \
		../win/gnome/gnsignal.h ../win/gnome/gn_xpms.h \
		../win/gnome/gnomeprv.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnstatus.c
gntext.o: ../win/gnome/gntext.c ../win/gnome/gntext.h ../win/gnome/gnmain.h \
		../win/gnome/gn_rip.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gntext.c
gnyesno.o: ../win/gnome/gnyesno.c ../win/gnome/gnbind.h ../win/gnome/gnyesno.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnyesno.c
gnworn.o: ../win/gnome/gnworn.c ../win/gnome/gnworn.h ../win/gnome/gnglyph.h \
		../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h
	$(CCOMPILE) $(CFLAGS) $(GNOMEINC) -o$@ ../win/gnome/gnworn.c
wingem.o: ../win/gem/wingem.c $(HACK_H) $(INCL)/func_tab.h $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/wingem.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/gem/wingem.c
wingem1.o: ../win/gem/wingem1.c $(INCL)/gem_rsc.h $(INCL)/load_img.h \
		$(INCL)/gr_rect.h $(INCL)/wintype.h $(INCL)/wingem.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/gem/wingem1.c
load_img.o: ../win/gem/load_img.c $(INCL)/load_img.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/gem/load_img.c
gr_rect.o: ../win/gem/gr_rect.c $(INCL)/gr_rect.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/gem/gr_rect.c
winproxy.o: ../win/proxy/winproxy.c $(HACK_H) $(INCL)/patchlevel.h \
		$(INCL)/date.h $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/winproxy.h $(INCL)/win32api.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/winproxy.c
callback.o: ../win/proxy/callback.c $(HACK_H) $(INCL)/func_tab.h \
		$(INCL)/md5.h $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/winproxy.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/callback.c
md5.o: ../win/proxy/md5.c $(INCL)/md5.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/md5.c
dlbh.o: ../win/proxy/dlbh.c $(HACK_H) $(INCL)/dlb.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/dlbh.c
mapid.o: ../win/proxy/mapid.c $(HACK_H) $(INCL)/nhxdr.h $(INCL)/winproxy.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/mapid.c
riputil.o: ../win/proxy/riputil.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/riputil.c
getopt.o: ../win/proxy/getopt.c $(HACK_H)
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/getopt.c
glyphmap.o: ../win/proxy/glyphmap.c $(HACK_H) $(INCL)/nhxdr.h \
		$(INCL)/proxycom.h $(INCL)/winproxy.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/glyphmap.c
proxysvc.o: ../win/proxy/proxysvc.c $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/proxycb.h $(INCL)/prxyclnt.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/proxysvc.c
proxycb.o: ../win/proxy/proxycb.c $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/proxycb.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/proxycb.c
prxymap.o: ../win/proxy/prxymap.c $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/prxyclnt.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/prxymap.c
prxychar.o: ../win/proxy/prxychar.c $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/prxyclnt.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/prxychar.c
prxytile.o: ../win/proxy/prxytile.c $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/prxyclnt.h $(INCL)/proxycb.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/prxytile.c
prxyconn.o: ../win/proxy/prxyconn.c $(INCL)/nhxdr.h $(INCL)/proxycom.h \
		$(INCL)/prxyclnt.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/prxyconn.c
nhext.o: ../win/proxy/nhext.c $(INCL)/nhxdr.h $(INCL)/proxycom.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/nhext.c
nhxdr.o: ../win/proxy/nhxdr.c $(INCL)/nhxdr.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/nhxdr.c
nhextxdr.o: ../win/proxy/nhextxdr.c $(INCL)/nhxdr.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/nhextxdr.c
nhextio.o: ../win/proxy/nhextio.c $(INCL)/nhxdr.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/nhextio.c
nhextnb.o: ../win/proxy/nhextnb.c $(INCL)/nhxdr.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/nhextnb.c
compxdr.o: ../win/proxy/compxdr.c $(INCL)/nhxdr.h $(INCL)/proxycom.h
	$(CCOMPILE) $(CFLAGS) -o$@ ../win/proxy/compxdr.c
gl_conf.o: ../win/gl/gl_conf.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_conf.c
gl_emul.o: ../win/gl/gl_emul.c $(HACK_H) $(INCL)/winGL.h \
		$(INCL)/func_tab.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_emul.c
gl_font.o: ../win/gl/gl_font.c $(HACK_H) $(INCL)/patchlevel.h \
		$(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_font.c
gl_hardw.o: ../win/gl/gl_hardw.c $(HACK_H) $(INCL)/patchlevel.h \
		$(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_hardw.c
gl_image.o: ../win/gl/gl_image.c $(HACK_H) $(INCL)/patchlevel.h \
		$(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_image.c
gl_main.o: ../win/gl/gl_main.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_main.c
gl_map.o: ../win/gl/gl_map.c $(HACK_H) $(INCL)/patchlevel.h \
		$(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_map.c
gl_menu.o: ../win/gl/gl_menu.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_menu.c
gl_opt.o: ../win/gl/gl_opt.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/date.h $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_opt.c
gl_role.o: ../win/gl/gl_role.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_role.c
gl_rendu.o: ../win/gl/gl_rendu.c $(HACK_H) $(INCL)/patchlevel.h \
		$(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_rendu.c
gl_softw.o: ../win/gl/gl_softw.c $(HACK_H) $(INCL)/patchlevel.h \
		$(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_softw.c
gl_stat.o: ../win/gl/gl_stat.c $(HACK_H) $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_stat.c
gl_text.o: ../win/gl/gl_text.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_text.c
gl_tile.o: ../win/gl/gl_tile.c $(HACK_H) $(INCL)/patchlevel.h \
		$(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_tile.c
gl_unit.o: ../win/gl/gl_unit.c $(HACK_H) $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_unit.c
gl_win.o: ../win/gl/gl_win.c $(HACK_H) $(INCL)/dlb.h \
		$(INCL)/patchlevel.h $(INCL)/winGL.h
	$(CCOMPILE) $(CFLAGS) $(SDLGL_CFLAGS) -o$@ ../win/gl/gl_win.c
tile.o: tile.c $(HACK_H)
qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) $(INCL)/func_tab.h \
		$(INCL)/dlb.h $(INCL)/date.h $(INCL)/patchlevel.h \
		$(INCL)/tile2x11.h $(INCL)/qt_win.h \
		$(INCL)/qt_clust.h $(INCL)/qt_kde0.h \
		$(INCL)/qt_xpms.h qt_win.moc qt_kde0.moc qttableview.moc
	$(CXX) $(CXXFLAGS) -o$@ ../win/Qt/qt_win.cpp
qt_clust.o: ../win/Qt/qt_clust.cpp $(INCL)/qt_clust.h
	$(CXX) $(CXXFLAGS) -o$@ ../win/Qt/qt_clust.cpp
qttableview.o: ../win/Qt/qttableview.cpp $(INCL)/qttableview.h
	$(CXX) $(CXXFLAGS) -o$@ ../win/Qt/qttableview.cpp
monstr.o: monstr.c $(CONFIG_H)
vis_tab.o: vis_tab.c $(CONFIG_H) $(INCL)/vis_tab.h
allmain.o: allmain.c $(HACK_H) $(INCL)/patchlevel.h
alloc.o: alloc.c $(CONFIG_H)
apply.o: apply.c $(HACK_H) $(INCL)/edog.h
artifact.o: artifact.c $(HACK_H) $(INCL)/artifact.h $(INCL)/artilist.h
attrib.o: attrib.c $(HACK_H)
ball.o: ball.c $(HACK_H)
bones.o: bones.c $(HACK_H) $(INCL)/lev.h
botl.o: botl.c $(HACK_H)
cmd.o: cmd.c $(HACK_H) $(INCL)/func_tab.h
dbridge.o: dbridge.c $(HACK_H)
decl.o: decl.c $(HACK_H)
detect.o: detect.c $(HACK_H) $(INCL)/artifact.h
dig.o: dig.c $(HACK_H) $(INCL)/edog.h
display.o: display.c $(HACK_H)
dlb.o: dlb.c $(CONFIG_H) $(INCL)/dlb.h
do.o: do.c $(HACK_H) $(INCL)/lev.h
do_name.o: do_name.c $(HACK_H)
do_wear.o: do_wear.c $(HACK_H)
dog.o: dog.c $(HACK_H) $(INCL)/edog.h $(INCL)/emin.h $(INCL)/epri.h
dogmove.o: dogmove.c $(HACK_H) $(INCL)/mfndpos.h $(INCL)/edog.h \
		$(INCL)/emin.h $(INCL)/epri.h
dokick.o: dokick.c $(HACK_H) $(INCL)/eshk.h
dothrow.o: dothrow.c $(HACK_H) $(INCL)/eshk.h
drawing.o: drawing.c $(HACK_H) $(INCL)/tcap.h
dungeon.o: dungeon.c $(HACK_H) $(INCL)/dgn_file.h $(INCL)/dlb.h
eat.o: eat.c $(HACK_H)
end.o: end.c $(HACK_H) $(INCL)/eshk.h $(INCL)/dlb.h
engrave.o: engrave.c $(HACK_H) $(INCL)/lev.h
exper.o: exper.c $(HACK_H)
explode.o: explode.c $(HACK_H)
extralev.o: extralev.c $(HACK_H)
files.o: files.c $(HACK_H) $(INCL)/dlb.h $(INCL)/filename.h \
		$(INCL)/winGL.h $(INCL)/winproxy.h
fountain.o: fountain.c $(HACK_H)
hack.o: hack.c $(HACK_H)
hacklib.o: hacklib.c $(HACK_H)
invent.o: invent.c $(HACK_H)
light.o: light.c $(HACK_H) $(INCL)/lev.h
lock.o: lock.c $(HACK_H)
mail.o: mail.c $(HACK_H) $(INCL)/mail.h
makemon.o: makemon.c $(HACK_H) $(INCL)/epri.h $(INCL)/emin.h \
		$(INCL)/edog.h
mapglyph.o: mapglyph.c $(HACK_H)
mcastu.o: mcastu.c $(HACK_H)
mhitm.o: mhitm.c $(HACK_H) $(INCL)/artifact.h $(INCL)/edog.h
mhitu.o: mhitu.c $(HACK_H) $(INCL)/artifact.h $(INCL)/edog.h
minion.o: minion.c $(HACK_H) $(INCL)/emin.h $(INCL)/epri.h
mklev.o: mklev.c $(HACK_H)
mkmap.o: mkmap.c $(HACK_H) $(INCL)/sp_lev.h
mkmaze.o: mkmaze.c $(HACK_H) $(INCL)/sp_lev.h $(INCL)/lev.h
mkobj.o: mkobj.c $(HACK_H)
mkroom.o: mkroom.c $(HACK_H)
mon.o: mon.c $(HACK_H) $(INCL)/mfndpos.h $(INCL)/edog.h \
		$(INCL)/artifact.h
mondata.o: mondata.c $(HACK_H) $(INCL)/eshk.h $(INCL)/epri.h
monmove.o: monmove.c $(HACK_H) $(INCL)/mfndpos.h $(INCL)/artifact.h \
		$(INCL)/epri.h
monst.o: 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
mplayer.o: mplayer.c $(HACK_H)
mthrowu.o: mthrowu.c $(HACK_H)
muse.o: muse.c $(HACK_H) $(INCL)/edog.h
music.o: music.c $(HACK_H) #interp.c
o_init.o: o_init.c $(HACK_H) $(INCL)/lev.h
objects.o: objects.c $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \
		$(INCL)/prop.h $(INCL)/skills.h $(INCL)/color.h
objnam.o: objnam.c $(HACK_H)
options.o: options.c $(CONFIG_H) $(INCL)/objclass.h $(INCL)/flag.h \
		$(HACK_H) $(INCL)/tcap.h $(INCL)/winGL.h \
		$(INCL)/filename.h
pager.o: pager.c $(HACK_H) $(INCL)/dlb.h
pickup.o: pickup.c $(HACK_H)
pline.o: pline.c $(HACK_H) $(INCL)/epri.h $(INCL)/edog.h
polyself.o: polyself.c $(HACK_H)
potion.o: potion.c $(HACK_H)
pray.o: pray.c $(HACK_H) $(INCL)/epri.h
priest.o: priest.c $(HACK_H) $(INCL)/mfndpos.h $(INCL)/eshk.h \
		$(INCL)/epri.h $(INCL)/emin.h
quest.o: quest.c $(HACK_H) $(INCL)/qtext.h
questpgr.o: questpgr.c $(HACK_H) $(INCL)/dlb.h $(INCL)/qtext.h
read.o: read.c $(HACK_H)
rect.o: rect.c $(HACK_H)
region.o: region.c $(HACK_H) $(INCL)/lev.h
restore.o: restore.c $(HACK_H) $(INCL)/lev.h $(INCL)/tcap.h
rip.o: rip.c $(HACK_H)
rnd.o: rnd.c $(HACK_H)
role.o: role.c $(HACK_H)
rumors.o: rumors.c $(HACK_H) $(INCL)/lev.h $(INCL)/dlb.h
save.o: save.c $(HACK_H) $(INCL)/lev.h
shk.o: shk.c $(HACK_H) $(INCL)/eshk.h
shknam.o: shknam.c $(HACK_H) $(INCL)/eshk.h
sit.o: sit.c $(HACK_H) $(INCL)/artifact.h
sounds.o: sounds.c $(HACK_H) $(INCL)/edog.h
sp_lev.o: sp_lev.c $(HACK_H) $(INCL)/dlb.h $(INCL)/sp_lev.h
spell.o: spell.c $(HACK_H) $(INCL)/edog.h
steal.o: steal.c $(HACK_H)
steed.o: steed.c $(HACK_H)
teleport.o: teleport.c $(HACK_H)
timeout.o: timeout.c $(HACK_H) $(INCL)/lev.h
topten.o: topten.c $(HACK_H) $(INCL)/dlb.h $(INCL)/patchlevel.h
track.o: track.c $(HACK_H)
trap.o: trap.c $(HACK_H)
u_init.o: u_init.c $(HACK_H)
uhitm.o: uhitm.c $(HACK_H)
vault.o: vault.c $(HACK_H) $(INCL)/vault.h
version.o: version.c $(HACK_H) $(INCL)/date.h $(INCL)/patchlevel.h
vision.o: vision.c $(HACK_H) $(INCL)/vis_tab.h
weapon.o: weapon.c $(HACK_H)
were.o: were.c $(HACK_H)
wield.o: wield.c $(HACK_H)
windows.o: windows.c $(HACK_H) $(INCL)/wingem.h $(INCL)/winGnome.h \
		$(INCL)/winGL.h $(INCL)/winproxy.h
wizard.o: wizard.c $(HACK_H) $(INCL)/qtext.h $(INCL)/epri.h
worm.o: worm.c $(HACK_H) $(INCL)/lev.h
worn.o: worn.c $(HACK_H)
write.o: write.c $(HACK_H)
zap.o: zap.c $(HACK_H)
gypsy.o: gypsy.c $(HACK_H) $(INCL)/egyp.h $(INCL)/qtext.h
tech.o: tech.c $(HACK_H)

# end of file
