comparison src/Make_mvc.mak @ 7309:c412b0922c27 v7.4.960

commit https://github.com/vim/vim/commit/90f5d0a5c3bbfeefcbc4d6eac59cf225ec714b28 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 3 22:37:21 2015 +0100 patch 7.4.960 Problem: Detecting every version of nmake is clumsy. Solution: Use a tiny C program to get the version of _MSC_VER. (Ken Takata)
author Christian Brabandt <cb@256bit.org>
date Thu, 03 Dec 2015 22:45:04 +0100
parents 98d1d53edc66
children a3b8a63c88ef
comparison
equal deleted inserted replaced
7308:8ccc46a81ecb 7309:c412b0922c27
114 # yes: Write a normal mapfile. 114 # yes: Write a normal mapfile.
115 # lines: Write a mapfile with line numbers (only for VC6 and later) 115 # lines: Write a mapfile with line numbers (only for VC6 and later)
116 # 116 #
117 # Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes 117 # Netbeans Debugging Support: NBDEBUG=[yes or no] (should be no, yes
118 # doesn't work) 118 # doesn't work)
119 #
120 # Visual C Version: MSVCVER=m.n (default derived from nmake if undefined)
121 # 119 #
122 # Static Code Analysis: ANALYZE=yes (works with VS2012 only) 120 # Static Code Analysis: ANALYZE=yes (works with VS2012 only)
123 # 121 #
124 # You can combine any of these interfaces 122 # You can combine any of these interfaces
125 # 123 #
377 !endif 375 !endif
378 376
379 INTDIR=$(OBJDIR) 377 INTDIR=$(OBJDIR)
380 OUTDIR=$(OBJDIR) 378 OUTDIR=$(OBJDIR)
381 379
382 # Derive version of VC being used from nmake if not specified 380 !if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul]
383 !if "$(MSVCVER)" == "" 381 !message *** ERROR
384 !if "$(_NMAKE_VER)" == "" 382 !message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH.
385 MSVCVER = 4.0 383 !message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed.
386 !endif 384 !error Make aborted.
387 !if "$(_NMAKE_VER)" == "162" 385 !else
388 MSVCVER = 5.0 386 !include msvcver.~
389 !endif 387 !if [del msvcver.c msvcver.~]
390 !if "$(_NMAKE_VER)" == "6.00.8168.0" 388 !endif
391 MSVCVER = 6.0 389 !endif
390
391 !if $(MSVCVER) < 1900
392 MSVC_MAJOR = ($(MSVCVER) / 100 - 6)
393 !else
394 MSVC_MAJOR = ($(MSVCVER) / 100 - 5)
395 !endif
396
397 !if $(MSVC_MAJOR) == 6
392 CPU = ix86 398 CPU = ix86
393 !endif 399 !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
448 !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
451 !endif
452 !endif
453
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.
463 !endif
464 400
465 # Convert processor ID to MVC-compatible number 401 # 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
467 !if "$(CPUNR)" == "i386" 403 !if "$(CPUNR)" == "i386"
468 CPUARG = /G3 404 CPUARG = /G3
469 !elseif "$(CPUNR)" == "i486" 405 !elseif "$(CPUNR)" == "i486"
470 CPUARG = /G4 406 CPUARG = /G4
471 !elseif "$(CPUNR)" == "i586" 407 !elseif "$(CPUNR)" == "i586"
486 422
487 LIBC = 423 LIBC =
488 DEBUGINFO = /Zi 424 DEBUGINFO = /Zi
489 425
490 # Don't use /nodefaultlib on MSVC 14 426 # Don't use /nodefaultlib on MSVC 14
491 !if "$(MSVCVER)" == "14.0" 427 !if $(MSVC_MAJOR) >= 14
492 NODEFAULTLIB = 428 NODEFAULTLIB =
493 !else 429 !else
494 NODEFAULTLIB = /nodefaultlib 430 NODEFAULTLIB = /nodefaultlib
495 !endif 431 !endif
496 432
502 OPTFLAG = /O2 438 OPTFLAG = /O2
503 !else # MAXSPEED 439 !else # MAXSPEED
504 OPTFLAG = /Ox 440 OPTFLAG = /Ox
505 !endif 441 !endif
506 442
507 !if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0") 443 !if $(MSVC_MAJOR) >= 8
508 # Use link time code generation if not worried about size 444 # Use link time code generation if not worried about size
509 !if "$(OPTIMIZE)" != "SPACE" 445 !if "$(OPTIMIZE)" != "SPACE"
510 OPTFLAG = $(OPTFLAG) /GL 446 OPTFLAG = $(OPTFLAG) /GL
511 !endif 447 !endif
512 !endif 448 !endif
513 449
514 # (/Wp64 is deprecated in VC9 and generates an obnoxious warning.) 450 # (/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)
516 CFLAGS=$(CFLAGS) $(WP64CHECK) 452 CFLAGS=$(CFLAGS) $(WP64CHECK)
517 !endif 453 !endif
518 454
519 # Static code analysis generally available starting with VS2012 455 # Static code analysis generally available starting with VS2012 (VC11) or
520 !if ("$(ANALYZE)" == "yes") && (("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0")) 456 # Windows SDK 7.1 (VC10)
457 !if ("$(ANALYZE)" == "yes") && ($(MSVC_MAJOR) >= 10)
521 CFLAGS=$(CFLAGS) /analyze 458 CFLAGS=$(CFLAGS) /analyze
522 !endif 459 !endif
523 460
524 CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG $(CPUARG) 461 CFLAGS = $(CFLAGS) $(OPTFLAG) -DNDEBUG $(CPUARG)
525 RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG 462 RCFLAGS = $(rcflags) $(rcvars) -DNDEBUG
536 DEBUGINFO = /ZI 473 DEBUGINFO = /ZI
537 ! endif 474 ! endif
538 CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Od 475 CFLAGS = $(CFLAGS) -D_DEBUG -DDEBUG /Od
539 RCFLAGS = $(rcflags) $(rcvars) -D_DEBUG -DDEBUG 476 RCFLAGS = $(rcflags) $(rcvars) -D_DEBUG -DDEBUG
540 # The /fixed:no is needed for Quantify. Assume not 4.? as unsupported in VC4.0. 477 # 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
542 LIBC = 479 LIBC =
543 ! else 480 ! else
544 LIBC = /fixed:no 481 LIBC = /fixed:no
545 ! endif 482 ! endif
546 ! ifdef USE_MSVCRT 483 ! ifdef USE_MSVCRT
991 $(LUA_LIB) $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(PYTHON3_LIB) $(RUBY_LIB) \ 928 $(LUA_LIB) $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(PYTHON3_LIB) $(RUBY_LIB) \
992 $(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB) 929 $(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
993 930
994 # Report link time code generation progress if used. 931 # Report link time code generation progress if used.
995 !ifdef NODEBUG 932 !ifdef NODEBUG
996 !if ("$(MSVCVER)" == "8.0") || ("$(MSVCVER)" == "9.0") || ("$(MSVCVER)" == "10.0") || ("$(MSVCVER)" == "11.0") || ("$(MSVCVER)" == "12.0") 933 !if $(MSVC_MAJOR) >= 8
997 !if "$(OPTIMIZE)" != "SPACE" 934 !if "$(OPTIMIZE)" != "SPACE"
998 LINKARGS1 = $(LINKARGS1) /LTCG:STATUS 935 LINKARGS1 = $(LINKARGS1) /LTCG:STATUS
999 !endif 936 !endif
1000 !endif 937 !endif
1001 !endif 938 !endif
1088 1025
1089 ########################################################################### 1026 ###########################################################################
1090 1027
1091 # Create a default rule for transforming .c files to .obj files in $(OUTDIR) 1028 # Create a default rule for transforming .c files to .obj files in $(OUTDIR)
1092 # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later) 1029 # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
1093 !IF "$(MSVCVER)" == "4.0" 1030 !IF "$(_NMAKE_VER)" == ""
1094 .c{$(OUTDIR)/}.obj: 1031 .c{$(OUTDIR)/}.obj:
1095 !ELSE 1032 !ELSE
1096 .c{$(OUTDIR)/}.obj:: 1033 .c{$(OUTDIR)/}.obj::
1097 !ENDIF 1034 !ENDIF
1098 $(CC) $(CFLAGS) $< 1035 $(CC) $(CFLAGS) $<
1099 1036
1100 # Create a default rule for transforming .cpp files to .obj files in $(OUTDIR) 1037 # Create a default rule for transforming .cpp files to .obj files in $(OUTDIR)
1101 # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later) 1038 # Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
1102 !IF "$(MSVCVER)" == "4.0" 1039 !IF "$(_NMAKE_VER)" == ""
1103 .cpp{$(OUTDIR)/}.obj: 1040 .cpp{$(OUTDIR)/}.obj:
1104 !ELSE 1041 !ELSE
1105 .cpp{$(OUTDIR)/}.obj:: 1042 .cpp{$(OUTDIR)/}.obj::
1106 !ENDIF 1043 !ENDIF
1107 $(CC) $(CFLAGS) $< 1044 $(CC) $(CFLAGS) $<