diff -r 2a8bf2ba504f src/GvimExt/Makefile
--- a/src/GvimExt/Makefile	Tue Aug 17 20:26:59 2010 +0200
+++ b/src/GvimExt/Makefile	Wed Aug 18 15:08:02 2010 +0200
@@ -2,9 +2,12 @@
 # Options:
 #   DEBUG=yes		Build debug version (for VC7 and maybe later)
 #
-
-TARGETOS=BOTH
-APPVER=4.0
+!ifndef TARGETOS
+TARGETOS = BOTH
+!endif
+!ifndef APPVER
+APPVER = 4.0
+!endif
 
 !if "$(DEBUG)" != "yes"
 NODEBUG = 1
@@ -12,6 +15,14 @@
 
 !include <win32.mak>
 
+!ifndef WINVER
+!ifdef NMAKE_WINVER
+WINVER = $(NMAKE_WINVER)
+!else
+WINVER = 0x0400
+!endif
+!endif
+
 all: gvimext.dll
 
 gvimext.dll:    gvimext.obj	\
diff -r 2a8bf2ba504f src/Make_mvc.mak
--- a/src/Make_mvc.mak	Tue Aug 17 20:26:59 2010 +0200
+++ b/src/Make_mvc.mak	Wed Aug 18 15:08:02 2010 +0200
@@ -93,7 +93,13 @@
 #       Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is
 #       i386)
 #
-#       Version Support: WINVER=[0x0400, 0x0500] (default is 0x0400)
+#       Target Windows type: TARGETOS=[BOTH, WINNT, WIN95] (default is BOTH)
+#
+#       Target Windows version: APPVER=[4.0, 5.0, 5.01, 5.02, 6.0, 6.1] (default
+#       is 4.0)
+#
+#       Version Support: WINVER=[0x0400, 0x0500, 0x0600, 0x0700, 0x0800]
+#       (usually set by system based on APPVER, otherwise default to 0x0400)
 #
 #	Debug version: DEBUG=yes
 #	Mapfile: MAP=[no, yes or lines] (default is yes)
@@ -149,7 +155,14 @@
 
 # Build on both Windows NT/XP and Windows 9x
 
+!ifndef TARGETOS
 TARGETOS = BOTH
+!endif
+!message Target OS type is $(TARGETOS)
+!ifndef APPVER
+APPVER = 4.0
+!endif
+!message Target OS version is $(APPVER)
 
 # Select one of eight object code directories, depends on GUI, OLE, DEBUG and
 # interfaces.
@@ -310,7 +323,13 @@
 ### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET)
 #  When set to 0x0500 ":browse" stops working.
 !ifndef WINVER
+!ifdef NMAKE_WINVER
+WINVER = $(NMAKE_WINVER)
+!message Target OS set by nmake, using: $(WINVER)
+!else
 WINVER = 0x0400
+!message Target OS not set by nmake, using: $(WINVER)
+!endif
 !endif
 
 # If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal
@@ -924,7 +943,7 @@
 
 GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
 	cd GvimExt
-	$(MAKE) /NOLOGO -f Makefile $(MAKEFLAGS_GVIMEXT)
+	$(MAKE) /NOLOGO -f Makefile $(MAKEFLAGS_GVIMEXT) APPVER=$(APPVER) TARGETOS=$(TARGETOS) WINVER=$(WINVER)
 	cd ..
 
 
