# Build NetHack 3.4.3 from the command line with
# Microsoft Visual Studio 2022 Community Edition
#
# Apply this patch from the top of your NetHack source tree, then
#
# cd sys/winnt
# nhsetup.bat
# cd ../../src
# nmake install


diff -ur dist343/include/config1.h test2022/include/config1.h
--- dist343/include/config1.h	2022-12-04 11:41:13.245773500 -0500
+++ include/config1.h	2022-12-04 18:09:49.803010900 -0500
@@ -121,7 +121,7 @@
 # define NHSTDC
 # define USE_STDARG
 # define NEED_VARARGS
-
+#include "win32api.h"
 #ifndef WIN_CE
 # define STRNCMPI
 # define STRCMPI
diff -ur dist343/include/ntconf.h test2022/include/ntconf.h
--- dist343/include/ntconf.h	2022-12-04 11:41:13.402311900 -0500
+++ include/ntconf.h	2022-12-04 18:09:49.966431600 -0500
@@ -107,7 +107,8 @@
 #define Rand()	rand()
 #endif
 
-#define FCMASK	0660	/* file creation mask */
+#include <sys/stat.h>
+#define FCMASK	(_S_IREAD | _S_IWRITE)	/* file creation mask */
 #define regularize	nt_regularize
 #define HLOCK "NHPERM"
 
diff -ur dist343/src/explode.c test2022/src/explode.c
--- dist343/src/explode.c	2022-12-04 11:41:19.974057600 -0500
+++ src/explode.c	2022-12-04 18:09:32.443797300 -0500
@@ -7,7 +7,7 @@
 #ifdef OVL0
 
 /* Note: Arrays are column first, while the screen is row first */
