summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Takata <kentkt@csc.jp>2024-08-03 14:40:35 +0200
committerChristian Brabandt <cb@256bit.org>2024-08-03 14:40:35 +0200
commit87d63d34b6f25611db9cc7c7a13d785574e8ec43 (patch)
tree5d7fadb0f656c05cb929e0b426c864d1dba3649d
parentcdf1c7a73ad84dd060a4151e166e1012d43d8766 (diff)
patch 9.1.0657: MS-Windows: MSVC build time can be optimizedv9.1.0657
Problem: MS-Windows: MSVC build time can be optimized Solution: Stop using Powershell, show detected version, read _MSC_VER and _MSC_FULL_VER in a single cl execution. (Ken Takata) closes: #15421 Signed-off-by: Ken Takata <kentkt@csc.jp> Signed-off-by: Christian Brabandt <cb@256bit.org>
-rw-r--r--src/Make_mvc.mak58
-rw-r--r--src/version.c2
2 files changed, 26 insertions, 34 deletions
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 65efe306a4..65a8798a99 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -163,14 +163,14 @@
# nmake -f Make_mvc.mvc "DEFINES=-DEMACS_TAGS"
RM = del /f /q
-PS = powershell.exe
-PSFLAGS = -NoLogo -NoProfile -Command
+# Read MAJOR and MINOR from version.h.
+!IF ![for /f "tokens=2,3" %I in (version.h) do \
+ @if "%I"=="VIM_VERSION_MAJOR" ( echo MAJOR=%J>.\major.tmp ) \
+ else if "%I"=="VIM_VERSION_MINOR" ( echo MINOR=%J>.\minor.tmp )]
+!ENDIF
-!IF ![$(PS) $(PSFLAGS) try{Out-File -FilePath '.\major.tmp' -InputObject \
- \"MAJOR=$$(((Select-String -Pattern 'VIM_VERSION_MAJOR\s+\d{1,2}' \
- -Path '.\version.h').Line[-2..-1^]-join '').Trim())\"} \
- catch{exit 1}]
+!IF EXIST(.\major.tmp)
! INCLUDE .\major.tmp
! IF [$(RM) .\major.tmp]
! ENDIF
@@ -179,10 +179,7 @@ PSFLAGS = -NoLogo -NoProfile -Command
MAJOR = 9
!ENDIF
-!IF ![$(PS) $(PSFLAGS) try{Out-File -FilePath '.\minor.tmp' -InputObject \
- \"MINOR=$$(((Select-String -Pattern 'VIM_VERSION_MINOR\s+\d{1,2}' \
- -Path '.\version.h').Line[-2..-1^]-join '').Trim())\"} \
- catch{exit 1}]
+!IF EXIST(.\minor.tmp)
! INCLUDE .\minor.tmp
! IF [$(RM) .\minor.tmp]
! ENDIF
@@ -191,24 +188,23 @@ MAJOR = 9
MINOR = 1
!ENDIF
-!IF ![$(PS) $(PSFLAGS) try{Out-File -FilePath '.\patchlvl.tmp' -InputObject \
- \"PATCHLEVEL=$$([decimal^]((Get-Content -Path '.\version.c' \
- -TotalCount ((Select-String -Pattern 'static int included_patches' \
- -Path '.\version.c').LineNumber+3))[-1^]).Trim().TrimEnd(','))\"} \
- catch{exit 1}]
+# Read PATCHLEVEL from version.c.
+!IF ![cmd.exe /V:ON /C "echo off && set LINE=0&& set FIND=0&& \
+ for /f "tokens=1,3 delims=,[ " %I in (version.c) do \
+ ( set /A LINE+=1 > NUL && \
+ if "%J"=="included_patches" ( set /A FIND=LINE+3 > NUL ) \
+ else if "!LINE!"=="!FIND!" ( echo PATCHLEVEL=%I>.\patchlvl.tmp && exit ) )"]
+!ENDIF
+!IF EXIST(.\patchlvl.tmp)
! INCLUDE .\patchlvl.tmp
! IF [$(RM) .\patchlvl.tmp]
! ENDIF
!ENDIF
-
-# Build on Windows NT/XP
-
-TARGETOS = WINNT
-
!IFDEF PATCHLEVEL
RCFLAGS = -DVIM_VERSION_PATCHLEVEL=$(PATCHLEVEL)
!ENDIF
+!message Vim version: $(MAJOR).$(MINOR).$(PATCHLEVEL)
!if "$(VIMDLL)" == "yes"
@@ -299,7 +295,9 @@ MAKEFLAGS_GVIMEXT = DEBUG=yes
LINK = link
# Check VC version.
-!if [echo MSVCVER=_MSC_VER> msvcver.c && $(CC) /EP msvcver.c > msvcver.~ 2> nul]
+!if [echo MSVCVER=_MSC_VER> msvcver.c && \
+ echo MSVC_FULL=_MSC_FULL_VER>> msvcver.c && \
+ $(CC) /EP msvcver.c > msvcver.~ 2> nul]
! message *** ERROR
! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH.
! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed.
@@ -320,19 +318,6 @@ LINK = link
MSVC_MAJOR = ($(MSVCVER) / 100 - 5)
MSVCRT_VER = ($(MSVCVER) / 100 * 10 - 50)
-# Calculate MSVC_FULL.
-!if [echo MSVC_FULL=_MSC_FULL_VER> msvcfullver.c && $(CC) /EP msvcfullver.c > msvcfullver.~ 2> nul]
-! message *** ERROR
-! message Cannot run Visual C to determine its version. Make sure cl.exe is in your PATH.
-! message This can usually be done by running "vcvarsall.bat", located in the bin directory where Visual Studio was installed.
-! error Make aborted.
-!else
-! include msvcfullver.~
-! if [del msvcfullver.c msvcfullver.~]
-! endif
-!endif
-
-
# Calculate MSVCRT_VER
!if [(set /a MSVCRT_VER="$(MSVCRT_VER)" > nul) && set MSVCRT_VER > msvcrtver.~] == 0
! include msvcrtver.~
@@ -340,6 +325,11 @@ MSVCRT_VER = ($(MSVCVER) / 100 * 10 - 50)
! endif
!endif
+# Show the versions (for debugging).
+#!message _MSC_VER=$(MSVCVER)
+#!message _MSC_FULL_VER=$(MSVC_FULL)
+#!message MSVCRT_VER=$(MSVCRT_VER)
+
# Base name of the msvcrXX.dll (vcruntimeXXX.dll)
MSVCRT_NAME = vcruntime$(MSVCRT_VER)
diff --git a/src/version.c b/src/version.c
index 4a985b9100..c36aa51197 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 657,
+/**/
656,
/**/
655,