On 26/09/2007 21:02, Bram Moolenaar wrote:
> Mike -
> 
>> The following is a resend of a patch from 6 months ago to enable 
>> optimized building with to use VC8 features and remove compiler option 
>> warnings.
> 
> I had a few problems with this patch, which is why I didn't send it out
> yet.  Also, it collides with a patch from George Reilly for Win64
> support, which also has a problem.
> 
>> @@ -320,7 +322,44 @@ INTDIR=$(OBJDIR)
>>  INTDIR=$(OBJDIR)
>>  OUTDIR=$(OBJDIR)
>>  
>> +# Derive version of VC being used from nmake if not specified
>> +!if "$(MSVCVER)" == ""
>> +!if "$(_NMAKE_VER)" == ""
>> +MSVCVER = "4.0"
> 
> The "4.0" needs to be 4.0 (no quotes) for this to work with old nmake.
> 
>>  # Convert processor ID to MVC-compatible number
>> +!if $(MSVCVER) != "8.0"
> 
> But we do need quotes here:
>    !if "$(MSVCVER)" != "8.0"
> 
> Other "if" for MSVCVER are similar.

Ok, here is the next version for identifying compiler version and 
supporting VC8 optimisation compiler options.  How about sending this 
out separate to the Win64 support as VIM cannot currently use VC8 
specific optimisations without it.  Win64 specific changes can then be 
made on top of it.  Just a thought.

TTFN

Mike
-- 
I hear, I forget. I see, I remember. I experience, I understand. - 
Chinese Proverb

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

diff -r 95b0dc7a6113 src/Make_mvc.mak
--- a/src/Make_mvc.mak  Sun Sep 23 16:13:03 2007 +0100
+++ b/src/Make_mvc.mak  Sun Sep 30 22:34:50 2007 +0100
@@ -91,6 +91,8 @@
 #
 #       Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes
 #       doesn't work)
+#
+#       Visual C Version: MSVCVER=m.n (default derived from nmake if undefined)
 #
 # You can combine any of these interfaces
 #
@@ -320,7 +322,44 @@ INTDIR=$(OBJDIR)
 INTDIR=$(OBJDIR)
 OUTDIR=$(OBJDIR)
 
+# Derive version of VC being used from nmake if not specified
+!if "$(MSVCVER)" == ""
+!if "$(_NMAKE_VER)" == ""
+MSVCVER = 4.0
+!endif
+!if "$(_NMAKE_VER)" == "162"
+MSVCVER = 5.0
+!endif
+!if "$(_NMAKE_VER)" == "6.00.8168.0"
+MSVCVER = 6.0
+!endif
+!if "$(_NMAKE_VER)" == "7.00.9466"
+MSVCVER = 7.0
+!endif
+!if "$(_NMAKE_VER)" == "7.10.3077"
+MSVCVER = 7.1
+!endif
+!if "$(_NMAKE_VER)" == "8.00.50727.42"
+MSVCVER = 8.0
+!endif
+!if "$(_NMAKE_VER)" == "8.00.50727.762"
+MSVCVER = 8.0
+!endif
+!endif
+
+# Abort bulding VIM if version of VC is unrecognised.
+!ifndef MSVCVER
+!message *** ERROR
+!message Cannot determine Visual C version being used.  If you are using the
+!message Windows SDK then you must have the environment variable MSVCVER set to
+!message your version of the VC compiler.  If you are not using the Express
+!message version of Visual C you van either set MSVCVER or update this makefile
+!message to handle the new value for _NMAKE_VER.
+!error Make aborted.
+!endif
+
 # Convert processor ID to MVC-compatible number
+!if "$(MSVCVER)" != "8.0"
 !if "$(CPUNR)" == "i386"
 CPUARG = /G3
 !elseif "$(CPUNR)" == "i486"
@@ -334,6 +373,12 @@ CPUARG = /G7 /arch:SSE2
 !else
 CPUARG =
 !endif
+!else
+# VC8 only allows specifying SSE architecture
+!if "$(CPUNR)" == "pentium4"
+CPUARG = /arch:SSE2
+!endif
+!endif
 
 !ifdef NODEBUG
 VIM = vim
@@ -343,6 +388,12 @@ OPTFLAG = /O2
 OPTFLAG = /O2
 !else # MAXSPEED
 OPTFLAG = /Ox
+!endif
+!if "$(MSVCVER)" == "8.0"
+# Use link time code generation if not worried about size
+!if "$(OPTIMIZE)" != "SPACE"
+OPTFLAG = $(OPTFLAG) /GL
+!endif
 !endif
 CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG $(CPUARG)
 RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG
@@ -363,7 +414,7 @@ CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Od
 CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Od
 RCFLAGS = $(rcflags) $(rcvars) -D_DEBUG -DDEBUG
 # The /fixed:no is needed for Quantify. Assume not 4.? as unsupported in VC4.0.
-! if "$(_NMAKE_VER)" == ""
+! if "$(MSVCVER)" == "4.0"
 LIBC =
 ! else
 LIBC = /fixed:no
@@ -707,6 +758,15 @@ LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC
                $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) \
                $(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
 
+# Report link time code generation progress if used. 
+!ifdef NODEBUG
+!if "$(MSVCVER)" == "8.0"
+!if "$(OPTIMIZE)" != "SPACE"
+LINKARGS1 = $(LINKARGS1) /LTCG:STATUS
+!endif
+!endif
+!endif
+
 all:   $(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe \
                GvimExt/gvimext.dll
 
@@ -794,7 +854,7 @@ testclean:
 
 # Create a default rule for transforming .c files to .obj files in $(OUTDIR)
 # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
-!IF "$(_NMAKE_VER)" == ""
+!IF "$(MSVCVER)" == "4.0"
 .c{$(OUTDIR)/}.obj:
 !ELSE
 .c{$(OUTDIR)/}.obj::
@@ -803,7 +863,7 @@ testclean:
 
 # Create a default rule for transforming .cpp files to .obj files in $(OUTDIR)
 # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
-!IF "$(_NMAKE_VER)" == ""
+!IF "$(MSVCVER)" == "4.0"
 .cpp{$(OUTDIR)/}.obj:
 !ELSE
 .cpp{$(OUTDIR)/}.obj::

Reply via email to