-static int expl[3][3] = {
+static int expl1[3][3] = {
 	{ S_explode1, S_explode4, S_explode7 },
 	{ S_explode2, S_explode5, S_explode8 },
 	{ S_explode3, S_explode6, S_explode9 }
@@ -182,7 +182,7 @@
 		for (i=0; i<3; i++) for (j=0; j<3; j++) {
 			if (explmask[i][j] == 2) continue;
 			tmp_at(starting ? DISP_BEAM : DISP_CHANGE,
-				explosion_to_glyph(expltype,expl[i][j]));
+				explosion_to_glyph(expltype,expl1[i][j]));
 			tmp_at(i+x-1, j+y-1);
 			starting = 0;
 		}
@@ -208,7 +208,7 @@
 		    for (i=0; i<3; i++) for (j=0; j<3; j++) {
 			if (explmask[i][j] == 1)
 			    show_glyph(i+x-1,j+y-1,
-					explosion_to_glyph(expltype, expl[i][j]));
+					explosion_to_glyph(expltype, expl1[i][j]));
 		    }
 
 		} else {		/* delay a little bit. */
diff -ur dist343/src/files.c test2022/src/files.c
--- dist343/src/files.c	2022-12-04 11:41:19.989068800 -0500
+++ src/files.c	2022-12-04 18:09:32.458066300 -0500
@@ -130,6 +130,9 @@
 # endif
 #define Close close
 #ifndef WIN_CE
+#ifdef DeleteFile
+#undef DeleteFile
+#endif
 #define DeleteFile unlink
 #endif
 #endif
diff -ur dist343/sys/winnt/Makefile.msc test2022/sys/winnt/Makefile.msc
--- dist343/sys/winnt/Makefile.msc	2022-12-04 11:31:54.698699000 -0500
+++ sys/winnt/Makefile.msc	2022-12-04 18:10:40.210433100 -0500
@@ -1,11 +1,11 @@
-#       SCCS Id: @(#)Makefile.msc       3.4     $Date: 2003/11/16 04:50:58 $
-#       Copyright (c) NetHack PC Development Team 1993-2003
+#       SCCS Id: @(#)Makefile.msc 3.4     $Date: 2003/11/16 04:50:58 $
+#       Copyright (c) NetHack PC Development Team 1993-2022
 #
-#       NetHack 3.4.x Makefile for MS Visual C++ V6.x and above and MS NMAKE
+#       NetHack 3.4.x Makefile for Visual Studio
 #  
 #       Win32 Compilers Tested:
-#                              - Microsoft 32 bit Visual C++ V4.x
-#                              - Microsoft 32 bit Visual C++ V6.0 SP3, SP4
+#                              - Microsoft x86 build
+#                                using Visual Studio 2022 Community Edition
 #
 #   This is used for building two versions of NetHack:
 #   A tty port utilizing the Win32 Console I/O subsystem, Console
@@ -24,26 +24,16 @@
 #       If you have any questions read the sys/winnt/Install.nt file included 
 #       with the distribution.
 #==============================================================================
-# Do not delete the following 3 lines.
-#
-TARGETOS=BOTH
-APPVER=4.0
-#!include <win32.mak>
-
-# Graphical interface
-# Set to Y for a graphical version
 
-#GRAPHICAL = Y
+# if you want to see the compiler command lines, comment this line out
+Q=@
 
 #  Set the gamedir according to your preference.  
 #  If not present prior to compilation it gets created.
 
-!IF "$(GRAPHICAL)" == "Y"
-GAME    = NetHackW                # Game Name
-!ELSE
-GAME    = NetHack                 # Game Name
-!ENDIF
-
+GAME = NetHack
+GAMEGUI = NetHackW                # Game Name
+GAMETTY = NetHack                 # Game Name
 GAMEDIR = ..\binary               # Game directory
 
 #
@@ -65,8 +55,8 @@
 #  Object directory.
 #
 
-OBJ     = o
-
+OBJTTY = o\tty
+OBJGUI = o\gui
 
 #
 #==========================================
@@ -110,7 +100,8 @@
 # (see pcconf.h). Set to nothing if not used.
 #
 
-RANDOM	= $(OBJ)\random.o
+RANDOMTTY = $(OBJTTY)\random.o
+RANDOMGUI = $(OBJGUI)\random.o
 #RANDOM	=
 
 #
@@ -136,27 +127,12 @@
 #                                              #
 ################################################
 
-!IF "$(GRAPHICAL)" == "Y"
-WINPORT	= $(O)tile.o $(O)mhaskyn.o $(O)mhdlg.o \
-	$(O)mhfont.o $(O)mhinput.o $(O)mhmain.o $(O)mhmap.o \
-	$(O)mhmenu.o $(O)mhmsgwnd.o $(O)mhrip.o $(O)mhsplash.o \
-	$(O)mhstatus.o $(O)mhtext.o $(O)mswproc.o $(O)winhack.o
-WINPHDR	= $(WIN32)\mhaskyn.h $(WIN32)\mhdlg.h $(WIN32)\mhfont.h \
-	$(WIN32)\mhinput.h $(WIN32)\mhmain.h $(WIN32)\mhmap.h $(WIN32)\mhmenu.h \
-	$(WIN32)\mhmsg.h $(WIN32)\mhmsgwnd.h $(WIN32)\mhrip.h $(WIN32)\mhstatus.h \
-	$(WIN32)\mhtext.h $(WIN32)\resource.h $(WIN32)\winMS.h
-WINDLLS =
-WINPFLAG= -DTILES -DMSWIN_GRAPHICS
-NHRES	= $(O)winhack.res
-WINPINC	= -I$(WIN32)
-!ELSE
-WINPORT	= $(O)nttty.o    
-WINPHDR	=
-WINDLLS	= $(GAMEDIR)\nhdefkey.dll $(GAMEDIR)\nh340key.dll $(GAMEDIR)\nhraykey.dll
-WINPFLAG= -DWIN32CON
-NHRES	= $(O)console.res
-WINPINC	=
-!ENDIF
+#==========================================
+#================ MACROS ==================
+#==========================================
+# This section creates shorthand macros for many objects
+# referenced later on in the Makefile.
+#
 
 TILEUTIL16  = $(UTIL)\tile2bmp.exe
 TILEBMP16   = $(SRC)\tiles.bmp
@@ -164,10 +140,6 @@
 TILEUTIL32  = $(UTIL)\til2bm32.exe
 TILEBMP32   = $(SRC)\tiles32.bmp
 
-SOUND = $(OBJ)\ntsound.o
-
-#SOUND =
-
 # To store all the level files,
 # help files, etc. in a single library file.
 # USE_DLB = Y is left uncommented
@@ -180,36 +152,8 @@
 DLBFLG =
 ! ENDIF
 
-#==========================================
-# Setting up the compiler and linker
-# macros. All builds include the base ones.
-#==========================================
-
-CFLAGSBASE  = -c $(cflags) $(cvarsmt) -I$(INCL) -I$(NTSYS) -nologo $(cdebug) $(WINPINC)
-LFLAGSBASEC = $(linkdebug) /NODEFAULTLIB /INCREMENTAL:NO /RELEASE /NOLOGO -subsystem:console $(conlibsmt)
-LFLAGSBASEG = $(linkdebug) $(guiflags) $(guilibsmt) comctl32.lib
-
-#==========================================
-# Util builds
-#==========================================
-
-CFLAGSU = $(CFLAGSBASE) $(WINPFLAG)
-LFLAGSU	= $(LFLAGSBASEC)
-
-#==========================================
-# - Game build
-#==========================================
-LFLAGSBASE = $(linkdebug) /NODEFAULTLIB /INCREMENTAL:NO /RELEASE /NOLOGO -subsystem:console,4.0 $(conlibsmt)
-CFLAGS	 = $(CFLAGSBASE) $(WINPFLAG) $(DLBFLG)
-NHLFLAGS1 = /NODEFAULTLIB /INCREMENTAL:NO /PDB:"$(GAME).PDB" /RELEASE /NOLOGO
-NHLFLAGS2 = /MAP:"$(GAME).MAP" 
-!IF ("$(GRAPHICAL)"=="Y")
-LFLAGS	= $(LFLAGSBASEG) $(NHLFLAGS1) $(NHLFLAGS2)
-!ELSE
-LFLAGS	= $(LFLAGSBASEC) $(NHLFLAGS1) $(NHLFLAGS2)
-!ENDIF
-
-GAMEFILE = $(GAMEDIR)\$(GAME).exe # whole thing
+GAMEFILE1 = $(GAMEDIR)\$(GAMETTY).exe # whole thing
+GAMEFILE2 = $(GAMEDIR)\$(GAMEGUI).exe # whole thing
 
 ! IF ("$(USE_DLB)"=="Y")
 DLB = nhdat
@@ -217,91 +161,14 @@
 DLB =
 ! ENDIF
 
-link=link.exe
-rc=rc.exe
-
-#==========================================
-#================ RULES ==================
-#==========================================
-
-.SUFFIXES: .exe .o .til .uu .c .y .l
-
-#==========================================
-# Rules for files in src
-#==========================================
-
-.c{$(OBJ)}.o:
-	@$(cc) $(CFLAGS)  -Fo$@ $<
-
-{$(SRC)}.c{$(OBJ)}.o:
-	@$(CC) $(CFLAGS)   -Fo$@  $<
-
-#==========================================
-# Rules for files in sys\share
-#==========================================
-
-{$(SSYS)}.c{$(OBJ)}.o:
-	@$(CC) $(CFLAGS)  -Fo$@  $<
-
-#==========================================
-# Rules for files in sys\winnt
-#==========================================
-
-{$(NTSYS)}.c{$(OBJ)}.o:
-	@$(CC) $(CFLAGS)  -Fo$@  $<
-
-{$(NTSYS)}.h{$(INCL)}.h:
-	@copy $< $@
-
-#==========================================
-# Rules for files in util
-#==========================================
-
-{$(UTIL)}.c{$(OBJ)}.o:
-	@$(CC) $(CFLAGSU) -Fo$@ $<
-
-#==========================================
-# Rules for files in win\share
-#==========================================
-
-{$(WSHR)}.c{$(OBJ)}.o:
-	@$(CC) $(CFLAGS)  -Fo$@ $<
-
-{$(WSHR)}.h{$(INCL)}.h:
-	@copy $< $@
-
-#{$(WSHR)}.txt{$(DAT)}.txt:
-#	@copy $< $@
-
-#==========================================
-# Rules for files in win\tty
-#==========================================
-
-{$(TTY)}.c{$(OBJ)}.o:
-	@$(CC) $(CFLAGS)  -Fo$@  $<
-
-
-#==========================================
-# Rules for files in win\win32
-#==========================================
-
-{$(WIN32)}.c{$(OBJ)}.o:
-	@$(cc) $(CFLAGS)  -Fo$@  $<
-
-#==========================================
-#================ MACROS ==================
-#==========================================
-# This section creates shorthand macros for many objects
-# referenced later on in the Makefile.
-#
-
 DEFFILE = $(NTSYS)\$(GAME).def
 
 #
 # Shorten up the location for some files
 #
 
-O  = $(OBJ)^\
+OTTY = $(OBJTTY)^\
+OGUI = $(OBJGUI)^\
 
 U  = $(UTIL)^\
 
@@ -315,90 +182,156 @@
 
 DGNCOMPSRC     = $(U)dgn_yacc.c	$(U)dgn_$(LEX).c $(U)dgn_main.c
 
-MAKEOBJS       = $(O)makedefs.o $(O)monst.o $(O)objects.o
+TILEFILES      = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt
 
-SPLEVOBJS      = $(O)lev_yacc.o	$(O)lev_$(LEX).o $(O)lev_main.o \
-		 $(O)alloc.o	$(O)decl.o	$(O)drawing.o \
-		 $(O)monst.o	$(O)objects.o	$(O)panic.o
+MAKEDEFSOBJS   = $(OTTY)makedefs.o $(OTTY)monst.o $(OTTY)objects.o
 
-DGNCOMPOBJS    = $(O)dgn_yacc.o	$(O)dgn_$(LEX).o $(O)dgn_main.o \
-		 $(O)alloc.o	$(O)panic.o
+SPLEVOBJS      = $(OTTY)lev_yacc.o	$(OTTY)lev_$(LEX).o $(OTTY)lev_main.o \
+		 $(OTTY)alloc.o	$(OTTY)decl.o	$(OTTY)drawing.o \
+		 $(OTTY)monst.o	$(OTTY)objects.o	$(OTTY)panic.o
 
-RECOVOBJS      = $(O)recover.o
+DGNCOMPOBJS    = $(OTTY)dgn_yacc.o	$(OTTY)dgn_$(LEX).o $(OTTY)dgn_main.o \
+		 $(OTTY)alloc.o	$(OTTY)panic.o
 
-TILEFILES      = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt
+RECOVOBJS      = $(OTTY)recover.o
 
 #
 # These are not invoked during a normal game build in 3.4
 #
-TEXT_IO        = $(O)tiletext.o	$(O)tiletxt.o	$(O)drawing.o \
-		 $(O)decl.o	$(O)monst.o	$(O)objects.o
+TEXT_IO        = $(OTTY)tiletext.o	$(OTTY)tiletxt.o	$(OTTY)drawing.o \
+		 $(OTTY)decl.o	$(OTTY)monst.o	$(OTTY)objects.o
 
-TEXT_IO32      = $(O)tilete32.o $(O)tiletx32.o $(O)drawing.o \
-		 $(O)decl.o	$(O)monst.o	$(O)objects.o
+TEXT_IO32      = $(OTTY)tilete32.o $(OTTY)tiletx32.o $(OTTY)drawing.o \
+		 $(OTTY)decl.o	$(OTTY)monst.o	$(OTTY)objects.o
 
-GIFREADERS     = $(O)gifread.o	$(O)alloc.o $(O)panic.o
-GIFREADERS32   = $(O)gifrd32.o $(O)alloc.o $(O)panic.o
+GIFREADERS     = $(OTTY)gifread.o	$(OTTY)alloc.o $(OTTY)panic.o
+GIFREADERS32   = $(OTTY)gifrd32.o $(OTTY)alloc.o $(OTTY)panic.o
 
-PPMWRITERS     = $(O)ppmwrite.o $(O)alloc.o $(O)panic.o
+PPMWRITERS     = $(OTTY)ppmwrite.o $(OTTY)alloc.o $(OTTY)panic.o
 
 #
 #  Object files for the game itself.
 #
 
-VOBJ01 = $(O)allmain.o  $(O)alloc.o    $(O)apply.o    $(O)artifact.o
-VOBJ02 = $(O)attrib.o   $(O)ball.o     $(O)bones.o    $(O)botl.o    
-VOBJ03 = $(O)cmd.o      $(O)dbridge.o  $(O)decl.o     $(O)detect.o  
-VOBJ04 = $(O)dig.o      $(O)display.o  $(O)do.o       $(O)do_name.o 
-VOBJ05 = $(O)do_wear.o  $(O)dog.o      $(O)dogmove.o  $(O)dokick.o  
-VOBJ06 = $(O)dothrow.o  $(O)drawing.o  $(O)dungeon.o  $(O)eat.o     
-VOBJ07 = $(O)end.o      $(O)engrave.o  $(O)exper.o    $(O)explode.o 
-VOBJ08 = $(O)extralev.o $(O)files.o    $(O)fountain.o $(O)hack.o    
-VOBJ09 = $(O)hacklib.o  $(O)invent.o   $(O)light.o    $(O)lock.o    
-VOBJ10 = $(O)mail.o     $(O)pcmain.o   $(O)makemon.o  $(O)mapglyph.o $(O)mcastu.o  
-VOBJ11 = $(O)mhitm.o    $(O)mhitu.o    $(O)minion.o   $(O)mklev.o   
-VOBJ12 = $(O)mkmap.o    $(O)mkmaze.o   $(O)mkobj.o    $(O)mkroom.o  
-VOBJ13 = $(O)mon.o      $(O)mondata.o  $(O)monmove.o  $(O)monst.o   
-VOBJ14 = $(O)monstr.o   $(O)mplayer.o  $(O)mthrowu.o  $(O)muse.o    
-VOBJ15 = $(O)music.o    $(O)o_init.o   $(O)objects.o  $(O)objnam.o  
-VOBJ16 = $(O)options.o  $(O)pager.o    $(O)pickup.o   $(O)pline.o   
-VOBJ17 = $(O)polyself.o $(O)potion.o   $(O)pray.o     $(O)priest.o  
-VOBJ18 = $(O)quest.o    $(O)questpgr.o $(RANDOM)      $(O)read.o    
-VOBJ19 = $(O)rect.o     $(O)region.o   $(O)restore.o  $(O)rip.o     
-VOBJ20 = $(O)rnd.o      $(O)role.o     $(O)rumors.o   $(O)save.o    
-VOBJ21 = $(O)shk.o      $(O)shknam.o   $(O)sit.o      $(O)sounds.o  
-VOBJ22 = $(O)sp_lev.o   $(O)spell.o    $(O)steal.o    $(O)steed.o   
-VOBJ23 = $(O)teleport.o $(O)timeout.o  $(O)topten.o   $(O)track.o   
-VOBJ24 = $(O)trap.o     $(O)u_init.o   $(O)uhitm.o    $(O)vault.o   
-VOBJ25 = $(O)vis_tab.o  $(O)vision.o   $(O)weapon.o   $(O)were.o    
-VOBJ26 = $(O)wield.o    $(O)windows.o  $(O)wizard.o   $(O)worm.o    
-VOBJ27 = $(O)worn.o     $(O)write.o    $(O)zap.o     
-
-DLBOBJ = $(O)dlb.o
-
-TTYOBJ = $(O)topl.o     $(O)getline.o  $(O)wintty.o
-
-SOBJ   = $(O)winnt.o    $(O)pcsys.o      $(O)pcunix.o  \
-	   $(SOUND) 	$(O)mapimail.o $(O)nhlan.o
-
-OBJS   = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \
-         $(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \
-         $(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \
-         $(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \
-         $(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \
-         $(VOBJ26) $(VOBJ27)
+#
+# - TTY
+#
 
-WINPOBJ = $(WINPORT)
+WINPORTTTY = $(OTTY)nttty.o    
+WINPHDRTTY =
+WINDLLSTTY = $(GAMEDIR)\nhdefkey.dll $(GAMEDIR)\nh340key.dll $(GAMEDIR)\nhraykey.dll
+WINPFLAGSTTY = -DWIN32CON
+NHRESTTY = $(OTTY)console.res
+WINPINCTTY =
+SOUNDTTY = $(OBJTTY)\ntsound.o
+
+TTYOBJ01 = $(OTTY)allmain.o  $(OTTY)alloc.o    $(OTTY)apply.o    $(OTTY)artifact.o
+TTYOBJ02 = $(OTTY)attrib.o   $(OTTY)ball.o     $(OTTY)bones.o    $(OTTY)botl.o    
+TTYOBJ03 = $(OTTY)cmd.o      $(OTTY)dbridge.o  $(OTTY)decl.o     $(OTTY)detect.o  
+TTYOBJ04 = $(OTTY)dig.o      $(OTTY)display.o  $(OTTY)do.o       $(OTTY)do_name.o 
+TTYOBJ05 = $(OTTY)do_wear.o  $(OTTY)dog.o      $(OTTY)dogmove.o  $(OTTY)dokick.o  
+TTYOBJ06 = $(OTTY)dothrow.o  $(OTTY)drawing.o  $(OTTY)dungeon.o  $(OTTY)eat.o     
+TTYOBJ07 = $(OTTY)end.o      $(OTTY)engrave.o  $(OTTY)exper.o    $(OTTY)explode.o 
+TTYOBJ08 = $(OTTY)extralev.o $(OTTY)files.o    $(OTTY)fountain.o $(OTTY)hack.o    
+TTYOBJ09 = $(OTTY)hacklib.o  $(OTTY)invent.o   $(OTTY)light.o    $(OTTY)lock.o    
+TTYOBJ10 = $(OTTY)mail.o     $(OTTY)pcmain.o   $(OTTY)makemon.o  $(OTTY)mapglyph.o $(OTTY)mcastu.o  
+TTYOBJ11 = $(OTTY)mhitm.o    $(OTTY)mhitu.o    $(OTTY)minion.o   $(OTTY)mklev.o   
+TTYOBJ12 = $(OTTY)mkmap.o    $(OTTY)mkmaze.o   $(OTTY)mkobj.o    $(OTTY)mkroom.o  
+TTYOBJ13 = $(OTTY)mon.o      $(OTTY)mondata.o  $(OTTY)monmove.o  $(OTTY)monst.o   
+TTYOBJ14 = $(OTTY)monstr.o   $(OTTY)mplayer.o  $(OTTY)mthrowu.o  $(OTTY)muse.o    
+TTYOBJ15 = $(OTTY)music.o    $(OTTY)o_init.o   $(OTTY)objects.o  $(OTTY)objnam.o  
+TTYOBJ16 = $(OTTY)options.o  $(OTTY)pager.o    $(OTTY)pickup.o   $(OTTY)pline.o   
+TTYOBJ17 = $(OTTY)polyself.o $(OTTY)potion.o   $(OTTY)pray.o     $(OTTY)priest.o  
+TTYOBJ18 = $(OTTY)quest.o    $(OTTY)questpgr.o $(RANDOMTTY)      $(OTTY)read.o    
+TTYOBJ19 = $(OTTY)rect.o     $(OTTY)region.o   $(OTTY)restore.o  $(OTTY)rip.o     
+TTYOBJ20 = $(OTTY)rnd.o      $(OTTY)role.o     $(OTTY)rumors.o   $(OTTY)save.o    
+TTYOBJ21 = $(OTTY)shk.o      $(OTTY)shknam.o   $(OTTY)sit.o      $(OTTY)sounds.o  
+TTYOBJ22 = $(OTTY)sp_lev.o   $(OTTY)spell.o    $(OTTY)steal.o    $(OTTY)steed.o   
+TTYOBJ23 = $(OTTY)teleport.o $(OTTY)timeout.o  $(OTTY)topten.o   $(OTTY)track.o   
+TTYOBJ24 = $(OTTY)trap.o     $(OTTY)u_init.o   $(OTTY)uhitm.o    $(OTTY)vault.o   
+TTYOBJ25 = $(OTTY)vis_tab.o  $(OTTY)vision.o   $(OTTY)weapon.o   $(OTTY)were.o    
+TTYOBJ26 = $(OTTY)wield.o    $(OTTY)windows.o  $(OTTY)wizard.o   $(OTTY)worm.o    
+TTYOBJ27 = $(OTTY)worn.o     $(OTTY)write.o    $(OTTY)zap.o     
+
+TTYDLBOBJ = $(OTTY)dlb.o
+
+TTYOBJ = $(OTTY)topl.o     $(OTTY)getline.o  $(OTTY)wintty.o
+
+TTYSOBJ   = $(OTTY)winnt.o    $(OTTY)pcsys.o      $(OTTY)pcunix.o  \
+	   $(SOUNDTTY) 	$(OTTY)mapimail.o $(OTTY)nhlan.o
+
+TTYOBJS   = $(TTYOBJ01) $(TTYOBJ02) $(TTYOBJ03) $(TTYOBJ04) $(TTYOBJ05) \
+	 $(TTYOBJ06) $(TTYOBJ07) $(TTYOBJ08) $(TTYOBJ09) $(TTYOBJ10) \
+	 $(TTYOBJ11) $(TTYOBJ12) $(TTYOBJ13) $(TTYOBJ14) $(TTYOBJ15) \
+	 $(TTYOBJ16) $(TTYOBJ17) $(TTYOBJ18) $(TTYOBJ19) $(TTYOBJ20) \
+	 $(TTYOBJ21) $(TTYOBJ22) $(TTYOBJ23) $(TTYOBJ24) $(TTYOBJ25) \
+	 $(TTYOBJ26) $(TTYOBJ27)
+
+TTYVVOBJ  = $(OTTY)version.o
+
+TTYALLOBJ  = $(WINPORTTTY) $(TTYSOBJ) $(TTYDLBOBJ) $(TTYOBJ) $(WOBJ) $(TTYOBJS) $(TTYVVOBJ)
+
+#
+# - GUI
+#
+
+WINPORTGUI = $(OGUI)tile.o $(OGUI)mhaskyn.o $(OGUI)mhdlg.o \
+	$(OGUI)mhfont.o $(OGUI)mhinput.o $(OGUI)mhmain.o $(OGUI)mhmap.o \
+	$(OGUI)mhmenu.o $(OGUI)mhmsgwnd.o $(OGUI)mhrip.o $(OGUI)mhsplash.o \
+	$(OGUI)mhstatus.o $(OGUI)mhtext.o $(OGUI)mswproc.o $(OGUI)winhack.o
+WINPHDRGUI = $(WIN32)\mhaskyn.h $(WIN32)\mhdlg.h $(WIN32)\mhfont.h \
+	$(WIN32)\mhinput.h $(WIN32)\mhmain.h $(WIN32)\mhmap.h $(WIN32)\mhmenu.h \
+	$(WIN32)\mhmsg.h $(WIN32)\mhmsgwnd.h $(WIN32)\mhrip.h $(WIN32)\mhstatus.h \
+	$(WIN32)\mhtext.h $(WIN32)\resource.h $(WIN32)\winMS.h
+WINPFLAGSGUI = -DMSWIN_GRAPHICS
+NHRESGUI = $(OGUI)winhack.res
+WINPINCGUI = -I$(WIN32)
+SOUNDGUI = $(OBJGUI)\ntsound.o
+
+GUIOBJ01 = $(OGUI)allmain.o  $(OGUI)alloc.o    $(OGUI)apply.o    $(OGUI)artifact.o
+GUIOBJ02 = $(OGUI)attrib.o   $(OGUI)ball.o     $(OGUI)bones.o    $(OGUI)botl.o    
+GUIOBJ03 = $(OGUI)cmd.o      $(OGUI)dbridge.o  $(OGUI)decl.o     $(OGUI)detect.o  
+GUIOBJ04 = $(OGUI)dig.o      $(OGUI)display.o  $(OGUI)do.o       $(OGUI)do_name.o 
+GUIOBJ05 = $(OGUI)do_wear.o  $(OGUI)dog.o      $(OGUI)dogmove.o  $(OGUI)dokick.o  
+GUIOBJ06 = $(OGUI)dothrow.o  $(OGUI)drawing.o  $(OGUI)dungeon.o  $(OGUI)eat.o     
+GUIOBJ07 = $(OGUI)end.o      $(OGUI)engrave.o  $(OGUI)exper.o    $(OGUI)explode.o 
+GUIOBJ08 = $(OGUI)extralev.o $(OGUI)files.o    $(OGUI)fountain.o $(OGUI)hack.o    
+GUIOBJ09 = $(OGUI)hacklib.o  $(OGUI)invent.o   $(OGUI)light.o    $(OGUI)lock.o    
+GUIOBJ10 = $(OGUI)mail.o     $(OGUI)pcmain.o   $(OGUI)makemon.o  $(OGUI)mapglyph.o $(OGUI)mcastu.o  
+GUIOBJ11 = $(OGUI)mhitm.o    $(OGUI)mhitu.o    $(OGUI)minion.o   $(OGUI)mklev.o   
+GUIOBJ12 = $(OGUI)mkmap.o    $(OGUI)mkmaze.o   $(OGUI)mkobj.o    $(OGUI)mkroom.o  
+GUIOBJ13 = $(OGUI)mon.o      $(OGUI)mondata.o  $(OGUI)monmove.o  $(OGUI)monst.o   
+GUIOBJ14 = $(OGUI)monstr.o   $(OGUI)mplayer.o  $(OGUI)mthrowu.o  $(OGUI)muse.o    
+GUIOBJ15 = $(OGUI)music.o    $(OGUI)o_init.o   $(OGUI)objects.o  $(OGUI)objnam.o  
+GUIOBJ16 = $(OGUI)options.o  $(OGUI)pager.o    $(OGUI)pickup.o   $(OGUI)pline.o   
+GUIOBJ17 = $(OGUI)polyself.o $(OGUI)potion.o   $(OGUI)pray.o     $(OGUI)priest.o  
+GUIOBJ18 = $(OGUI)quest.o    $(OGUI)questpgr.o $(RANDOMGUI)      $(OGUI)read.o    
+GUIOBJ19 = $(OGUI)rect.o     $(OGUI)region.o   $(OGUI)restore.o  $(OGUI)rip.o     
+GUIOBJ20 = $(OGUI)rnd.o      $(OGUI)role.o     $(OGUI)rumors.o   $(OGUI)save.o    
+GUIOBJ21 = $(OGUI)shk.o      $(OGUI)shknam.o   $(OGUI)sit.o      $(OGUI)sounds.o  
+GUIOBJ22 = $(OGUI)sp_lev.o   $(OGUI)spell.o    $(OGUI)steal.o    $(OGUI)steed.o   
+GUIOBJ23 = $(OGUI)teleport.o $(OGUI)timeout.o  $(OGUI)topten.o   $(OGUI)track.o   
+GUIOBJ24 = $(OGUI)trap.o     $(OGUI)u_init.o   $(OGUI)uhitm.o    $(OGUI)vault.o   
+GUIOBJ25 = $(OGUI)vis_tab.o  $(OGUI)vision.o   $(OGUI)weapon.o   $(OGUI)were.o    
+GUIOBJ26 = $(OGUI)wield.o    $(OGUI)windows.o  $(OGUI)wizard.o   $(OGUI)worm.o    
+GUIOBJ27 = $(OGUI)worn.o     $(OGUI)write.o    $(OGUI)zap.o     
+
+GUIDLBOBJ = $(OGUI)dlb.o
+
+GUISOBJ   = $(OGUI)winnt.o    $(OGUI)pcsys.o      $(OGUI)pcunix.o  \
+	   $(SOUNDGUI) 	$(OGUI)mapimail.o $(OGUI)nhlan.o
+
+GUIOBJS   = $(GUIOBJ01) $(GUIOBJ02) $(GUIOBJ03) $(GUIOBJ04) $(GUIOBJ05) \
+	 $(GUIOBJ06) $(GUIOBJ07) $(GUIOBJ08) $(GUIOBJ09) $(GUIOBJ10) \
+	 $(GUIOBJ11) $(GUIOBJ12) $(GUIOBJ13) $(GUIOBJ14) $(GUIOBJ15) \
+	 $(GUIOBJ16) $(GUIOBJ17) $(GUIOBJ18) $(GUIOBJ19) $(GUIOBJ20) \
+	 $(GUIOBJ21) $(GUIOBJ22) $(GUIOBJ23) $(GUIOBJ24) $(GUIOBJ25) \
+	 $(GUIOBJ26) $(GUIOBJ27)
 
-VVOBJ  = $(O)version.o
+GUIVVOBJ  = $(OGUI)version.o
 
-ALLOBJ  = $(WINPOBJ) $(SOBJ) $(DLBOBJ)  $(TTYOBJ) $(WOBJ) $(OBJS) $(VVOBJ)
+GUIALLOBJ  = $(WINPORTGUI) $(GUISOBJ) $(GUIDLBOBJ) $(WOBJ) $(GUIOBJS) $(GUIVVOBJ)
 
-!IF "$(GRAPHICAL)" == "Y"
-OPTIONS_FILE = $(DAT)\guioptions
-!ELSE
-OPTIONS_FILE = $(DAT)\ttyoptions
-!ENDIF
 #==========================================
 # Header file macros
 #==========================================
@@ -436,11 +369,195 @@
 
 DATABASE = $(DAT)\data.base
 
-#
-#  The name of the game.
-#
+cc=cl.exe
+CC=cl.exe
+cpp=cl.exe
+CPP=cl.exe
+link=link.exe
+LINK=link.exe
+librarian=lib.exe
+LIBRARIAN=lib.exe
+rc=Rc.exe
+RC=Rc.exe
 
-GAMEFILE = $(GAMEDIR)\$(GAME).exe
+#==========================================
+# Setting up the compiler and linker
+# macros. All builds include the base ones.
+#==========================================
+
+!IFNDEF TARGET_CPU
+TARGET_CPU=x86
+!ENDIF
+
+ccommon= -c -nologo -D"_CONSOLE" -D"_CRT_NONSTDC_NO_DEPRECATE" -D"_CRT_SECURE_NO_DEPRECATE" \
+	-D"_LIB" -D"_SCL_SECURE_NO_DEPRECATE" -D"_VC80_UPGRADE=0x0600" -D"_MBCS" \
+	-DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D"NDEBUG" -D"YY_NO_UNISTD_H" \
+	-DHAS_STDINT_H -DHAS_INLINE $(CURSESDEF) $(RUNTIMEOPTDEF) \
+	-EHsc -fp:precise -Gd -GF -GS -Gy \
+	$(CL_RECENT) -WX- -Zc:forScope -Zc:wchar_t -Zi
+cdebug= -analyze- -D"_DEBUG" -MTd -RTC1 -Od $(ASAN)
+crelease= -analyze- -D"_MBCS" -errorReport:prompt -MT -O2 -Ot -Ox -Oy
+
+lcommon= /NOLOGO /INCREMENTAL:NO
+
+!IF "$(DEBUGINFO)" == "Y"
+ldebug = /DEBUG
+cflags1=$(ccommon) $(cdebug)
+lflags1=$(lcommon) $(ldebug)
+!ELSE
+ldebug= /DEBUG
+cflags1=$(ccommon) $(crelease)
+lflags1=$(lcommon) $(ldebug)
+!ENDIF
+
+lflags= $(lflags1)
+
+!IF "$(TARGET_CPU)" == "x86"
+cflags2 = $(cflags1) -D_X86_=1  -DWIN32 -D_WIN32 -W3
+scall  = -Gz
+
+!ELSEIF "$(TARGET_CPU)" == "x64"
+cflags2 = $(cflags1) -D_AMD64_=1 -DWIN64 -D_WIN64  -DWIN32 -D_WIN32 -W4
+scall  =
+!ENDIF
+
+#cflags = $(cflags:-W4=-W3)
+# 4100 unreferenced formal parameter
+# 4131 old-style declarator; NetHack 3.4.3 needs to suppress this one.
+# 4244 conversion possible loss of data
+# 4245 conversion from 'char' to 'uchar', signed/unsigned mismatch
+# 4310 a constant value is cast to a smaller type
+# 4706 assignment within conditional
+# 4774 format string is not a string literal (default is off at W4)
+# 4777 format string requires an argument of type ‘type’,
+#      but variadic argument ‘position’ has type ‘type’
+# 4820 padding in struct
+cflags2 = $(cflags2:-W3=-W4)
+cflags2 = $(cflags2) -wd4100 -wd4113 -wd4131 -wd4244 -wd4245 \
+	-wd4310 -wd4706 -w44777 -wd4701 -wd4820
+cppflags = $(cflags2)
+
+cflags3 = -c $(cflags2) -DWIN32
+
+#More verbose warning output options below
+#cflags3 = $(cflags3:-W4=-wd4131
+#cflags3 = $(cflags3:-W4=-Wall)
+#cflags3 = $(cflags3:-W3=-wd4131
+#cflags3 = $(cflags3:-W3=-Wall)
+
+# declarations for use on Intel x86 systems
+!IF "$(TARGET_CPU)" == "x86"
+DLLENTRY = @12
+EXEVER=5.01
+MACHINE=/MACHINE:X86
+!ENDIF
+
+# declarations for use on AMD64 systems
+!IF "$(TARGET_CPU)" == "x64"
+DLLENTRY =
+EXEVER=5.02
+MACHINE=/MACHINE:X64
+!ENDIF
+
+# for Windows applications
+conlflags = $(lflags) -subsystem:console,$(EXEVER)
+guilflags = $(lflags) -subsystem:windows,$(EXEVER)
+dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
+
+# basic subsystem specific libraries, less the C Run-Time
+baselibs    = kernel32.lib $(optlibs) $(winsocklibs) advapi32.lib gdi32.lib \
+		ole32.lib Shell32.lib
+winlibs     = $(baselibs) user32.lib comdlg32.lib winspool.lib
+
+# for Windows applications that use the C Run-Time libraries
+conlibs     = $(baselibs)
+guilibs     = $(winlibs)
+#
+
+INCLDIR= /I..\include /I..\sys\winnt
+
+CFLAGS = $(cflags3) $(INCLDIR) $(DLBFLG)
+CPPFLAGS = $(cppflags) $(INCLDIR) $(DLBFLG)
+LFLAGS = $(lflags) $(conlibs) $(MACHINE)
+CFLAGSU = $(CFLAGS)
+
+
+#==========================================
+#================ RULES ==================
+#==========================================
+
+.SUFFIXES: .exe .o .til .uu .c .y .l
+
+#==========================================
+# Rules for files in src
+#==========================================
+
+.c{$(OBJTTY)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ $<
+
+.c{$(OBJGUI)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ $<
+
+{$(SRC)}.c{$(OBJTTY)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@  $<
+
+{$(SRC)}.c{$(OBJGUI)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@  $<
+
+#==========================================
+# Rules for files in sys\share
+#==========================================
+
+{$(SSYS)}.c{$(OBJTTY)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY)  -Fo$@  $<
+
+{$(SSYS)}.c{$(OBJGUI)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@  $<
+
+#==========================================
+# Rules for files in sys\winnt
+#==========================================
+
+{$(NTSYS)}.c{$(OBJTTY)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY)  -Fo$@  $<
+
+{$(NTSYS)}.c{$(OBJGUI)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@  $<
+
+#==========================================
+# Rules for files in util
+#==========================================
+
+{$(UTIL)}.c{$(OBJ)}.o:
+	$(Q)$(CC) $(CFLAGSU) $(WINPFLAGSTTY) -Fo$@ $<
+
+#==========================================
+# Rules for files in win\share
+#==========================================
+
+{$(WSHR)}.c{$(OBJTTY)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY)  -Fo$@ $<
+
+{$(WSHR)}.c{$(OBJGUI)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@  $<
+
+#{$(WSHR)}.txt{$(DAT)}.txt:
+#	copy $< $@
+
+#==========================================
+# Rules for files in win\tty
+#==========================================
+
+{$(TTY)}.c{$(OBJTTY)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY)  -Fo$@  $<
+
+
+#==========================================
+# Rules for files in win\win32
+#==========================================
+
+{$(WIN32)}.c{$(OBJGUI)}.o:
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@  $<
 
 #==========================================
 #=============== TARGETS ==================
@@ -449,14 +566,17 @@
 #
 #  The default make target (so just typing 'nmake' is useful).
 #
-default : $(GAMEFILE)
+default : $(GAMEFILE1) $(GAMEFILE2)
 
 #
 #  The main target.
 #
 
-$(GAME): $(O)obj.tag $(O)utility.tag envchk $(GAMEFILE)
-	@echo $(GAME) is up to date.
+$(GAMEFILE1): $(OTTY)objtty.tag $(U)utility.tag envchk $(GAMETTY)
+	echo $(GAMETTY) is up to date.
+
+$(GAMEFILE2): $(OGUI)objgui.tag $(U)utility.tag envchk $(GAMEGUI)
+	echo $(GAMEGUI) is up to date.
 
 #
 #  Everything
@@ -464,11 +584,11 @@
 
 all :	install
 
-install: envchk $(GAME) $(O)install.tag
+install: envchk $(GAMETTY) $(GAMEGUI) $(OTTY)install.tag
 	 @echo Done.
 
-$(O)install.tag: 	$(DAT)\data	$(DAT)\rumors	 $(DAT)\dungeon \
-	 	$(DAT)\oracles	$(DAT)\quest.dat $(O)sp_lev.tag $(DLB)
+$(OTTY)install.tag: 	$(DAT)\data	$(DAT)\rumors	 $(DAT)\dungeon \
+	 	$(DAT)\oracles	$(DAT)\quest.dat $(OTTY)sp_lev.tag $(DLB)
 ! IF ("$(USE_DLB)"=="Y")
 	copy nhdat                $(GAMEDIR)
 	copy $(DAT)\license       $(GAMEDIR)
@@ -481,8 +601,10 @@
 ! ENDIF
 	if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt
 	if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt
-	@if exist $(SRC)\$(GAME).PDB copy $(SRC)\$(GAME).pdb $(GAMEDIR)\$(GAME).pdb
-	@if exist $(GAMEDIR)\$(GAME).PDB echo NOTE: You may want to remove $(GAMEDIR)\$(GAME).pdb to conserve space
+	@if exist $(SRC)\$(GAMETTY).PDB copy $(SRC)\$(GAMETTY).pdb $(GAMEDIR)\$(GAMETTY).pdb
+	@if exist $(GAMEDIR)\$(GAMETTY).PDB echo NOTE: You may want to remove $(GAMEDIR)\$(GAMETTY).pdb to conserve space
+	@if exist $(SRC)\$(GAMEGUI).PDB copy $(SRC)\$(GAMEGUI).pdb $(GAMEDIR)\$(GAMEGUI).pdb
+	@if exist $(GAMEDIR)\$(GAMEGUI).PDB echo NOTE: You may want to remove $(GAMEDIR)\$(GAMEGUI).pdb to conserve space
 	-copy $(NTSYS)\defaults.nh   $(GAMEDIR)\defaults.nh
 	echo install done > $@
 
@@ -492,7 +614,7 @@
 	if exist $(U)recover.exe copy $(U)recover.exe  $(GAMEDIR)
 	if exist $(DOC)\recover.txt copy $(DOC)\recover.txt $(GAMEDIR)\recover.txt
 
-$(O)sp_lev.tag: $(O)utility.tag $(DAT)\bigroom.des  $(DAT)\castle.des \
+$(OTTY)sp_lev.tag: $(U)utility.tag $(DAT)\bigroom.des  $(DAT)\castle.des \
 	$(DAT)\endgame.des $(DAT)\gehennom.des $(DAT)\knox.des   \
 	$(DAT)\medusa.des  $(DAT)\oracle.des   $(DAT)\tower.des  \
 	$(DAT)\yendor.des  $(DAT)\arch.des     $(DAT)\barb.des   \
@@ -526,28 +648,26 @@
 	$(U)lev_comp valkyrie.des
 	$(U)lev_comp wizard.des
 	cd $(SRC)
-	echo sp_levs done > $(O)sp_lev.tag
+	echo sp_levs done > $(OTTY)sp_lev.tag
 
-$(O)utility.tag: $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \
+$(U)utility.tag: $(INCL)\date.h $(INCL)\onames.h $(INCL)\pm.h \
 		$(SRC)\monstr.c		$(SRC)\vis_tab.c  \
 		$(U)lev_comp.exe	$(INCL)\vis_tab.h \
 		$(U)dgn_comp.exe
-             @echo utilities made >$@
+	     @echo utilities made >$@
 	     @echo utilities made.
 
 tileutil: $(U)gif2txt.exe $(U)gif2tx32.exe $(U)txt2ppm.exe
-	@echo Optional tile development utilities are up to date.
+	echo Optional tile development utilities are up to date.
+
+$(NHRESTTY): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico
+	$(rc) -r -fo$@ -i$(NTSYS) -dNDEBUG $(NTSYS)\console.rc
 
-!IF "$(GRAPHICAL)"=="Y"
-$(NHRES): $(TILEBMP16) $(WIN32)\winhack.rc $(WIN32)\mnsel.bmp \
+$(NHRESGUI): $(TILEBMP16) $(WIN32)\winhack.rc $(WIN32)\mnsel.bmp \
 	$(WIN32)\mnselcnt.bmp $(WIN32)\mnunsel.bmp \
 	$(WIN32)\petmark.bmp $(WIN32)\NetHack.ico $(WIN32)\rip.bmp \
 	$(WIN32)\splash.bmp
-	@$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc
-!ELSE
-$(NHRES): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico
-	@$(rc) -r -fo$@ -i$(NTSYS) -dNDEBUG $(NTSYS)\console.rc
-!ENDIF
+	$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc
 
 #==========================================
 #  The main target.
@@ -578,22 +698,36 @@
 #  DO NOT INDENT THE << below!
 #
 
-$(GAMEFILE) : $(ALLOBJ) $(NHRES) $(O)gamedir.tag $(WINDLLS)
+$(GAMETTY) : $(TTYALLOBJ) $(NHRESTTY) gamedir.tag $(WINDLLSTTY)
 	@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
-	@echo Linking....
-	$(link) $(LFLAGS) user32.lib winmm.lib -out:$@ @<<$(GAME).lnk
-		$(ALLOBJ:^	=^
-		) $(NHRES)
+	echo Linking....
+	$(link) $(LFLAGS) /DEBUG /PDB:"$(@B).PDB" /MAP:"$(@B).map" \
+		user32.lib winmm.lib -subsystem:console \
+		-out:$(GAMEDIR)\$@.exe \
+		@<<$(GAMETTY).lnk
+		$(TTYALLOBJ:^	=^
+		) $(NHRESTTY)
 <<
-	@if exist $(O)install.tag del $(O)install.tag
-	@if exist $(GAMEDIR)\$(GAME).bak del $(GAMEDIR)\$(GAME).bak
+	@if exist $(OTTY)installtty.tag del $(OTTY)installtty.tag
 
-$(O)gamedir.tag:
-	@if not exist $(GAMEDIR)\*.* echo creating directory $(GAMEDIR)
+$(GAMEGUI) : $(GUIALLOBJ) $(NHRESGUI) gamedir.tag
 	@if not exist $(GAMEDIR)\*.* mkdir $(GAMEDIR)
-	@echo directory created > $@
+	echo Linking....
+	$(link) $(LFLAGS) /DEBUG /PDB:"$(@B).PDB" /MAP:"$(@B).map" \
+		user32.lib winmm.lib Comctl32.lib -subsystem:windows \
+		-out:$(GAMEDIR)\$@.exe \
+		@<<$(GAMEGUI).lnk
+		$(GUIALLOBJ:^	=^
+		) $(NHRESGUI)
+<<
+	@if exist $(OGUI)installgui.tag del $(OGUI)installgui.tag
+
+gamedir.tag:
+	@if not exist $(GAMEDIR)\*.* echo creating directory $@
+	@if not exist $(GAMEDIR)\*.* mkdir $@
+	echo directory created > $@
 
-$(O)nhdefkey.def:
+$(OTTY)nhdefkey.def:
 	@echo EXPORTS >$@
 	@echo    ProcessKeystroke >>$@
 	@echo    NHkbhit >>$@
@@ -602,13 +736,13 @@
 	@echo    SourceAuthor >>$@
 	@echo    KeyHandlerName >>$@
 
-$(GAMEDIR)\nhdefkey.dll : $(O)$(@B).o $(O)gamedir.tag $(O)$(@B).def
-	@echo Linking $@
-	@$(link) -debug:full -debugtype:cv /RELEASE /NOLOGO /DLL user32.lib \
-		/PDB:"$(@B).PDB" /MAP:"$(@B).map" /DEF:$(O)$(@B).def \
-		/IMPLIB:$(O)$(@B).lib -out:$@ $(O)$(@B).o
+$(GAMEDIR)\nhdefkey.dll : $(OTTY)$(@B).o gamedir.tag $(OTTY)$(@B).def
+	echo Linking $@
+	$(link) -debug:full -debugtype:cv /RELEASE /NOLOGO /DLL user32.lib \
+		/PDB:"$(@B).PDB" /MAP:"$(@B).map" /DEF:$(OTTY)$(@B).def \
+		/IMPLIB:$(OTTY)$(@B).lib -out:$@ $(OTTY)$(@B).o
 
-$(O)nh340key.def:
+$(OTTY)nh340key.def:
 	@echo EXPORTS >$@
 	@echo    ProcessKeystroke >>$@
 	@echo    NHkbhit >>$@
@@ -617,13 +751,13 @@
 	@echo    SourceAuthor >>$@
 	@echo    KeyHandlerName >>$@
 
-$(GAMEDIR)\nh340key.dll : $(O)$(@B).o $(O)gamedir.tag $(O)$(@B).def
-	@echo Linking $@
-	@$(link) -debug:full -debugtype:cv /RELEASE /NOLOGO /DLL user32.lib \
-		/PDB:"$(@B).PDB" /MAP:"$(@B).map" /DEF:$(O)$(@B).def \
-		/IMPLIB:$(O)$(@B).lib -out:$@ $(O)$(@B).o
+$(GAMEDIR)\nh340key.dll : $(OTTY)$(@B).o gamedir.tag $(OTTY)$(@B).def
+	echo Linking $@
+	$(link) -debug:full -debugtype:cv /RELEASE /NOLOGO /DLL user32.lib \
+		/PDB:"$(@B).PDB" /MAP:"$(@B).map" /DEF:$(OTTY)$(@B).def \
+		/IMPLIB:$(OTTY)$(@B).lib -out:$@ $(OTTY)$(@B).o
 
-$(O)nhraykey.def:
+$(OTTY)nhraykey.def:
 	@echo EXPORTS >$@
 	@echo    ProcessKeystroke >>$@
 	@echo    NHkbhit >>$@
@@ -632,11 +766,11 @@
 	@echo    SourceAuthor >>$@
 	@echo    KeyHandlerName >>$@
 
-$(GAMEDIR)\nhraykey.dll : $(O)$(@B).o $(O)gamedir.tag $(O)$(@B).def
-	@echo Linking $@
-	@$(link) -debug:full -debugtype:cv /RELEASE /NOLOGO /DLL user32.lib \
-		/PDB:"$(@B).PDB" /MAP:"$(@B).map" /DEF:$(O)$(@B).def \
-		/IMPLIB:$(O)$(@B).lib -out:$@ $(O)$(@B).o
+$(GAMEDIR)\nhraykey.dll : $(OTTY)$(@B).o gamedir.tag $(OTTY)$(@B).def
+	echo Linking $@
+	$(link) -debug:full -debugtype:cv /RELEASE /NOLOGO /DLL user32.lib \
+		/PDB:"$(@B).PDB" /MAP:"$(@B).map" /DEF:$(OTTY)$(@B).def \
+		/IMPLIB:$(OTTY)$(@B).lib -out:$@ $(OTTY)$(@B).o
 
 #
 #  Secondary Targets.
@@ -646,22 +780,26 @@
 # Makedefs Stuff
 #==========================================
 
-$(U)makedefs.exe:	$(MAKEOBJS)
-	@$(link) $(LFLAGSU) -out:$@ $(MAKEOBJS)
+$(U)makedefs.exe: dirprep.flg $(MAKEDEFSOBJS)
+	$(link) $(LFLAGSU) -out:$@ $(MAKEDEFSOBJS)
 
-$(O)makedefs.o: $(CONFIG_H)	$(INCL)\monattk.h $(INCL)\monflag.h   $(INCL)\objclass.h \
+$(OTTY)makedefs.o: $(CONFIG_H)	$(INCL)\monattk.h $(INCL)\monflag.h   $(INCL)\objclass.h \
 		 $(INCL)\monsym.h    $(INCL)\qtext.h	$(INCL)\patchlevel.h \
 		 $(U)makedefs.c
-	@if not exist $(OBJ)\*.* echo creating directory $(OBJ)
-	@if not exist $(OBJ)\*.* mkdir $(OBJ)
-	@$(CC) $(CFLAGSU) /I..\sys\winnt -Fo$@ $(U)makedefs.c
+	$(Q)$(CC) $(CFLAGSU) /I..\sys\winnt -Fo$@ $(U)makedefs.c
 
+dirprep.flg:
+	@if not exist $(OBJTTY)\*.* echo creating directory $(OBJTTY)
+	@if not exist $(OBJGUI)\*.* echo creating directory $(OBJGUI)
+	@if not exist $(OBJTTY)\*.* mkdir $(OBJTTY)
+	@if not exist $(OBJGUI)\*.* mkdir $(OBJGUI)
+        echo.>$@
 #
 #  date.h should be remade every time any of the source or include
 #  files is modified.
 #
 
-$(INCL)\date.h $(OPTIONS_FILE) : $(U)makedefs.exe
+$(INCL)\date.h $(DAT)\guioptions $(DAT)\ttyoptions : $(U)makedefs.exe
 	$(U)makedefs -v
 
 $(INCL)\onames.h : $(U)makedefs.exe
@@ -686,10 +824,10 @@
 # uudecode utility and uuencoded targets
 #==========================================
 
-$(U)uudecode.exe: $(O)uudecode.o
-	@$(link) $(LFLAGSU) -out:$@ $(O)uudecode.o
+$(U)uudecode.exe: $(OTTY)uudecode.o
+	$(link) $(LFLAGSU) -out:$@ $(OTTY)uudecode.o
 
-$(O)uudecode.o: $(SSYS)\uudecode.c
+$(OTTY)uudecode.o: $(SSYS)\uudecode.c
 
 $(NTSYS)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu 
 	chdir $(NTSYS)
@@ -736,24 +874,24 @@
 #==========================================
 
 LEVCFLAGS=-c -nologo -DWINVER=0x0400 -DWIN32 -D_WIN32 \
-	   -D_MT -MT -I..\include -nologo -Z7 -Od -DDLB
+	   -D_MT -MT -I..\include -I..\sys\winnt -nologo -Z7 -Od -DDLB
 
 $(U)lev_comp.exe: $(SPLEVOBJS)
-	@echo Linking $@...
-	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
+	echo Linking $@...
+	$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
  		$(SPLEVOBJS:^	=^
 		)
 <<
 
-$(O)lev_yacc.o: $(HACK_H)   $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c
-	@$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_yacc.c
+$(OTTY)lev_yacc.o: $(HACK_H)   $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c
+	$(Q)$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_yacc.c
 
-$(O)lev_$(LEX).o: $(HACK_H)   $(INCL)\lev_comp.h $(SP_LEV_H) \
-               $(U)lev_$(LEX).c
-	@$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_$(LEX).c
+$(OTTY)lev_$(LEX).o: $(HACK_H)   $(INCL)\lev_comp.h $(SP_LEV_H) \
+	       $(U)lev_$(LEX).c
+	$(Q)$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_$(LEX).c
 
-$(O)lev_main.o:	$(U)lev_main.c $(HACK_H)   $(SP_LEV_H)
-	@$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_main.c
+$(OTTY)lev_main.o:	$(U)lev_main.c $(HACK_H)   $(SP_LEV_H)
+	$(Q)$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_main.c
 
 
 $(U)lev_yacc.c $(INCL)\lev_comp.h : $(U)lev_comp.y
@@ -799,20 +937,20 @@
 
 $(U)dgn_comp.exe: $(DGNCOMPOBJS)
     @echo Linking $@...
-	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
+	$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
 		$(DGNCOMPOBJS:^	=^
 		)
 <<
 
-$(O)dgn_yacc.o:	$(HACK_H)   $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c
-	@$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_yacc.c
+$(OTTY)dgn_yacc.o:	$(HACK_H)   $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c
+	$(Q)$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_yacc.c
 
-$(O)dgn_$(LEX).o: $(HACK_H)   $(DGN_FILE_H)  $(INCL)\dgn_comp.h \
+$(OTTY)dgn_$(LEX).o: $(HACK_H)   $(DGN_FILE_H)  $(INCL)\dgn_comp.h \
 	$(U)dgn_$(LEX).c
-	@$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_$(LEX).c
+	$(Q)$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_$(LEX).c
 
-$(O)dgn_main.o:	$(HACK_H) $(U)dgn_main.c
-	@$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_main.c
+$(OTTY)dgn_main.o:	$(HACK_H) $(U)dgn_main.c
+	$(Q)$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_main.c
 
 $(U)dgn_yacc.c $(INCL)\dgn_comp.h : $(U)dgn_comp.y
 !	IF "$(DO_YACC)"=="YACC_ACT"
@@ -855,10 +993,15 @@
 # Create directory for holding object files
 #==========================================
 
-$(O)obj.tag:
-	@if not exist $(OBJ)\*.* echo creating directory $(OBJ)
-	@if not exist $(OBJ)\*.* mkdir $(OBJ)
-	@echo directory created >$@
+$(OTTY)objtty.tag:
+	@if not exist $(OTTY)*.* echo creating directory $(OBJTTY)
+	@if not exist $(OTTY)*.* mkdir $(OBJTTY)
+	echo directory created >$@
+
+$(OGUI)objgui.tag:
+	@if not exist $(OGUI)*.* echo creating directory $(OBJGUI)
+	@if not exist $(OGUI)*.* mkdir $(OBJGUI)
+	echo directory created >$@
 
 #==========================================
 # Notify of any CL environment variables
@@ -893,27 +1036,27 @@
 # DLB utility and nhdat file creation
 #==========================================
 
-$(U)dlb_main.exe: $(DLBOBJ) $(O)dlb.o
-	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
-		$(O)dlb_main.o
-		$(O)dlb.o
-		$(O)alloc.o
-		$(O)panic.o
+$(U)dlb_main.exe: $(DLBOBJ) $(OTTY)dlb.o
+	$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
+		$(OTTY)dlb_main.o
+		$(OTTY)dlb.o
+		$(OTTY)alloc.o
+		$(OTTY)panic.o
 <<
 
-$(O)dlb.o:	$(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)\dlb.h
-	@$(CC) $(CFLAGS) /Fo$@ $(SRC)\dlb.c
+$(OTTY)dlb.o:	$(OTTY)dlb_main.o $(OTTY)alloc.o $(OTTY)panic.o $(INCL)\dlb.h
+	$(Q)$(CC) $(CFLAGS) /Fo$@ $(SRC)\dlb.c
 	
-$(O)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h
-	@$(CC) $(CFLAGS) /Fo$@ $(UTIL)\dlb_main.c
+$(OTTY)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h
+	$(Q)$(CC) $(CFLAGS) /Fo$@ $(UTIL)\dlb_main.c
 
 $(DAT)\porthelp: $(NTSYS)\porthelp
-	@copy $(NTSYS)\porthelp $@ >nul
+	$(QC)copy $(NTSYS)\porthelp $@ >nul
 
-nhdat:	$(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \
+nhdat:	$(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(DAT)\guioptions $(DAT)\ttyoptions \
 	$(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp \
 	$(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\dungeon $(DAT)\porthelp \
-	$(DAT)\license $(O)sp_lev.tag
+	$(DAT)\license $(OTTY)sp_lev.tag
 	cd $(DAT)
 	echo data >dlb.lst
 	echo oracles >>dlb.lst
@@ -942,8 +1085,8 @@
 $(U)recover.exe: $(RECOVOBJS)
 	$(link) $(LFLAGSU) -out:$@ $(RECOVOBJS)
 
-$(O)recover.o: $(CONFIG_H) $(U)recover.c $(INCL)\win32api.h
-	$(CC) $(CFLAGSU) -Fo$@ $(U)recover.c
+$(OTTY)recover.o: $(CONFIG_H) $(U)recover.c $(INCL)\win32api.h
+	$(Q)$(CC) $(CFLAGSU) -Fo$@ $(U)recover.c
 
 #==========================================
 #  Tile Mapping
@@ -951,34 +1094,34 @@
 
 $(SRC)\tile.c: $(U)tilemap.exe
 	@echo A new $@ has been created
-	@$(U)tilemap
+	$(U)tilemap
 
-$(U)tilemap.exe: $(O)tilemap.o
-	@$(link) $(LFLAGSU) -out:$@ $(O)tilemap.o
+$(U)tilemap.exe: $(OTTY)tilemap.o
+	$(link) $(LFLAGSU) -out:$@ $(OTTY)tilemap.o
 
-$(O)tilemap.o: $(WSHR)\tilemap.c $(HACK_H)
-	@$(CC) $(CFLAGSU) -Fo$@ $(WSHR)\tilemap.c
+$(OTTY)tilemap.o: $(WSHR)\tilemap.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGSU) -Fo$@ $(WSHR)\tilemap.c
 
-$(O)tiletx32.o: $(WSHR)\tilemap.c $(HACK_H)
-	@$(CC) $(CFLAGS) /DTILETEXT /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tilemap.c
+$(OTTY)tiletx32.o: $(WSHR)\tilemap.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) /DTILETEXT /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tilemap.c
 
-$(O)tiletxt.o: $(WSHR)\tilemap.c $(HACK_H)
-	@$(CC) $(CFLAGS) /DTILETEXT -Fo$@ $(WSHR)\tilemap.c
+$(OTTY)tiletxt.o: $(WSHR)\tilemap.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) /DTILETEXT -Fo$@ $(WSHR)\tilemap.c
 
-$(O)gifread.o: $(WSHR)\gifread.c  $(CONFIG_H) $(TILE_H)
-	@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\gifread.c
+$(OTTY)gifread.o: $(WSHR)\gifread.c  $(CONFIG_H) $(TILE_H)
+	$(Q)$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\gifread.c
 
-$(O)gifrd32.o: $(WSHR)\gifread.c  $(CONFIG_H) $(TILE_H)
-	@$(CC) $(CFLAGS) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\gifread.c
+$(OTTY)gifrd32.o: $(WSHR)\gifread.c  $(CONFIG_H) $(TILE_H)
+	$(Q)$(CC) $(CFLAGS) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\gifread.c
 
-$(O)ppmwrite.o: $(WSHR)\ppmwrite.c $(CONFIG_H) $(TILE_H)
-	@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\ppmwrite.c
+$(OTTY)ppmwrite.o: $(WSHR)\ppmwrite.c $(CONFIG_H) $(TILE_H)
+	$(Q)$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\ppmwrite.c
 
-$(O)tiletext.o: $(WSHR)\tiletext.c  $(CONFIG_H) $(TILE_H)
-	@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\tiletext.c
+$(OTTY)tiletext.o: $(WSHR)\tiletext.c  $(CONFIG_H) $(TILE_H)
+	$(Q)$(CC) $(CFLAGS) -I$(WSHR) -Fo$@ $(WSHR)\tiletext.c
 
-$(O)tilete32.o: $(WSHR)\tiletext.c  $(CONFIG_H) $(TILE_H)
-	@$(CC) $(CFLAGS) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tiletext.c
+$(OTTY)tilete32.o: $(WSHR)\tiletext.c  $(CONFIG_H) $(TILE_H)
+	$(Q)$(CC) $(CFLAGS) -I$(WSHR) /DTILE_X=32 /DTILE_Y=32 -Fo$@ $(WSHR)\tiletext.c
 
 #==========================================
 # Optional Tile Utilities
@@ -986,7 +1129,7 @@
 
 $(U)gif2txt.exe: $(GIFREADERS) $(TEXT_IO)
     @echo Linking $@...
-	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
+	$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
 		$(GIFREADERS:^	=^
 		)
 		$(TEXT_IO:^	=^
@@ -995,7 +1138,7 @@
 
 $(U)gif2tx32.exe: $(GIFREADERS32) $(TEXT_IO32)
     @echo Linking $@...
-	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
+	$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
 		$(GIFREADERS32:^	=^
 		)
 		$(TEXT_IO32:^	=^
@@ -1004,47 +1147,41 @@
 
 $(U)txt2ppm.exe: $(PPMWRITERS) $(TEXT_IO)
     @echo Linking $@...
-	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
+	$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
 		$(PPMWRITERS:^	=^
 		)
 		$(TEXT_IO:^	=^
 		)
 <<
 
-!IF "$(GRAPHICAL)"=="Y"
 $(TILEBMP16): $(TILEUTIL16) $(TILEFILES)
 	@echo Creating 16x16 binary tile files (this may take some time)
-	@$(U)tile2bmp $(TILEBMP16)
+	$(U)tile2bmp $(TILEBMP16)
 #$(TILEBMP32): $(TILEUTIL32) $(TILEFILES32)
 #	@echo Creating 32x32 binary tile files (this may take some time)
-#	@$(U)til2bm32 $(TILEBMP32)
+#	$(U)til2bm32 $(TILEBMP32)
 
-!ELSE
-$(TILEBMP16):
-$(TILEBMP32):
-!ENDIF
-
-$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXT_IO)
+$(U)tile2bmp.exe: $(OTTY)tile2bmp.o $(TEXT_IO)
     @echo Linking $@...
-	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
-		$(O)tile2bmp.o
+	$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
+		$(OTTY)tile2bmp.o
 		$(TEXT_IO:^  =^
 		)
 <<
 
-$(U)til2bm32.exe: $(O)til2bm32.o $(TEXT_IO32)
+$(U)til2bm32.exe: $(OTTY)til2bm32.o $(TEXT_IO32)
     @echo Linking $@...
-	@$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
-		$(O)til2bm32.o
+	$(link) $(LFLAGSU) -out:$@ @<<$(@B).lnk
+		$(OTTY)til2bm32.o
 		$(TEXT_IO32:^  =^
 		)
 <<
 
-$(O)tile2bmp.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
-	@$(CC) $(CFLAGS) -I$(WSHR) /DPACKED_FILE /Fo$@ $(WSHR)\tile2bmp.c
+$(OTTY)tile2bmp.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
+	$(Q)$(CC) $(CFLAGS) -I$(WSHR) /DPACKED_FILE /Fo$@ $(WSHR)\tile2bmp.c
 
-$(O)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
-	@$(CC) $(CFLAGS) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WSHR)\tile2bmp.c
+$(OTTY)til2bm32.o: $(WSHR)\tile2bmp.c $(HACK_H) $(TILE_H) $(INCL)\win32api.h
+	$(Q)$(CC) $(CFLAGS) -I$(WSHR) /DPACKED_FILE /DTILE_X=32 /DTILE_Y=32 /Fo$@ $(WSHR)\tile2bmp.c
 
 #==========================================
 # Housekeeping
@@ -1098,29 +1235,30 @@
 	if exist $(DAT)\valley.lev	del $(DAT)\valley.lev
 	if exist $(DAT)\water.lev	del $(DAT)\water.lev
 	if exist $(DAT)\wizard?.lev	del $(DAT)\wizard?.lev
-	if exist $(O)sp_lev.tag	        del $(O)sp_lev.tag
+	if exist $(OTTY)sp_lev.tag	del $(OTTY)sp_lev.tag
 	if exist $(SRC)\monstr.c        del $(SRC)\monstr.c
 	if exist $(SRC)\vis_tab.c       del $(SRC)\vis_tab.c
 	if exist $(U)recover.exe        del $(U)recover.exe
 	if exist nhdat.			del nhdat.
-	if exist $(O)obj.tag            del $(O)obj.tag
-	if exist $(O)gamedir.tag        del $(O)gamedir.tag
-	if exist $(O)nh*key.lib         del $(O)nh*key.lib
-	if exist $(O)nh*key.exp         del $(O)nh*key.exp
+	if exist $(OTTY)objtty.tag      del $(OTTY)objtty.tag
+	if exist $(OGUI)objgui.tag      del $(OGUI)objgui.tag
+	if exist gamedir.tag            del gamedir.tag
+	if exist $(OTTY)nh*key.lib      del $(OTTY)nh*key.lib
+	if exist $(OTTY)nh*key.exp      del $(OTTY)nh*key.exp
 
 clean:
-	if exist $(O)*.o del $(O)*.o
-	if exist $(O)utility.tag   del $(O)utility.tag
+	if exist $(OTTY)*.o del $(OTTY)*.o
+	if exist $(OGUI)*.o del $(OGUI)*.o
+	if exist $(U)utility.tag   del $(U)utility.tag
 	if exist $(U)makedefs.exe  del $(U)makedefs.exe
 	if exist $(U)lev_comp.exe  del $(U)lev_comp.exe
 	if exist $(U)dgn_comp.exe  del $(U)dgn_comp.exe
 	if exist $(SRC)\*.lnk      del $(SRC)\*.lnk
 	if exist $(SRC)\*.map      del $(SRC)\*.map
-	if exist $(O)install.tag   del $(O)install.tag
-! IF ("$(WINPFLAG)"!="")
+	if exist $(OTTY)installtty.tag   del $(OTTY)installtty.tag
+	if exist $(OGUI)installgui.tag   del $(OGUI)installgui.tag
 	if exist $(TILEBMP16)        del $(TILEBMP16)
 	if exist $(TILEBMP32)        del $(TILEBMP32)
-! ENDIF
 
 #===================================================================
 # OTHER DEPENDENCIES
@@ -1130,19 +1268,19 @@
 # dat dependencies
 #
 
-$(DAT)\data: $(O)utility.tag    $(DATABASE)
+$(DAT)\data: $(U)utility.tag    $(DATABASE)
 	$(U)makedefs -d
 
-$(DAT)\rumors: $(O)utility.tag    $(DAT)\rumors.tru   $(DAT)\rumors.fal
+$(DAT)\rumors: $(U)utility.tag    $(DAT)\rumors.tru   $(DAT)\rumors.fal
 	$(U)makedefs -r
 
-$(DAT)\quest.dat: $(O)utility.tag  $(DAT)\quest.txt
+$(DAT)\quest.dat: $(U)utility.tag  $(DAT)\quest.txt
 	$(U)makedefs -q
 
-$(DAT)\oracles: $(O)utility.tag    $(DAT)\oracles.txt
+$(DAT)\oracles: $(U)utility.tag    $(DAT)\oracles.txt
 	$(U)makedefs -h
 
-$(DAT)\dungeon: $(O)utility.tag  $(DAT)\dungeon.def
+$(DAT)\dungeon: $(U)utility.tag  $(DAT)\dungeon.def
 	$(U)makedefs -e
 	cd $(DAT)
 	$(U)dgn_comp dungeon.pdf
@@ -1151,24 +1289,33 @@
 #
 # NT dependencies
 #
-
-$(O)nttty.o:   $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nttty.c
-	@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@  $(NTSYS)\nttty.c
-$(O)nhkeys.o:   $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nhkeys.c
-	@$(CC) $(CFLAGS) -I$(WSHR) -Fo$@  $(NTSYS)\nhkeys.c
-$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(NTSYS)\winnt.c
-	@$(CC) $(CFLAGS) -Fo$@  $(NTSYS)\winnt.c
-$(O)ntsound.o: $(HACK_H) $(NTSYS)\ntsound.c
-	@$(CC) $(CFLAGS)  -Fo$@ $(NTSYS)\ntsound.c
-$(O)mapimail.o: $(HACK_H) $(INCL)\nhlan.h $(NTSYS)\mapimail.c
-	@$(CC) $(CFLAGS) -DMAPI_VERBOSE  -Fo$@ $(NTSYS)\mapimail.c
+# - tty
+#
+$(OTTY)nttty.o:   $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nttty.c
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -I$(WSHR) -Fo$@  $(NTSYS)\nttty.c
+$(OTTY)nhkeys.o:   $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nhkeys.c
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -I$(WSHR) -Fo$@  $(NTSYS)\nhkeys.c
+$(OTTY)ntsound.o: $(HACK_H) $(NTSYS)\ntsound.c
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ $(NTSYS)\ntsound.c
+$(OTTY)mapimail.o: $(HACK_H) $(INCL)\nhlan.h $(NTSYS)\mapimail.c
+	$(Q)$(CC) $(CFLAGS) -DMAPI_VERBOSE  -Fo$@ $(NTSYS)\mapimail.c
+
+#
+# - gui
+#
+$(OGUI)winnt.o: $(HACK_H) $(INCL)\win32api.h $(NTSYS)\winnt.c
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@  $(NTSYS)\$(@B).c
+$(OGUI)ntsound.o: $(HACK_H) $(NTSYS)\ntsound.c
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@  $(NTSYS)\$(@B).c
+$(OGUI)mapimail.o: $(HACK_H) $(INCL)\nhlan.h $(NTSYS)\mapimail.c
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@  $(NTSYS)\$(@B).c
 
 # 
 # util dependencies
 #
 
-$(O)panic.o:  $(U)panic.c $(CONFIG_H)
-	@$(CC) $(CFLAGS) -Fo$@ $(U)panic.c
+$(OTTY)panic.o:  $(U)panic.c $(CONFIG_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ $(U)panic.c
 
 #
 # The rest are stolen from sys/unix/Makefile.src, 
@@ -1176,247 +1323,492 @@
 #   * ../include changed to $(INCL)
 #   * slashes changed to back-slashes 
 #   * -c (which is included in CFLAGS) substituted with -Fo$@
-#   * targets prefixed with $(O)
+#   * targets prefixed with $(OTTY)
 # but otherwise untouched.
 # That means that there is some irrelevant stuff
 # in here, but maintenance should be easier.
 #
-$(O)tos.o: ..\sys\atari\tos.c $(HACK_H) $(INCL)\tcap.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\atari\tos.c
-$(O)pcmain.o: ..\sys\share\pcmain.c $(HACK_H) $(INCL)\dlb.h \
+#
+# - tty .o files
+#
+$(OTTY)tos.o: ..\sys\atari\tos.c $(HACK_H) $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\atari\tos.c
+$(OTTY)pcmain.o: ..\sys\share\pcmain.c $(HACK_H) $(INCL)\dlb.h \
 		$(INCL)\win32api.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\share\pcmain.c
-$(O)pcsys.o: ..\sys\share\pcsys.c $(HACK_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\share\pcsys.c
-$(O)pctty.o: ..\sys\share\pctty.c $(HACK_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\share\pctty.c
-$(O)pcunix.o: ..\sys\share\pcunix.c $(HACK_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\share\pcunix.c
-$(O)random.o: ..\sys\share\random.c $(HACK_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\share\random.c
-$(O)ioctl.o: ..\sys\share\ioctl.c $(HACK_H) $(INCL)\tcap.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\share\ioctl.c
-$(O)unixtty.o: ..\sys\share\unixtty.c $(HACK_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\share\unixtty.c
-$(O)unixmain.o: ..\sys\unix\unixmain.c $(HACK_H) $(INCL)\dlb.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\unix\unixmain.c
-$(O)unixunix.o: ..\sys\unix\unixunix.c $(HACK_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\unix\unixunix.c
-$(O)unixres.o: ..\sys\unix\unixres.c $(CONFIG_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\unix\unixres.c
-$(O)bemain.o: ..\sys\be\bemain.c $(HACK_H) $(INCL)\dlb.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\sys\be\bemain.c
-$(O)getline.o: ..\win\tty\getline.c $(HACK_H) $(INCL)\func_tab.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\tty\getline.c
-$(O)termcap.o: ..\win\tty\termcap.c $(HACK_H) $(INCL)\tcap.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\tty\termcap.c
-$(O)topl.o: ..\win\tty\topl.c $(HACK_H) $(INCL)\tcap.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\tty\topl.c
-$(O)wintty.o: ..\win\tty\wintty.c $(HACK_H) $(INCL)\dlb.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\share\pcmain.c
+$(OTTY)pcsys.o: ..\sys\share\pcsys.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\share\pcsys.c
+$(OTTY)pctty.o: ..\sys\share\pctty.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\share\pctty.c
+$(OTTY)pcunix.o: ..\sys\share\pcunix.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\share\pcunix.c
+$(OTTY)random.o: ..\sys\share\random.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\share\random.c
+$(OTTY)ioctl.o: ..\sys\share\ioctl.c $(HACK_H) $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\share\ioctl.c
+$(OTTY)unixtty.o: ..\sys\share\unixtty.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\share\unixtty.c
+$(OTTY)unixmain.o: ..\sys\unix\unixmain.c $(HACK_H) $(INCL)\dlb.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\unix\unixmain.c
+$(OTTY)unixunix.o: ..\sys\unix\unixunix.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\unix\unixunix.c
+$(OTTY)unixres.o: ..\sys\unix\unixres.c $(CONFIG_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\unix\unixres.c
+$(OTTY)bemain.o: ..\sys\be\bemain.c $(HACK_H) $(INCL)\dlb.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\sys\be\bemain.c
+$(OTTY)getline.o: ..\win\tty\getline.c $(HACK_H) $(INCL)\func_tab.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\tty\getline.c
+$(OTTY)termcap.o: ..\win\tty\termcap.c $(HACK_H) $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\tty\termcap.c
+$(OTTY)topl.o: ..\win\tty\topl.c $(HACK_H) $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\tty\topl.c
+$(OTTY)wintty.o: ..\win\tty\wintty.c $(HACK_H) $(INCL)\dlb.h \
 		$(INCL)\patchlevel.h $(INCL)\tcap.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\tty\wintty.c
-$(O)Window.o: ..\win\X11\Window.c $(INCL)\xwindowp.h $(INCL)\xwindow.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\tty\wintty.c
+$(OTTY)Window.o: ..\win\X11\Window.c $(INCL)\xwindowp.h $(INCL)\xwindow.h \
 		$(CONFIG_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\Window.c
-$(O)dialogs.o: ..\win\X11\dialogs.c $(CONFIG_H)
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\dialogs.c
-$(O)winX.o: ..\win\X11\winX.c $(HACK_H) $(INCL)\winX.h $(INCL)\dlb.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\Window.c
+$(OTTY)dialogs.o: ..\win\X11\dialogs.c $(CONFIG_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\dialogs.c
+$(OTTY)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
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\winX.c
-$(O)winmap.o: ..\win\X11\winmap.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\dlb.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\winX.c
+$(OTTY)winmap.o: ..\win\X11\winmap.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\dlb.h \
 		$(INCL)\winX.h $(INCL)\tile2x11.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\winmap.c
-$(O)winmenu.o: ..\win\X11\winmenu.c $(HACK_H) $(INCL)\winX.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\winmenu.c
-$(O)winmesg.o: ..\win\X11\winmesg.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\winX.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\winmesg.c
-$(O)winmisc.o: ..\win\X11\winmisc.c $(HACK_H) $(INCL)\func_tab.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\winmap.c
+$(OTTY)winmenu.o: ..\win\X11\winmenu.c $(HACK_H) $(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\winmenu.c
+$(OTTY)winmesg.o: ..\win\X11\winmesg.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\winmesg.c
+$(OTTY)winmisc.o: ..\win\X11\winmisc.c $(HACK_H) $(INCL)\func_tab.h \
 		$(INCL)\winX.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\winmisc.c
-$(O)winstat.o: ..\win\X11\winstat.c $(HACK_H) $(INCL)\winX.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\winstat.c
-$(O)wintext.o: ..\win\X11\wintext.c $(HACK_H) $(INCL)\winX.h $(INCL)\xwindow.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\wintext.c
-$(O)winval.o: ..\win\X11\winval.c $(HACK_H) $(INCL)\winX.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\X11\winval.c
-$(O)tile.o: $(SRC)\tile.c $(HACK_H)
-$(O)gnaskstr.o: ..\win\gnome\gnaskstr.c ..\win\gnome\gnaskstr.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\winmisc.c
+$(OTTY)winstat.o: ..\win\X11\winstat.c $(HACK_H) $(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\winstat.c
+$(OTTY)wintext.o: ..\win\X11\wintext.c $(HACK_H) $(INCL)\winX.h $(INCL)\xwindow.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\wintext.c
+$(OTTY)winval.o: ..\win\X11\winval.c $(HACK_H) $(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\X11\winval.c
+$(OTTY)tile.o: $(SRC)\tile.c $(HACK_H)
+$(OTTY)gnaskstr.o: ..\win\gnome\gnaskstr.c ..\win\gnome\gnaskstr.h \
 		..\win\gnome\gnmain.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnaskstr.c
-$(O)gnbind.o: ..\win\gnome\gnbind.c ..\win\gnome\gnbind.h ..\win\gnome\gnmain.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnaskstr.c
+$(OTTY)gnbind.o: ..\win\gnome\gnbind.c ..\win\gnome\gnbind.h ..\win\gnome\gnmain.h \
 		..\win\gnome\gnaskstr.h ..\win\gnome\gnyesno.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnbind.c
-$(O)gnglyph.o: ..\win\gnome\gnglyph.c ..\win\gnome\gnglyph.h $(INCL)\tile2x11.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnglyph.c
-$(O)gnmain.o: ..\win\gnome\gnmain.c ..\win\gnome\gnmain.h ..\win\gnome\gnsignal.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnbind.c
+$(OTTY)gnglyph.o: ..\win\gnome\gnglyph.c ..\win\gnome\gnglyph.h $(INCL)\tile2x11.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnglyph.c
+$(OTTY)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
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmain.c
-$(O)gnmap.o: ..\win\gnome\gnmap.c ..\win\gnome\gnmap.h ..\win\gnome\gnglyph.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmain.c
+$(OTTY)gnmap.o: ..\win\gnome\gnmap.c ..\win\gnome\gnmap.h ..\win\gnome\gnglyph.h \
 		..\win\gnome\gnsignal.h $(HACK_H)
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmap.c
-$(O)gnmenu.o: ..\win\gnome\gnmenu.c ..\win\gnome\gnmenu.h ..\win\gnome\gnmain.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmap.c
+$(OTTY)gnmenu.o: ..\win\gnome\gnmenu.c ..\win\gnome\gnmenu.h ..\win\gnome\gnmain.h \
 		..\win\gnome\gnbind.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmenu.c
-$(O)gnmesg.o: ..\win\gnome\gnmesg.c ..\win\gnome\gnmesg.h ..\win\gnome\gnsignal.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmesg.c
-$(O)gnopts.o: ..\win\gnome\gnopts.c ..\win\gnome\gnopts.h ..\win\gnome\gnglyph.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmenu.c
+$(OTTY)gnmesg.o: ..\win\gnome\gnmesg.c ..\win\gnome\gnmesg.h ..\win\gnome\gnsignal.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmesg.c
+$(OTTY)gnopts.o: ..\win\gnome\gnopts.c ..\win\gnome\gnopts.h ..\win\gnome\gnglyph.h \
 		..\win\gnome\gnmain.h ..\win\gnome\gnmap.h $(HACK_H)
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnopts.c
-$(O)gnplayer.o: ..\win\gnome\gnplayer.c ..\win\gnome\gnplayer.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnopts.c
+$(OTTY)gnplayer.o: ..\win\gnome\gnplayer.c ..\win\gnome\gnplayer.h \
 		..\win\gnome\gnmain.h $(HACK_H)
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnplayer.c
-$(O)gnsignal.o: ..\win\gnome\gnsignal.c ..\win\gnome\gnsignal.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnplayer.c
+$(OTTY)gnsignal.o: ..\win\gnome\gnsignal.c ..\win\gnome\gnsignal.h \
 		..\win\gnome\gnmain.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnsignal.c
-$(O)gnstatus.o: ..\win\gnome\gnstatus.c ..\win\gnome\gnstatus.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnsignal.c
+$(OTTY)gnstatus.o: ..\win\gnome\gnstatus.c ..\win\gnome\gnstatus.h \
 		..\win\gnome\gnsignal.h ..\win\gnome\gn_xpms.h \
 		..\win\gnome\gnomeprv.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnstatus.c
-$(O)gntext.o: ..\win\gnome\gntext.c ..\win\gnome\gntext.h ..\win\gnome\gnmain.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnstatus.c
+$(OTTY)gntext.o: ..\win\gnome\gntext.c ..\win\gnome\gntext.h ..\win\gnome\gnmain.h \
 		..\win\gnome\gn_rip.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gntext.c
-$(O)gnworn.o: ..\win\gnome\gnworn.c ..\win\gnome\gnworn.h ..\win\gnome\gnglyph.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gntext.c
+$(OTTY)gnworn.o: ..\win\gnome\gnworn.c ..\win\gnome\gnworn.h ..\win\gnome\gnglyph.h \
 		..\win\gnome\gnsignal.h ..\win\gnome\gnomeprv.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnworn.c
-$(O)gnyesno.o: ..\win\gnome\gnyesno.c ..\win\gnome\gnbind.h ..\win\gnome\gnyesno.h
-	@$(CC) $(CFLAGS) $(GNOMEINC) -Fo$@ ..\win\gnome\gnyesno.c
-$(O)wingem.o: ..\win\gem\wingem.c $(HACK_H) $(INCL)\func_tab.h $(INCL)\dlb.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnworn.c
+$(OTTY)gnyesno.o: ..\win\gnome\gnyesno.c ..\win\gnome\gnbind.h ..\win\gnome\gnyesno.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) $(GNOMEINC) -Fo$@ ..\win\gnome\gnyesno.c
+$(OTTY)wingem.o: ..\win\gem\wingem.c $(HACK_H) $(INCL)\func_tab.h $(INCL)\dlb.h \
 		$(INCL)\patchlevel.h $(INCL)\wingem.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\gem\wingem.c
-$(O)wingem1.o: ..\win\gem\wingem1.c $(INCL)\gem_rsc.h $(INCL)\load_img.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\gem\wingem.c
+$(OTTY)wingem1.o: ..\win\gem\wingem1.c $(INCL)\gem_rsc.h $(INCL)\load_img.h \
 		$(INCL)\gr_rect.h $(INCL)\wintype.h $(INCL)\wingem.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\gem\wingem1.c
-$(O)load_img.o: ..\win\gem\load_img.c $(INCL)\load_img.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\gem\load_img.c
-$(O)gr_rect.o: ..\win\gem\gr_rect.c $(INCL)\gr_rect.h
-	@$(CC) $(CFLAGS) -Fo$@ ..\win\gem\gr_rect.c
-$(O)tile.o: tile.c $(HACK_H)
-$(O)qt_win.o: ..\win\Qt\qt_win.cpp $(HACK_H) $(INCL)\func_tab.h \
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\gem\wingem1.c
+$(OTTY)load_img.o: ..\win\gem\load_img.c $(INCL)\load_img.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\gem\load_img.c
+$(OTTY)gr_rect.o: ..\win\gem\gr_rect.c $(INCL)\gr_rect.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSTTY) -Fo$@ ..\win\gem\gr_rect.c
+$(OTTY)tile.o: tile.c $(HACK_H)
+$(OTTY)qt_win.o: ..\win\Qt\qt_win.cpp $(HACK_H) $(INCL)\func_tab.h \
 		$(INCL)\dlb.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) -Fo$@ ..\win\Qt\qt_win.cpp
-$(O)qt_clust.o: ..\win\Qt\qt_clust.cpp $(INCL)\qt_clust.h
+$(OTTY)qt_clust.o: ..\win\Qt\qt_clust.cpp $(INCL)\qt_clust.h
 	$(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qt_clust.cpp
-$(O)qttableview.o: ..\win\Qt\qttableview.cpp $(INCL)\qttableview.h
+$(OTTY)qttableview.o: ..\win\Qt\qttableview.cpp $(INCL)\qttableview.h
 	$(CXX) $(CXXFLAGS) -Fo$@ ..\win\Qt\qttableview.cpp
-$(O)monstr.o: monstr.c $(CONFIG_H)
-$(O)vis_tab.o: vis_tab.c $(CONFIG_H) $(INCL)\vis_tab.h
-$(O)allmain.o: allmain.c $(HACK_H)
-$(O)alloc.o: alloc.c $(CONFIG_H)
-$(O)apply.o: apply.c $(HACK_H) $(INCL)\edog.h
-$(O)artifact.o: artifact.c $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h
-$(O)attrib.o: attrib.c $(HACK_H)
-$(O)ball.o: ball.c $(HACK_H)
-$(O)bones.o: bones.c $(HACK_H) $(INCL)\lev.h
-$(O)botl.o: botl.c $(HACK_H)
-$(O)cmd.o: cmd.c $(HACK_H) $(INCL)\func_tab.h
-$(O)dbridge.o: dbridge.c $(HACK_H)
-$(O)decl.o: decl.c $(HACK_H)
-$(O)detect.o: detect.c $(HACK_H) $(INCL)\artifact.h
-$(O)dig.o: dig.c $(HACK_H) $(INCL)\edog.h
-$(O)display.o: display.c $(HACK_H)
-$(O)dlb.o: dlb.c $(CONFIG_H) $(INCL)\dlb.h
-$(O)do.o: do.c $(HACK_H) $(INCL)\lev.h
-$(O)do_name.o: do_name.c $(HACK_H)
-$(O)do_wear.o: do_wear.c $(HACK_H)
-$(O)dog.o: dog.c $(HACK_H) $(INCL)\edog.h
-$(O)dogmove.o: dogmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
-$(O)dokick.o: dokick.c $(HACK_H) $(INCL)\eshk.h
-$(O)dothrow.o: dothrow.c $(HACK_H) $(INCL)\edog.h
-$(O)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h
-$(O)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
-$(O)eat.o: eat.c $(HACK_H)
-$(O)end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\dlb.h
-$(O)engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h
-$(O)exper.o: exper.c $(HACK_H)
-$(O)explode.o: explode.c $(HACK_H)
-$(O)extralev.o: extralev.c $(HACK_H)
-$(O)files.o: files.c $(HACK_H) $(INCL)\dlb.h
-$(O)fountain.o: fountain.c $(HACK_H)
-$(O)hack.o: hack.c $(HACK_H)
-$(O)hacklib.o: hacklib.c $(HACK_H)
-$(O)invent.o: invent.c $(HACK_H)
-$(O)light.o: light.c $(HACK_H) $(INCL)\lev.h
-$(O)lock.o: lock.c $(HACK_H)
-$(O)mail.o: mail.c $(HACK_H) $(INCL)\mail.h
-$(O)makemon.o: makemon.c $(HACK_H) $(INCL)\epri.h $(INCL)\emin.h \
+$(OTTY)monstr.o: monstr.c $(CONFIG_H)
+$(OTTY)vis_tab.o: vis_tab.c $(CONFIG_H) $(INCL)\vis_tab.h
+$(OTTY)allmain.o: allmain.c $(HACK_H)
+$(OTTY)alloc.o: alloc.c $(CONFIG_H)
+$(OTTY)apply.o: apply.c $(HACK_H) $(INCL)\edog.h
+$(OTTY)artifact.o: artifact.c $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h
+$(OTTY)attrib.o: attrib.c $(HACK_H)
+$(OTTY)ball.o: ball.c $(HACK_H)
+$(OTTY)bones.o: bones.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)botl.o: botl.c $(HACK_H)
+$(OTTY)cmd.o: cmd.c $(HACK_H) $(INCL)\func_tab.h
+$(OTTY)dbridge.o: dbridge.c $(HACK_H)
+$(OTTY)decl.o: decl.c $(HACK_H)
+$(OTTY)detect.o: detect.c $(HACK_H) $(INCL)\artifact.h
+$(OTTY)dig.o: dig.c $(HACK_H) $(INCL)\edog.h
+$(OTTY)display.o: display.c $(HACK_H)
+$(OTTY)dlb.o: dlb.c $(CONFIG_H) $(INCL)\dlb.h
+$(OTTY)do.o: do.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)do_name.o: do_name.c $(HACK_H)
+$(OTTY)do_wear.o: do_wear.c $(HACK_H)
+$(OTTY)dog.o: dog.c $(HACK_H) $(INCL)\edog.h
+$(OTTY)dogmove.o: dogmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
+$(OTTY)dokick.o: dokick.c $(HACK_H) $(INCL)\eshk.h
+$(OTTY)dothrow.o: dothrow.c $(HACK_H) $(INCL)\edog.h
+$(OTTY)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h
+$(OTTY)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
+$(OTTY)eat.o: eat.c $(HACK_H)
+$(OTTY)end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\dlb.h
+$(OTTY)engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)exper.o: exper.c $(HACK_H)
+$(OTTY)explode.o: explode.c $(HACK_H)
+$(OTTY)extralev.o: extralev.c $(HACK_H)
+$(OTTY)files.o: files.c $(HACK_H) $(INCL)\dlb.h
+$(OTTY)fountain.o: fountain.c $(HACK_H)
+$(OTTY)hack.o: hack.c $(HACK_H)
+$(OTTY)hacklib.o: hacklib.c $(HACK_H)
+$(OTTY)invent.o: invent.c $(HACK_H)
+$(OTTY)light.o: light.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)lock.o: lock.c $(HACK_H)
+$(OTTY)mail.o: mail.c $(HACK_H) $(INCL)\mail.h
+$(OTTY)makemon.o: makemon.c $(HACK_H) $(INCL)\epri.h $(INCL)\emin.h \
+		$(INCL)\edog.h
+$(OTTY)mapglyph.o: mapglyph.c $(HACK_H)
+$(OTTY)mcastu.o: mcastu.c $(HACK_H)
+$(OTTY)mhitm.o: mhitm.c $(HACK_H) $(INCL)\artifact.h $(INCL)\edog.h
+$(OTTY)mhitu.o: mhitu.c $(HACK_H) $(INCL)\artifact.h $(INCL)\edog.h
+$(OTTY)minion.o: minion.c $(HACK_H) $(INCL)\emin.h $(INCL)\epri.h
+$(OTTY)mklev.o: mklev.c $(HACK_H)
+$(OTTY)mkmap.o: mkmap.c $(HACK_H) $(INCL)\sp_lev.h
+$(OTTY)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)\sp_lev.h $(INCL)\lev.h
+$(OTTY)mkobj.o: mkobj.c $(HACK_H)
+$(OTTY)mkroom.o: mkroom.c $(HACK_H)
+$(OTTY)mon.o: mon.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
+$(OTTY)mondata.o: mondata.c $(HACK_H) $(INCL)\eshk.h $(INCL)\epri.h
+$(OTTY)monmove.o: monmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\artifact.h \
+		$(INCL)\epri.h
+$(OTTY)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)\color.h
+$(OTTY)mplayer.o: mplayer.c $(HACK_H)
+$(OTTY)mthrowu.o: mthrowu.c $(HACK_H)
+$(OTTY)muse.o: muse.c $(HACK_H) $(INCL)\edog.h
+$(OTTY)music.o: music.c $(HACK_H) #interp.c
+$(OTTY)o_init.o: o_init.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)objects.o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \
+		$(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h
+$(OTTY)objnam.o: objnam.c $(HACK_H)
+$(OTTY)options.o: options.c $(CONFIG_H) $(INCL)\objclass.h $(INCL)\flag.h \
+		$(HACK_H) $(INCL)\tcap.h
+$(OTTY)pager.o: pager.c $(HACK_H) $(INCL)\dlb.h
+$(OTTY)pickup.o: pickup.c $(HACK_H)
+$(OTTY)pline.o: pline.c $(HACK_H) $(INCL)\epri.h $(INCL)\edog.h
+$(OTTY)polyself.o: polyself.c $(HACK_H)
+$(OTTY)potion.o: potion.c $(HACK_H)
+$(OTTY)pray.o: pray.c $(HACK_H) $(INCL)\epri.h
+$(OTTY)priest.o: priest.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\eshk.h \
+		$(INCL)\epri.h $(INCL)\emin.h
+$(OTTY)quest.o: quest.c $(HACK_H) $(INCL)\qtext.h
+$(OTTY)questpgr.o: questpgr.c $(HACK_H) $(INCL)\dlb.h $(INCL)\qtext.h
+$(OTTY)read.o: read.c $(HACK_H)
+$(OTTY)rect.o: rect.c $(HACK_H)
+$(OTTY)region.o: region.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)restore.o: restore.c $(HACK_H) $(INCL)\lev.h $(INCL)\tcap.h
+$(OTTY)rip.o: rip.c $(HACK_H)
+$(OTTY)rnd.o: rnd.c $(HACK_H)
+$(OTTY)role.o: role.c $(HACK_H)
+$(OTTY)rumors.o: rumors.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h
+$(OTTY)save.o: save.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)shk.o: shk.c $(HACK_H) $(INCL)\eshk.h
+$(OTTY)shknam.o: shknam.c $(HACK_H) $(INCL)\eshk.h
+$(OTTY)sit.o: sit.c $(HACK_H) $(INCL)\artifact.h
+$(OTTY)sounds.o: sounds.c $(HACK_H) $(INCL)\edog.h
+$(OTTY)sp_lev.o: sp_lev.c $(HACK_H) $(INCL)\dlb.h $(INCL)\sp_lev.h
+$(OTTY)spell.o: spell.c $(HACK_H)
+$(OTTY)steal.o: steal.c $(HACK_H)
+$(OTTY)steed.o: steed.c $(HACK_H)
+$(OTTY)teleport.o: teleport.c $(HACK_H)
+$(OTTY)timeout.o: timeout.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)topten.o: topten.c $(HACK_H) $(INCL)\dlb.h $(INCL)\patchlevel.h
+$(OTTY)track.o: track.c $(HACK_H)
+$(OTTY)trap.o: trap.c $(HACK_H)
+$(OTTY)u_init.o: u_init.c $(HACK_H)
+$(OTTY)uhitm.o: uhitm.c $(HACK_H)
+$(OTTY)vault.o: vault.c $(HACK_H) $(INCL)\vault.h
+$(OTTY)version.o: version.c $(HACK_H) $(INCL)\date.h $(INCL)\patchlevel.h
+$(OTTY)vision.o: vision.c $(HACK_H) $(INCL)\vis_tab.h
+$(OTTY)weapon.o: weapon.c $(HACK_H)
+$(OTTY)were.o: were.c $(HACK_H)
+$(OTTY)wield.o: wield.c $(HACK_H)
+$(OTTY)windows.o: windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h
+$(OTTY)wizard.o: wizard.c $(HACK_H) $(INCL)\qtext.h $(INCL)\epri.h
+$(OTTY)worm.o: worm.c $(HACK_H) $(INCL)\lev.h
+$(OTTY)worn.o: worn.c $(HACK_H)
+$(OTTY)write.o: write.c $(HACK_H)
+$(OTTY)zap.o: zap.c $(HACK_H)
+
+#
+# - GUI .o files
+#
+
+$(OGUI)tos.o: ..\sys\atari\tos.c $(HACK_H) $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\atari\tos.c
+$(OGUI)pcmain.o: ..\sys\share\pcmain.c $(HACK_H) $(INCL)\dlb.h \
+		$(INCL)\win32api.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\share\pcmain.c
+$(OGUI)pcsys.o: ..\sys\share\pcsys.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\share\pcsys.c
+$(OGUI)pctty.o: ..\sys\share\pctty.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\share\pctty.c
+$(OGUI)pcunix.o: ..\sys\share\pcunix.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\share\pcunix.c
+$(OGUI)random.o: ..\sys\share\random.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\share\random.c
+$(OGUI)ioctl.o: ..\sys\share\ioctl.c $(HACK_H) $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\share\ioctl.c
+$(OGUI)unixtty.o: ..\sys\share\unixtty.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\share\unixtty.c
+$(OGUI)unixmain.o: ..\sys\unix\unixmain.c $(HACK_H) $(INCL)\dlb.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\unix\unixmain.c
+$(OGUI)unixunix.o: ..\sys\unix\unixunix.c $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\unix\unixunix.c
+$(OGUI)unixres.o: ..\sys\unix\unixres.c $(CONFIG_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\unix\unixres.c
+$(OGUI)bemain.o: ..\sys\be\bemain.c $(HACK_H) $(INCL)\dlb.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\sys\be\bemain.c
+$(OGUI)getline.o: ..\win\tty\getline.c $(HACK_H) $(INCL)\func_tab.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\tty\getline.c
+$(OGUI)termcap.o: ..\win\tty\termcap.c $(HACK_H) $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\tty\termcap.c
+$(OGUI)topl.o: ..\win\tty\topl.c $(HACK_H) $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\tty\topl.c
+$(OGUI)wintty.o: ..\win\tty\wintty.c $(HACK_H) $(INCL)\dlb.h \
+		$(INCL)\patchlevel.h $(INCL)\tcap.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\tty\wintty.c
+$(OGUI)Window.o: ..\win\X11\Window.c $(INCL)\xwindowp.h $(INCL)\xwindow.h \
+		$(CONFIG_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\Window.c
+$(OGUI)dialogs.o: ..\win\X11\dialogs.c $(CONFIG_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\dialogs.c
+$(OGUI)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
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\winX.c
+$(OGUI)winmap.o: ..\win\X11\winmap.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\dlb.h \
+		$(INCL)\winX.h $(INCL)\tile2x11.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\winmap.c
+$(OGUI)winmenu.o: ..\win\X11\winmenu.c $(HACK_H) $(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\winmenu.c
+$(OGUI)winmesg.o: ..\win\X11\winmesg.c $(INCL)\xwindow.h $(HACK_H) $(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\winmesg.c
+$(OGUI)winmisc.o: ..\win\X11\winmisc.c $(HACK_H) $(INCL)\func_tab.h \
+		$(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\winmisc.c
+$(OGUI)winstat.o: ..\win\X11\winstat.c $(HACK_H) $(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\winstat.c
+$(OGUI)wintext.o: ..\win\X11\wintext.c $(HACK_H) $(INCL)\winX.h $(INCL)\xwindow.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\wintext.c
+$(OGUI)winval.o: ..\win\X11\winval.c $(HACK_H) $(INCL)\winX.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\X11\winval.c
+$(OGUI)tile.o: $(SRC)\tile.c $(HACK_H)
+$(OGUI)gnaskstr.o: ..\win\gnome\gnaskstr.c ..\win\gnome\gnaskstr.h \
+		..\win\gnome\gnmain.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnaskstr.c
+$(OGUI)gnbind.o: ..\win\gnome\gnbind.c ..\win\gnome\gnbind.h ..\win\gnome\gnmain.h \
+		..\win\gnome\gnaskstr.h ..\win\gnome\gnyesno.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnbind.c
+$(OGUI)gnglyph.o: ..\win\gnome\gnglyph.c ..\win\gnome\gnglyph.h $(INCL)\tile2x11.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnglyph.c
+$(OGUI)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
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmain.c
+$(OGUI)gnmap.o: ..\win\gnome\gnmap.c ..\win\gnome\gnmap.h ..\win\gnome\gnglyph.h \
+		..\win\gnome\gnsignal.h $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmap.c
+$(OGUI)gnmenu.o: ..\win\gnome\gnmenu.c ..\win\gnome\gnmenu.h ..\win\gnome\gnmain.h \
+		..\win\gnome\gnbind.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmenu.c
+$(OGUI)gnmesg.o: ..\win\gnome\gnmesg.c ..\win\gnome\gnmesg.h ..\win\gnome\gnsignal.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnmesg.c
+$(OGUI)gnopts.o: ..\win\gnome\gnopts.c ..\win\gnome\gnopts.h ..\win\gnome\gnglyph.h \
+		..\win\gnome\gnmain.h ..\win\gnome\gnmap.h $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnopts.c
+$(OGUI)gnplayer.o: ..\win\gnome\gnplayer.c ..\win\gnome\gnplayer.h \
+		..\win\gnome\gnmain.h $(HACK_H)
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnplayer.c
+$(OGUI)gnsignal.o: ..\win\gnome\gnsignal.c ..\win\gnome\gnsignal.h \
+		..\win\gnome\gnmain.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnsignal.c
+$(OGUI)gnstatus.o: ..\win\gnome\gnstatus.c ..\win\gnome\gnstatus.h \
+		..\win\gnome\gnsignal.h ..\win\gnome\gn_xpms.h \
+		..\win\gnome\gnomeprv.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnstatus.c
+$(OGUI)gntext.o: ..\win\gnome\gntext.c ..\win\gnome\gntext.h ..\win\gnome\gnmain.h \
+		..\win\gnome\gn_rip.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gntext.c
+$(OGUI)gnworn.o: ..\win\gnome\gnworn.c ..\win\gnome\gnworn.h ..\win\gnome\gnglyph.h \
+		..\win\gnome\gnsignal.h ..\win\gnome\gnomeprv.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnworn.c
+$(OGUI)gnyesno.o: ..\win\gnome\gnyesno.c ..\win\gnome\gnbind.h ..\win\gnome\gnyesno.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) $(GNOMEINC) -Fo$@ ..\win\gnome\gnyesno.c
+$(OGUI)wingem.o: ..\win\gem\wingem.c $(HACK_H) $(INCL)\func_tab.h $(INCL)\dlb.h \
+		$(INCL)\patchlevel.h $(INCL)\wingem.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\gem\wingem.c
+$(OGUI)wingem1.o: ..\win\gem\wingem1.c $(INCL)\gem_rsc.h $(INCL)\load_img.h \
+		$(INCL)\gr_rect.h $(INCL)\wintype.h $(INCL)\wingem.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\gem\wingem1.c
+$(OGUI)load_img.o: ..\win\gem\load_img.c $(INCL)\load_img.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\gem\load_img.c
+$(OGUI)gr_rect.o: ..\win\gem\gr_rect.c $(INCL)\gr_rect.h
+	$(Q)$(CC) $(CFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\gem\gr_rect.c
+$(OGUI)tile.o: tile.c $(HACK_H)
+$(OGUI)qt_win.o: ..\win\Qt\qt_win.cpp $(HACK_H) $(INCL)\func_tab.h \
+		$(INCL)\dlb.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) $(WINPFLAGSGUI) -Fo$@ ..\win\Qt\qt_win.cpp
+$(OGUI)qt_clust.o: ..\win\Qt\qt_clust.cpp $(INCL)\qt_clust.h
+	$(CXX) $(CXXFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\Qt\qt_clust.cpp
+$(OGUI)qttableview.o: ..\win\Qt\qttableview.cpp $(INCL)\qttableview.h
+	$(CXX) $(CXXFLAGS) $(WINPFLAGSGUI) -Fo$@ ..\win\Qt\qttableview.cpp
+$(OGUI)monstr.o: monstr.c $(CONFIG_H)
+$(OGUI)vis_tab.o: vis_tab.c $(CONFIG_H) $(INCL)\vis_tab.h
+$(OGUI)allmain.o: allmain.c $(HACK_H)
+$(OGUI)alloc.o: alloc.c $(CONFIG_H)
+$(OGUI)apply.o: apply.c $(HACK_H) $(INCL)\edog.h
+$(OGUI)artifact.o: artifact.c $(HACK_H) $(INCL)\artifact.h $(INCL)\artilist.h
+$(OGUI)attrib.o: attrib.c $(HACK_H)
+$(OGUI)ball.o: ball.c $(HACK_H)
+$(OGUI)bones.o: bones.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)botl.o: botl.c $(HACK_H)
+$(OGUI)cmd.o: cmd.c $(HACK_H) $(INCL)\func_tab.h
+$(OGUI)dbridge.o: dbridge.c $(HACK_H)
+$(OGUI)decl.o: decl.c $(HACK_H)
+$(OGUI)detect.o: detect.c $(HACK_H) $(INCL)\artifact.h
+$(OGUI)dig.o: dig.c $(HACK_H) $(INCL)\edog.h
+$(OGUI)display.o: display.c $(HACK_H)
+$(OGUI)dlb.o: dlb.c $(CONFIG_H) $(INCL)\dlb.h
+$(OGUI)do.o: do.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)do_name.o: do_name.c $(HACK_H)
+$(OGUI)do_wear.o: do_wear.c $(HACK_H)
+$(OGUI)dog.o: dog.c $(HACK_H) $(INCL)\edog.h
+$(OGUI)dogmove.o: dogmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
+$(OGUI)dokick.o: dokick.c $(HACK_H) $(INCL)\eshk.h
+$(OGUI)dothrow.o: dothrow.c $(HACK_H) $(INCL)\edog.h
+$(OGUI)drawing.o: drawing.c $(HACK_H) $(INCL)\tcap.h
+$(OGUI)dungeon.o: dungeon.c $(HACK_H) $(INCL)\dgn_file.h $(INCL)\dlb.h
+$(OGUI)eat.o: eat.c $(HACK_H)
+$(OGUI)end.o: end.c $(HACK_H) $(INCL)\eshk.h $(INCL)\dlb.h
+$(OGUI)engrave.o: engrave.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)exper.o: exper.c $(HACK_H)
+$(OGUI)explode.o: explode.c $(HACK_H)
+$(OGUI)extralev.o: extralev.c $(HACK_H)
+$(OGUI)files.o: files.c $(HACK_H) $(INCL)\dlb.h
+$(OGUI)fountain.o: fountain.c $(HACK_H)
+$(OGUI)hack.o: hack.c $(HACK_H)
+$(OGUI)hacklib.o: hacklib.c $(HACK_H)
+$(OGUI)invent.o: invent.c $(HACK_H)
+$(OGUI)light.o: light.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)lock.o: lock.c $(HACK_H)
+$(OGUI)mail.o: mail.c $(HACK_H) $(INCL)\mail.h
+$(OGUI)makemon.o: makemon.c $(HACK_H) $(INCL)\epri.h $(INCL)\emin.h \
 		$(INCL)\edog.h
-$(O)mapglyph.o: mapglyph.c $(HACK_H)
-$(O)mcastu.o: mcastu.c $(HACK_H)
-$(O)mhitm.o: mhitm.c $(HACK_H) $(INCL)\artifact.h $(INCL)\edog.h
-$(O)mhitu.o: mhitu.c $(HACK_H) $(INCL)\artifact.h $(INCL)\edog.h
-$(O)minion.o: minion.c $(HACK_H) $(INCL)\emin.h $(INCL)\epri.h
-$(O)mklev.o: mklev.c $(HACK_H)
-$(O)mkmap.o: mkmap.c $(HACK_H) $(INCL)\sp_lev.h
-$(O)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)\sp_lev.h $(INCL)\lev.h
-$(O)mkobj.o: mkobj.c $(HACK_H)
-$(O)mkroom.o: mkroom.c $(HACK_H)
-$(O)mon.o: mon.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
-$(O)mondata.o: mondata.c $(HACK_H) $(INCL)\eshk.h $(INCL)\epri.h
-$(O)monmove.o: monmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\artifact.h \
+$(OGUI)mapglyph.o: mapglyph.c $(HACK_H)
+$(OGUI)mcastu.o: mcastu.c $(HACK_H)
+$(OGUI)mhitm.o: mhitm.c $(HACK_H) $(INCL)\artifact.h $(INCL)\edog.h
+$(OGUI)mhitu.o: mhitu.c $(HACK_H) $(INCL)\artifact.h $(INCL)\edog.h
+$(OGUI)minion.o: minion.c $(HACK_H) $(INCL)\emin.h $(INCL)\epri.h
+$(OGUI)mklev.o: mklev.c $(HACK_H)
+$(OGUI)mkmap.o: mkmap.c $(HACK_H) $(INCL)\sp_lev.h
+$(OGUI)mkmaze.o: mkmaze.c $(HACK_H) $(INCL)\sp_lev.h $(INCL)\lev.h
+$(OGUI)mkobj.o: mkobj.c $(HACK_H)
+$(OGUI)mkroom.o: mkroom.c $(HACK_H)
+$(OGUI)mon.o: mon.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\edog.h
+$(OGUI)mondata.o: mondata.c $(HACK_H) $(INCL)\eshk.h $(INCL)\epri.h
+$(OGUI)monmove.o: monmove.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\artifact.h \
 		$(INCL)\epri.h
-$(O)monst.o: monst.c $(CONFIG_H) $(INCL)\permonst.h $(INCL)\align.h \
+$(OGUI)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)\color.h
-$(O)mplayer.o: mplayer.c $(HACK_H)
-$(O)mthrowu.o: mthrowu.c $(HACK_H)
-$(O)muse.o: muse.c $(HACK_H) $(INCL)\edog.h
-$(O)music.o: music.c $(HACK_H) #interp.c
-$(O)o_init.o: o_init.c $(HACK_H) $(INCL)\lev.h
-$(O)objects.o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \
+$(OGUI)mplayer.o: mplayer.c $(HACK_H)
+$(OGUI)mthrowu.o: mthrowu.c $(HACK_H)
+$(OGUI)muse.o: muse.c $(HACK_H) $(INCL)\edog.h
+$(OGUI)music.o: music.c $(HACK_H) #interp.c
+$(OGUI)o_init.o: o_init.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)objects.o: objects.c $(CONFIG_H) $(INCL)\obj.h $(INCL)\objclass.h \
 		$(INCL)\prop.h $(INCL)\skills.h $(INCL)\color.h
-$(O)objnam.o: objnam.c $(HACK_H)
-$(O)options.o: options.c $(CONFIG_H) $(INCL)\objclass.h $(INCL)\flag.h \
+$(OGUI)objnam.o: objnam.c $(HACK_H)
+$(OGUI)options.o: options.c $(CONFIG_H) $(INCL)\objclass.h $(INCL)\flag.h \
 		$(HACK_H) $(INCL)\tcap.h
-$(O)pager.o: pager.c $(HACK_H) $(INCL)\dlb.h
-$(O)pickup.o: pickup.c $(HACK_H)
-$(O)pline.o: pline.c $(HACK_H) $(INCL)\epri.h $(INCL)\edog.h
-$(O)polyself.o: polyself.c $(HACK_H)
-$(O)potion.o: potion.c $(HACK_H)
-$(O)pray.o: pray.c $(HACK_H) $(INCL)\epri.h
-$(O)priest.o: priest.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\eshk.h \
+$(OGUI)pager.o: pager.c $(HACK_H) $(INCL)\dlb.h
+$(OGUI)pickup.o: pickup.c $(HACK_H)
+$(OGUI)pline.o: pline.c $(HACK_H) $(INCL)\epri.h $(INCL)\edog.h
+$(OGUI)polyself.o: polyself.c $(HACK_H)
+$(OGUI)potion.o: potion.c $(HACK_H)
+$(OGUI)pray.o: pray.c $(HACK_H) $(INCL)\epri.h
+$(OGUI)priest.o: priest.c $(HACK_H) $(INCL)\mfndpos.h $(INCL)\eshk.h \
 		$(INCL)\epri.h $(INCL)\emin.h
-$(O)quest.o: quest.c $(HACK_H) $(INCL)\qtext.h
-$(O)questpgr.o: questpgr.c $(HACK_H) $(INCL)\dlb.h $(INCL)\qtext.h
-$(O)read.o: read.c $(HACK_H)
-$(O)rect.o: rect.c $(HACK_H)
-$(O)region.o: region.c $(HACK_H) $(INCL)\lev.h
-$(O)restore.o: restore.c $(HACK_H) $(INCL)\lev.h $(INCL)\tcap.h
-$(O)rip.o: rip.c $(HACK_H)
-$(O)rnd.o: rnd.c $(HACK_H)
-$(O)role.o: role.c $(HACK_H)
-$(O)rumors.o: rumors.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h
-$(O)save.o: save.c $(HACK_H) $(INCL)\lev.h
-$(O)shk.o: shk.c $(HACK_H) $(INCL)\eshk.h
-$(O)shknam.o: shknam.c $(HACK_H) $(INCL)\eshk.h
-$(O)sit.o: sit.c $(HACK_H) $(INCL)\artifact.h
-$(O)sounds.o: sounds.c $(HACK_H) $(INCL)\edog.h
-$(O)sp_lev.o: sp_lev.c $(HACK_H) $(INCL)\dlb.h $(INCL)\sp_lev.h
-$(O)spell.o: spell.c $(HACK_H)
-$(O)steal.o: steal.c $(HACK_H)
-$(O)steed.o: steed.c $(HACK_H)
-$(O)teleport.o: teleport.c $(HACK_H)
-$(O)timeout.o: timeout.c $(HACK_H) $(INCL)\lev.h
-$(O)topten.o: topten.c $(HACK_H) $(INCL)\dlb.h $(INCL)\patchlevel.h
-$(O)track.o: track.c $(HACK_H)
-$(O)trap.o: trap.c $(HACK_H)
-$(O)u_init.o: u_init.c $(HACK_H)
-$(O)uhitm.o: uhitm.c $(HACK_H)
-$(O)vault.o: vault.c $(HACK_H) $(INCL)\vault.h
-$(O)version.o: version.c $(HACK_H) $(INCL)\date.h $(INCL)\patchlevel.h
-$(O)vision.o: vision.c $(HACK_H) $(INCL)\vis_tab.h
-$(O)weapon.o: weapon.c $(HACK_H)
-$(O)were.o: were.c $(HACK_H)
-$(O)wield.o: wield.c $(HACK_H)
-$(O)windows.o: windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h
-$(O)wizard.o: wizard.c $(HACK_H) $(INCL)\qtext.h $(INCL)\epri.h
-$(O)worm.o: worm.c $(HACK_H) $(INCL)\lev.h
-$(O)worn.o: worn.c $(HACK_H)
-$(O)write.o: write.c $(HACK_H)
-$(O)zap.o: zap.c $(HACK_H)
+$(OGUI)quest.o: quest.c $(HACK_H) $(INCL)\qtext.h
+$(OGUI)questpgr.o: questpgr.c $(HACK_H) $(INCL)\dlb.h $(INCL)\qtext.h
+$(OGUI)read.o: read.c $(HACK_H)
+$(OGUI)rect.o: rect.c $(HACK_H)
+$(OGUI)region.o: region.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)restore.o: restore.c $(HACK_H) $(INCL)\lev.h $(INCL)\tcap.h
+$(OGUI)rip.o: rip.c $(HACK_H)
+$(OGUI)rnd.o: rnd.c $(HACK_H)
+$(OGUI)role.o: role.c $(HACK_H)
+$(OGUI)rumors.o: rumors.c $(HACK_H) $(INCL)\lev.h $(INCL)\dlb.h
+$(OGUI)save.o: save.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)shk.o: shk.c $(HACK_H) $(INCL)\eshk.h
+$(OGUI)shknam.o: shknam.c $(HACK_H) $(INCL)\eshk.h
+$(OGUI)sit.o: sit.c $(HACK_H) $(INCL)\artifact.h
+$(OGUI)sounds.o: sounds.c $(HACK_H) $(INCL)\edog.h
+$(OGUI)sp_lev.o: sp_lev.c $(HACK_H) $(INCL)\dlb.h $(INCL)\sp_lev.h
+$(OGUI)spell.o: spell.c $(HACK_H)
+$(OGUI)steal.o: steal.c $(HACK_H)
+$(OGUI)steed.o: steed.c $(HACK_H)
+$(OGUI)teleport.o: teleport.c $(HACK_H)
+$(OGUI)timeout.o: timeout.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)topten.o: topten.c $(HACK_H) $(INCL)\dlb.h $(INCL)\patchlevel.h
+$(OGUI)track.o: track.c $(HACK_H)
+$(OGUI)trap.o: trap.c $(HACK_H)
+$(OGUI)u_init.o: u_init.c $(HACK_H)
+$(OGUI)uhitm.o: uhitm.c $(HACK_H)
+$(OGUI)vault.o: vault.c $(HACK_H) $(INCL)\vault.h
+$(OGUI)version.o: version.c $(HACK_H) $(INCL)\date.h $(INCL)\patchlevel.h
+$(OGUI)vision.o: vision.c $(HACK_H) $(INCL)\vis_tab.h
+$(OGUI)weapon.o: weapon.c $(HACK_H)
+$(OGUI)were.o: were.c $(HACK_H)
+$(OGUI)wield.o: wield.c $(HACK_H)
+$(OGUI)windows.o: windows.c $(HACK_H) $(INCL)\wingem.h $(INCL)\winGnome.h
+$(OGUI)wizard.o: wizard.c $(HACK_H) $(INCL)\qtext.h $(INCL)\epri.h
+$(OGUI)worm.o: worm.c $(HACK_H) $(INCL)\lev.h
+$(OGUI)worn.o: worn.c $(HACK_H)
+$(OGUI)write.o: write.c $(HACK_H)
+$(OGUI)zap.o: zap.c $(HACK_H)
 
 # end of file
diff -ur dist343/sys/winnt/win32api.h test2022/sys/winnt/win32api.h
--- dist343/sys/winnt/win32api.h	2022-12-04 11:45:07.567763000 -0500
+++ sys/winnt/win32api.h	2022-12-04 18:09:43.849810600 -0500
@@ -15,13 +15,19 @@
 # pragma pack(8)
 # endif
 
-#define WIN32_LEAN_AND_MEAN
+#undef Protection
+#undef strcmpi
 
+#define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <commctrl.h>
 
 # if defined(_MSC_VER)
-# pragma pack()
+#pragma pack()
+#define expl expl_
 # endif
 
+#define Protection (HProtection || EProtection)
+
+
 /*win32api.h*/