]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/make.bat
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / src / make.bat
index 56da417dd1c47195b2d5de685c2230bb2dca1e7c..d9f9b6cb6aa252e7d695a9e94c8efd529587641e 100644 (file)
 \r
 :: Keep environment variables within this script\r
 :: unless invoked with --no-local.\r
+if x%1==x-no-local goto nolocal\r
+if x%2==x-no-local goto nolocal\r
+if x%3==x-no-local goto nolocal\r
+if x%4==x-no-local goto nolocal\r
 if x%1==x--no-local goto nolocal\r
 if x%2==x--no-local goto nolocal\r
 if x%3==x--no-local goto nolocal\r
@@ -46,11 +50,7 @@ if x%4==x--no-local goto nolocal
 setlocal\r
 :nolocal\r
 \r
-set GOENV=off\r
-set GOWORK=off\r
 set GOBUILDFAIL=0\r
-set GOFLAGS=\r
-set GO111MODULE=\r
 \r
 if exist make.bat goto ok\r
 echo Must run make.bat from Go src directory.\r
@@ -77,15 +77,20 @@ if not exist ..\bin\tool mkdir ..\bin\tool
 if not "x%GOROOT_BOOTSTRAP%"=="x" goto bootstrapset\r
 for /f "tokens=*" %%g in ('where go 2^>nul') do (\r
        if "x%GOROOT_BOOTSTRAP%"=="x" (\r
-               for /f "tokens=*" %%i in ('%%g env GOROOT 2^>nul') do (\r
+               setlocal\r
+               call :nogoenv\r
+               for /f "tokens=*" %%i in ('"%%g" env GOROOT 2^>nul') do (\r
+                       endlocal\r
                        if /I not "%%i"=="%GOROOT_TEMP%" (\r
                                set GOROOT_BOOTSTRAP=%%i\r
                        )\r
                )\r
        )\r
 )\r
-if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\go1.17" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\go1.17\r
-if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\sdk\go1.17" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\sdk\go1.17\r
+\r
+set bootgo=1.20.6\r
+if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\go%bootgo%" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\go%bootgo%\r
+if "x%GOROOT_BOOTSTRAP%"=="x" if exist "%HOMEDRIVE%%HOMEPATH%\sdk\go%bootgo%" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\sdk\go%bootgo%\r
 if "x%GOROOT_BOOTSTRAP%"=="x" set GOROOT_BOOTSTRAP=%HOMEDRIVE%%HOMEPATH%\Go1.4\r
 \r
 :bootstrapset\r
@@ -93,45 +98,65 @@ if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail
 set GOROOT=%GOROOT_TEMP%\r
 set GOROOT_TEMP=\r
 \r
-echo Building Go cmd/dist using %GOROOT_BOOTSTRAP%\r
-if x%vflag==x-v echo cmd/dist\r
 setlocal\r
+call :nogoenv\r
+for /f "tokens=*" %%g IN ('"%GOROOT_BOOTSTRAP%\bin\go" version') do (set GOROOT_BOOTSTRAP_VERSION=%%g)\r
+set GOROOT_BOOTSTRAP_VERSION=%GOROOT_BOOTSTRAP_VERSION:go version =%\r
+echo Building Go cmd/dist using %GOROOT_BOOTSTRAP%. (%GOROOT_BOOTSTRAP_VERSION%)\r
+if x%vflag==x-v echo cmd/dist\r
 set GOROOT=%GOROOT_BOOTSTRAP%\r
-set GOOS=\r
-set GOARCH=\r
 set GOBIN=\r
-set GO111MODULE=off\r
 "%GOROOT_BOOTSTRAP%\bin\go.exe" build -o cmd\dist\dist.exe .\cmd\dist\r
 endlocal\r
 if errorlevel 1 goto fail\r
 .\cmd\dist\dist.exe env -w -p >env.bat\r
 if errorlevel 1 goto fail\r
-call env.bat\r
+call .\env.bat\r
 del env.bat\r
 if x%vflag==x-v echo.\r
 \r
+if x%1==x-dist-tool goto copydist\r
+if x%2==x-dist-tool goto copydist\r
+if x%3==x-dist-tool goto copydist\r
+if x%4==x-dist-tool goto copydist\r
 if x%1==x--dist-tool goto copydist\r
 if x%2==x--dist-tool goto copydist\r
 if x%3==x--dist-tool goto copydist\r
 if x%4==x--dist-tool goto copydist\r
 \r
 set bootstrapflags=\r
-if x%1==x--no-clean set bootstrapflags=--no-clean\r
-if x%2==x--no-clean set bootstrapflags=--no-clean\r
-if x%3==x--no-clean set bootstrapflags=--no-clean\r
-if x%4==x--no-clean set bootstrapflags=--no-clean\r
-if x%1==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner\r
-if x%2==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner\r
-if x%3==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner\r
-if x%4==x--no-banner set bootstrapflags=%bootstrapflags% --no-banner\r
+if x%1==x-no-clean set bootstrapflags=-no-clean\r
+if x%2==x-no-clean set bootstrapflags=-no-clean\r
+if x%3==x-no-clean set bootstrapflags=-no-clean\r
+if x%4==x-no-clean set bootstrapflags=-no-clean\r
+if x%1==x--no-clean set bootstrapflags=-no-clean\r
+if x%2==x--no-clean set bootstrapflags=-no-clean\r
+if x%3==x--no-clean set bootstrapflags=-no-clean\r
+if x%4==x--no-clean set bootstrapflags=-no-clean\r
+if x%1==x-no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%2==x-no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%3==x-no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%4==x-no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%1==x--no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%2==x--no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%3==x--no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%4==x--no-banner set bootstrapflags=%bootstrapflags% -no-banner\r
+if x%1==x-distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%2==x-distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%3==x-distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%4==x-distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%1==x--distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%2==x--distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%3==x--distpack set bootstrapflags=%bootstrapflags% -distpack\r
+if x%4==x--distpack set bootstrapflags=%bootstrapflags% -distpack\r
 \r
 :: Run dist bootstrap to complete make.bash.\r
 :: Bootstrap installs a proper cmd/dist, built with the new toolchain.\r
-:: Throw ours, built with Go 1.4, away after bootstrap.\r
+:: Throw ours, built with the bootstrap toolchain, away after bootstrap.\r
 .\cmd\dist\dist.exe bootstrap -a %vflag% %bootstrapflags%\r
 if errorlevel 1 goto fail\r
 del .\cmd\dist\dist.exe\r
-goto end\r
+goto :eof\r
 \r
 :: DO NOT ADD ANY NEW CODE HERE.\r
 :: The bootstrap+del above are the final step of make.bat.\r
@@ -142,14 +167,21 @@ goto end
 :copydist\r
 mkdir "%GOTOOLDIR%" 2>NUL\r
 copy cmd\dist\dist.exe "%GOTOOLDIR%\"\r
-goto end\r
+goto :eof\r
+\r
+:nogoenv\r
+set GO111MODULE=off\r
+set GOENV=off\r
+set GOOS=\r
+set GOARCH=\r
+set GOEXPERIMENT=\r
+set GOFLAGS=\r
+goto :eof\r
 \r
 :bootstrapfail\r
 echo ERROR: Cannot find %GOROOT_BOOTSTRAP%\bin\go.exe\r
-echo Set GOROOT_BOOTSTRAP to a working Go tree ^>= Go 1.4.\r
+echo Set GOROOT_BOOTSTRAP to a working Go tree ^>= Go %bootgo%.\r
 \r
 :fail\r
 set GOBUILDFAIL=1\r
 if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%\r
-\r
-:end\r