comparison src/Make_mvc.mak @ 11510:deb9295dccda v8.0.0638

patch 8.0.0638: cannot build with new MSVC version commit https://github.com/vim/vim/commit/d7383881c8e9f474a909b54b21abb0aa2b412ba2 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jun 13 15:22:12 2017 +0200 patch 8.0.0638: cannot build with new MSVC version Problem: Cannot build with new MSVC version VS2017. Solution: Change the compiler arguments. (Leonardo Manera, closes https://github.com/vim/vim/issues/1731, closes #1747)
author Christian Brabandt <cb@256bit.org>
date Tue, 13 Jun 2017 15:30:03 +0200
parents 9b2073149118
children 0a6136dfce35
comparison
equal deleted inserted replaced
11509:408e0db898d9 11510:deb9295dccda
1 # Makefile for Vim on Win32 (Windows XP/2003/Vista/7/8/10) and Win64, 1 # Makefile for Vim on Win32 (Windows XP/2003/Vista/7/8/10) and Win64,
2 # using the Microsoft Visual C++ compilers. Known to work with VC5, VC6 (VS98), 2 # using the Microsoft Visual C++ compilers. Known to work with VC5, VC6 (VS98),
3 # VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), VC9 (VS2008), VC10 (VS2010), 3 # VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), VC9 (VS2008), VC10 (VS2010),
4 # VC11 (VS2012), VC12 (VS2013) and VC14 (VS2015) 4 # VC11 (VS2012), VC12 (VS2013), VC14 (VS2015) and VC15 (VS2017)
5 # 5 #
6 # To build using other Windows compilers, see INSTALLpc.txt 6 # To build using other Windows compilers, see INSTALLpc.txt
7 # 7 #
8 # This makefile can build the console, GUI, OLE-enable, Perl-enabled and 8 # This makefile can build the console, GUI, OLE-enable, Perl-enabled and
9 # Python-enabled versions of Vim for Win32 platforms. 9 # Python-enabled versions of Vim for Win32 platforms.
106 # Default is "xpm", using the files included in the distribution. 106 # Default is "xpm", using the files included in the distribution.
107 # Use "no" to disable this feature. 107 # Use "no" to disable this feature.
108 # 108 #
109 # Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED) 109 # Optimization: OPTIMIZE=[SPACE, SPEED, MAXSPEED] (default is MAXSPEED)
110 # 110 #
111 # Processor Version: CPUNR=[i386, i486, i586, i686, pentium4] (default is 111 # Processor Version: CPUNR=[any, i586, i686, sse, sse2, avx, avx2] (default is
112 # i386) 112 # any)
113 # 113 # avx is available on Visual C++ 2010 and after.
114 # Version Support: WINVER=[0x0501, 0x0600] (default is 0x0501) 114 # avx2 is available on Visual C++ 2013 Update 2 and after.
115 #
116 # Version Support: WINVER=[0x0501, 0x0502, 0x0600, 0x0601, 0x0602,
117 # 0x0603, 0x0A00] (default is 0x0501)
118 # Supported versions depends on your target SDK, check SDKDDKVer.h
119 # See https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
115 # 120 #
116 # Debug version: DEBUG=yes 121 # Debug version: DEBUG=yes
117 # Mapfile: MAP=[no, yes or lines] (default is yes) 122 # Mapfile: MAP=[no, yes or lines] (default is yes)
118 # no: Don't write a mapfile. 123 # no: Don't write a mapfile.
119 # yes: Write a normal mapfile. 124 # yes: Write a normal mapfile.
268 !endif 273 !endif
269 274
270 !if $(MSVCVER) < 1900 275 !if $(MSVCVER) < 1900
271 MSVC_MAJOR = ($(MSVCVER) / 100 - 6) 276 MSVC_MAJOR = ($(MSVCVER) / 100 - 6)
272 MSVCRT_VER = ($(MSVCVER) / 10 - 60) 277 MSVCRT_VER = ($(MSVCVER) / 10 - 60)
278 # Visual C++ 2017 needs special handling
279 # it has an _MSC_VER of 1910->14.1, but is actually v15 with runtime v140
280 !elseif $(MSVCVER) == 1910
281 MSVC_MAJOR = 15
282 MSVCRT_VER = 140
273 !else 283 !else
274 MSVC_MAJOR = ($(MSVCVER) / 100 - 5) 284 MSVC_MAJOR = ($(MSVCVER) / 100 - 5)
275 MSVCRT_VER = ($(MSVCVER) / 10 - 50) 285 MSVCRT_VER = ($(MSVCVER) / 10 - 50)
276 !endif 286 !endif
287
288 # Calculate MSVC_FULL for Visual C++ 8 and up.
289 !if $(MSVC_MAJOR) >= 8
290 ! if [echo MSVC_FULL=_MSC_FULL_VER> msvcfullver.c && $(CC) /EP msvcfullver.c > msvcfullver.~ 2> nul]
291 ! message *** ERROR
292 ! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH.
293 ! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed.
294 ! error Make aborted.
295 ! else
296 ! include msvcfullver.~
297 ! if [del msvcfullver.c msvcfullver.~]
298 ! endif
299 ! endif
300 !endif
301
277 302
278 # Calculate MSVCRT_VER 303 # Calculate MSVCRT_VER
279 !if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0 304 !if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0
280 !include msvcrtver.~ 305 !include msvcrtver.~
281 !if [del msvcrtver.~] 306 !if [del msvcrtver.~]
444 DEL_TREE = rmdir /s /q 469 DEL_TREE = rmdir /s /q
445 470
446 INTDIR=$(OBJDIR) 471 INTDIR=$(OBJDIR)
447 OUTDIR=$(OBJDIR) 472 OUTDIR=$(OBJDIR)
448 473
474 ### Validate CPUNR
475 !ifndef CPUNR
476 # default to untargeted code
477 CPUNR = any
478 !elseif "$(CPUNR)" == "i386" || "$(CPUNR)" == "i486"
479 # alias i386 and i486 to i586
480 ! message *** WARNING CPUNR=$(CPUNR) is not a valid target architecture.
481 ! message Windows XP is the minimum target OS, with a minimum target
482 ! message architecture of i586.
483 ! message Retargeting to i586
484 CPUNR = i586
485 !elseif "$(CPUNR)" == "pentium4"
486 # alias pentium4 to sse2
487 ! message *** WARNING CPUNR=pentium4 is deprecated in favour of sse2.
488 ! message Retargeting to sse2.
489 CPUNR = sse2
490 !elseif "$(CPUNR)" != "any" && "$(CPUNR)" != "i586" && "$(CPUNR)" != "i686" && "$(CPUNR)" != "sse" && "$(CPUNR)" != "sse2" && "$(CPUNR)" != "avx" && "$(CPUNR)" != "avx2"
491 ! error *** ERROR Unknown target architecture "$(CPUNR)". Make aborted.
492 !endif
493
449 # Convert processor ID to MVC-compatible number 494 # Convert processor ID to MVC-compatible number
450 !if $(MSVC_MAJOR) < 8 495 !if $(MSVC_MAJOR) < 8
451 !if "$(CPUNR)" == "i386" 496 ! if "$(CPUNR)" == "i586"
452 CPUARG = /G3
453 !elseif "$(CPUNR)" == "i486"
454 CPUARG = /G4
455 !elseif "$(CPUNR)" == "i586"
456 CPUARG = /G5 497 CPUARG = /G5
457 !elseif "$(CPUNR)" == "i686" 498 ! elseif "$(CPUNR)" == "i686"
458 CPUARG = /G6 499 CPUARG = /G6
459 !elseif "$(CPUNR)" == "pentium4" 500 ! elseif "$(CPUNR)" == "sse"
501 CPUARG = /G6 /arch:SSE
502 ! elseif "$(CPUNR)" == "sse2"
460 CPUARG = /G7 /arch:SSE2 503 CPUARG = /G7 /arch:SSE2
461 !else 504 ! elseif "$(CPUNR)" == "avx" || "$(CPUNR)" == "avx2"
505 ! message AVX/AVX2 Instruction Sets are not supported by Visual C++ v$(MSVC_MAJOR)
506 ! message Falling back to SSE2
507 CPUARG = /G7 /arch:SSE2
508 ! elseif "$(CPUNR)" == "any"
462 CPUARG = 509 CPUARG =
463 !endif 510 ! endif
464 !else 511 !else
465 # VC8/9/10 only allows specifying SSE architecture but only for 32bit 512 # IA32/SSE/SSE2 are only supported on x86
466 !if "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "pentium4" 513 ! if "$(ASSEMBLY_ARCHITECTURE)" == "i386" && ("$(CPUNR)" == "i586" || "$(CPUNR)" == "i686" || "$(CPUNR)" == "any")
514 # VC<11 generates fp87 code by default
515 ! if $(MSVC_MAJOR) < 11
516 CPUARG =
517 # VC>=11 needs explicit insturctions to generate fp87 code
518 ! else
519 CPUARG = /arch:IA32
520 ! endif
521 ! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse"
522 CPUARG = /arch:SSE
523 ! elseif "$(ASSEMBLY_ARCHITECTURE)" == "i386" && "$(CPUNR)" == "sse2"
467 CPUARG = /arch:SSE2 524 CPUARG = /arch:SSE2
468 !endif 525 ! elseif "$(CPUNR)" == "avx"
469 !endif 526 # AVX is only supported by VC 10 and up
527 ! if $(MSVC_MAJOR) < 10
528 ! message AVX Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)
529 ! if "$(ASSEMBLY_ARCHITECTURE)" == "i386"
530 ! message Falling back to SSE2
531 CPUARG = /arch:SSE2
532 ! else
533 CPUARG =
534 ! endif
535 ! else
536 CPUARG = /arch:AVX
537 ! endif
538 ! elseif "$(CPUNR)" == "avx2"
539 # AVX is only supported by VC 10 and up
540 ! if $(MSVC_MAJOR) < 10
541 ! message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)
542 ! if "$(ASSEMBLY_ARCHITECTURE)" == "i386"
543 ! message Falling back to SSE2
544 CPUARG = /arch:SSE2
545 ! else
546 CPUARG =
547 ! endif
548 # AVX2 is only supported by VC 12U2 and up
549 # 180030501 is the full version number for Visual Studio 2013/VC 12 Update 2
550 ! elseif $(MSVC_FULL) < 180030501
551 ! message AVX2 Instruction Set is not supported by Visual C++ v$(MSVC_MAJOR)-$(MSVC_FULL)
552 ! message Falling back to AVX
553 CPUARG = /arch:AVX
554 ! else
555 CPUARG = /arch:AVX2
556 ! endif
557 ! endif
558 !endif
559
560 # Pass CPUARG to GVimExt, to avoid using version-dependent defaults
561 MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) CPUARG="$(CPUARG)"
562
470 563
471 LIBC = 564 LIBC =
472 DEBUGINFO = /Zi 565 DEBUGINFO = /Zi
473 566
474 # Don't use /nodefaultlib on MSVC 14 567 # Don't use /nodefaultlib on MSVC 14