117117# Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes
118118# doesn't work)
119119#
120- # Visual C Version: MSVCVER=m.n (default derived from nmake if undefined)
121- #
122120# Static Code Analysis: ANALYZE=yes (works with VS2012 only)
123121#
124122# You can combine any of these interfaces
@@ -379,91 +377,29 @@ DEL_TREE = deltree /y
379377INTDIR =$(OBJDIR )
380378OUTDIR =$(OBJDIR )
381379
382- # Derive version of VC being used from nmake if not specified
383- !if "$(MSVCVER)" == ""
384- !if "$(_NMAKE_VER)" == ""
385- MSVCVER = 4.0
386- !endif
387- !if "$(_NMAKE_VER)" == "162"
388- MSVCVER = 5.0
389- !endif
390- !if "$(_NMAKE_VER)" == "6.00.8168.0"
391- MSVCVER = 6.0
392- CPU = ix86
393- !endif
394- !if "$(_NMAKE_VER)" == "6.00.9782.0"
395- MSVCVER = 6.0
396- CPU = ix86
397- !endif
398- !if "$(_NMAKE_VER)" == "7.00.9466"
399- MSVCVER = 7.0
400- !endif
401- !if "$(_NMAKE_VER)" == "7.10.3077"
402- MSVCVER = 7.1
403- !endif
404- !if "$(_NMAKE_VER)" == "8.00.50727.42"
405- MSVCVER = 8.0
406- !endif
407- !if "$(_NMAKE_VER)" == "8.00.50727.762"
408- MSVCVER = 8.0
409- !endif
410- !if "$(_NMAKE_VER)" == "9.00.20706.01"
411- MSVCVER = 9.0
412- !endif
413- !if "$(_NMAKE_VER)" == "9.00.21022.08"
414- MSVCVER = 9.0
415- !endif
416- !if "$(_NMAKE_VER)" == "9.00.30729.01"
417- MSVCVER = 9.0
418- !endif
419- !if "$(_NMAKE_VER)" == "10.00.20506.01"
420- MSVCVER = 10.0
421- !endif
422- !if "$(_NMAKE_VER)" == "10.00.30128.01"
423- MSVCVER = 10.0
424- !endif
425- !if "$(_NMAKE_VER)" == "10.00.30319.01"
426- MSVCVER = 10.0
427- !endif
428- !if "$(_NMAKE_VER)" == "10.00.40219.01"
429- MSVCVER = 10.0
430- !endif
431- !if "$(_NMAKE_VER)" == "11.00.50727.1"
432- MSVCVER = 11.0
433- !endif
434- !if "$(_NMAKE_VER)" == "11.00.51106.1"
435- MSVCVER = 11.0
436- !endif
437- !if "$(_NMAKE_VER)" == "11.00.60315.1"
438- MSVCVER = 11.0
439- !endif
440- !if "$(_NMAKE_VER)" == "11.00.60610.1"
441- MSVCVER = 11.0
442- !endif
443- !if "$(_NMAKE_VER)" == "11.00.61030.0"
444- MSVCVER = 11.0
445- !endif
446- !if "$(_NMAKE_VER)" == "12.00.21005.1"
447- MSVCVER = 12.0
380+ !if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul]
381+ !message *** ERROR
382+ !message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH.
383+ !message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed.
384+ !error Make aborted.
385+ !else
386+ !include msvcver.~
387+ !if [del msvcver.c msvcver.~]
448388!endif
449- !if ("$(_NMAKE_VER)" == "14.00.22609.0") || ("$(_NMAKE_VER)" == "14.00.22816.0") || ("$(_NMAKE_VER)" == "14.00.23026.0")
450- MSVCVER = 14.0
451389!endif
390+
391+ !if $(MSVCVER) < 1900
392+ MSVC_MAJOR = ($(MSVCVER ) / 100 - 6)
393+ !else
394+ MSVC_MAJOR = ($(MSVCVER ) / 100 - 5)
452395!endif
453396
454- # Abort building VIM if version of VC is unrecognised.
455- !ifndef MSVCVER
456- !message *** ERROR
457- !message Cannot determine Visual C version being used. If you are using the
458- !message Windows SDK then you must have the environment variable MSVCVER set to
459- !message your version of the VC compiler. If you are not using the Express
460- !message version of Visual C, you can either set MSVCVER or update this makefile
461- !message to handle the new value for _NMAKE_VER, "$(_NMAKE_VER)".
462- !error Make aborted.
397+ !if $(MSVC_MAJOR) == 6
398+ CPU = ix86
463399!endif
464400
465401# Convert processor ID to MVC-compatible number
466- !if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != "10.0") && ("$(MSVCVER)" != "11.0") && ("$(MSVCVER)" != "12.0") && ("$(MSVCVER)" != "14.0")
402+ !if $(MSVC_MAJOR) < 8
467403!if "$(CPUNR)" == "i386"
468404CPUARG = /G3
469405!elseif "$(CPUNR)" == "i486"
@@ -488,7 +424,7 @@ LIBC =
488424DEBUGINFO = /Zi
489425
490426# Don't use /nodefaultlib on MSVC 14
491- !if "$(MSVCVER)" == "14.0"
427+ !if $(MSVC_MAJOR) >= 14
492428NODEFAULTLIB =
493429!else
494430NODEFAULTLIB = /nodefaultlib
@@ -504,20 +440,21 @@ OPTFLAG = /O2
504440OPTFLAG = /Ox
505441!endif
506442
507- !if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0")
443+ !if $(MSVC_MAJOR) >= 8
508444# Use link time code generation if not worried about size
509445!if "$(OPTIMIZE)" != "SPACE"
510446OPTFLAG = $(OPTFLAG ) /GL
511447!endif
512448!endif
513449
514450# (/Wp64 is deprecated in VC9 and generates an obnoxious warning.)
515- !if ("$(MSVCVER)" == "7.0" ) || ("$(MSVCVER)" == "7.1") || ("$(MSVCVER)" == "8.0")
451+ !if ($(MSVC_MAJOR) == 7 ) || ($(MSVC_MAJOR) == 8)
516452CFLAGS =$(CFLAGS ) $(WP64CHECK )
517453!endif
518454
519- # Static code analysis generally available starting with VS2012
520- !if ("$(ANALYZE)" == "yes") && (("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0"))
455+ # Static code analysis generally available starting with VS2012 (VC11) or
456+ # Windows SDK 7.1 (VC10)
457+ !if ("$(ANALYZE)" == "yes") && ($(MSVC_MAJOR) >= 10)
521458CFLAGS =$(CFLAGS ) /analyze
522459!endif
523460
@@ -538,7 +475,7 @@ DEBUGINFO = /ZI
538475CFLAGS = $(CFLAGS ) -D_DEBUG -DDEBUG /Od
539476RCFLAGS = $(rcflags ) $(rcvars ) -D_DEBUG -DDEBUG
540477# The /fixed:no is needed for Quantify. Assume not 4.? as unsupported in VC4.0.
541- ! if "$(MSVCVER)" == "4.0"
478+ ! if $(MSVC_MAJOR) == 4
542479LIBC =
543480! else
544481LIBC = /fixed:no
@@ -993,7 +930,7 @@ LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(NODEFAULTLIB) $(LIBC) $(OLE_LIB) user32.lib
993930
994931# Report link time code generation progress if used.
995932!ifdef NODEBUG
996- !if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0")
933+ !if $(MSVC_MAJOR) >= 8
997934!if "$(OPTIMIZE)" != "SPACE"
998935LINKARGS1 = $(LINKARGS1 ) /LTCG:STATUS
999936!endif
@@ -1090,7 +1027,7 @@ testclean:
10901027
10911028# Create a default rule for transforming .c files to .obj files in $(OUTDIR)
10921029# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
1093- !IF "$(MSVCVER )" == "4.0 "
1030+ !IF "$(_NMAKE_VER )" == ""
10941031.c{$(OUTDIR ) /}.obj :
10951032!ELSE
10961033.c{$(OUTDIR ) /}.obj ::
@@ -1099,7 +1036,7 @@ testclean:
10991036
11001037# Create a default rule for transforming .cpp files to .obj files in $(OUTDIR)
11011038# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
1102- !IF "$(MSVCVER )" == "4.0 "
1039+ !IF "$(_NMAKE_VER )" == ""
11031040.cpp{$(OUTDIR ) /}.obj :
11041041!ELSE
11051042.cpp{$(OUTDIR ) /}.obj ::
0 commit comments