]> 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 23b799e364c75a4c5b1a1b93877e97442b9fd1e3..d9f9b6cb6aa252e7d695a9e94c8efd529587641e 100644 (file)
-:: Copyright 2012 The Go Authors. All rights reserved.
-:: Use of this source code is governed by a BSD-style
-:: license that can be found in the LICENSE file.
-
-:: Environment variables that control make.bat:
-::
-:: GOROOT_FINAL: The expected final Go root, baked into binaries.
-:: The default is the location of the Go tree during the build.
-::
-:: GOHOSTARCH: The architecture for host tools (compilers and
-:: binaries).  Binaries of this type must be executable on the current
-:: system, so the only common reason to set this is to set
-:: GOHOSTARCH=386 on an amd64 machine.
-::
-:: GOARCH: The target architecture for installed packages and tools.
-::
-:: GOOS: The target operating system for installed packages and tools.
-::
-:: GO_GCFLAGS: Additional 5g/6g/8g arguments to use when
-:: building the packages and commands.
-::
-:: GO_LDFLAGS: Additional 5l/6l/8l arguments to use when
-:: building the commands.
-::
-:: CGO_ENABLED: Controls cgo usage during the build. Set it to 1
-:: to include all cgo related files, .c and .go file with "cgo"
-:: build directive, in the build. Set it to 0 to ignore them.
-
-@echo off
-
-:: Keep environment variables within this script
-:: unless invoked with --no-local.
-if x%1==x--no-local goto nolocal
-if x%2==x--no-local goto nolocal
-setlocal
-:nolocal
-
-set GOBUILDFAIL=0
-
-if exist make.bat goto ok
-echo Must run make.bat from Go src directory.
-goto fail 
-:ok
-
-:: Clean old generated file that will cause problems in the build.
-del /F ".\pkg\runtime\runtime_defs.go" 2>NUL
-
-:: Grab default GOROOT_FINAL and set GOROOT for build.
-:: The expression %VAR:\=\\% means to take %VAR%
-:: and apply the substitution \ = \\, escaping the
-:: backslashes.  Then we wrap that in quotes to create
-:: a C string.
-cd ..
-set GOROOT=%CD%
-cd src
-if "x%GOROOT_FINAL%"=="x" set GOROOT_FINAL=%GOROOT%
-set DEFGOROOT=-DGOROOT_FINAL="\"%GOROOT_FINAL:\=\\%\""
-
-echo # Building C bootstrap tool.
-echo cmd/dist
-if not exist ..\bin\tool mkdir ..\bin\tool
-:: Windows has no glob expansion, so spell out cmd/dist/*.c.
-gcc -O2 -Wall -Werror -o cmd/dist/dist.exe -Icmd/dist %DEFGOROOT% cmd/dist/buf.c cmd/dist/build.c cmd/dist/buildgc.c cmd/dist/buildgo.c cmd/dist/buildruntime.c cmd/dist/goc2c.c cmd/dist/main.c cmd/dist/windows.c cmd/dist/arm.c
-if errorlevel 1 goto fail
-.\cmd\dist\dist env -wp >env.bat
-if errorlevel 1 goto fail
-call env.bat
-del env.bat
-echo.
-
-if x%1==x--dist-tool goto copydist
-if x%2==x--dist-tool goto copydist
-
-echo # Building compilers and Go bootstrap tool.
-set buildall=-a
-if x%1==x--no-clean set buildall=
-.\cmd\dist\dist bootstrap %buildall% -v
-if errorlevel 1 goto fail
-:: Delay move of dist tool to now, because bootstrap cleared tool directory.
-move .\cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe"
-"%GOTOOLDIR%\go_bootstrap" clean -i std
-echo.
-
-if not %GOHOSTARCH% == %GOARCH% goto localbuild
-if not %GOHOSTOS% == %GOOS% goto localbuild
-goto mainbuild
-
-:localbuild
-echo # Building tools for local system. %GOHOSTOS%/%GOHOSTARCH%
-setlocal
-set GOOS=%GOHOSTOS%
-set GOARCH=%GOHOSTARCH%
-"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -v std
-endlocal
-if errorlevel 1 goto fail
-echo.
-
-:mainbuild
-echo # Building packages and commands.
-"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -a -v std
-if errorlevel 1 goto fail
-del "%GOTOOLDIR%\go_bootstrap.exe"
-echo.
-
-if x%1==x--no-banner goto nobanner
-"%GOTOOLDIR%\dist" banner
-:nobanner
-
-goto end
-
-:copydist
-mkdir "%GOTOOLDIR%" 2>NUL
-copy cmd\dist\dist.exe "%GOTOOLDIR%\"
-goto end
-
-:fail
-set GOBUILDFAIL=1
-
-:end
+:: Copyright 2012 The Go Authors. All rights reserved.\r
+:: Use of this source code is governed by a BSD-style\r
+:: license that can be found in the LICENSE file.\r
+\r
+:: Environment variables that control make.bat:\r
+::\r
+:: GOROOT_FINAL: The expected final Go root, baked into binaries.\r
+:: The default is the location of the Go tree during the build.\r
+::\r
+:: GOHOSTARCH: The architecture for host tools (compilers and\r
+:: binaries).  Binaries of this type must be executable on the current\r
+:: system, so the only common reason to set this is to set\r
+:: GOHOSTARCH=386 on an amd64 machine.\r
+::\r
+:: GOARCH: The target architecture for installed packages and tools.\r
+::\r
+:: GOOS: The target operating system for installed packages and tools.\r
+::\r
+:: GO_GCFLAGS: Additional go tool compile arguments to use when\r
+:: building the packages and commands.\r
+::\r
+:: GO_LDFLAGS: Additional go tool link arguments to use when\r
+:: building the commands.\r
+::\r
+:: CGO_ENABLED: Controls cgo usage during the build. Set it to 1\r
+:: to include all cgo related files, .c and .go file with "cgo"\r
+:: build directive, in the build. Set it to 0 to ignore them.\r
+::\r
+:: CC: Command line to run to compile C code for GOHOSTARCH.\r
+:: Default is "gcc".\r
+::\r
+:: CC_FOR_TARGET: Command line to run compile C code for GOARCH.\r
+:: This is used by cgo. Default is CC.\r
+::\r
+:: FC: Command line to run to compile Fortran code.\r
+:: This is used by cgo. Default is "gfortran".\r
+\r
+@echo off\r
+\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
+if x%4==x--no-local goto nolocal\r
+setlocal\r
+:nolocal\r
+\r
+set GOBUILDFAIL=0\r
+\r
+if exist make.bat goto ok\r
+echo Must run make.bat from Go src directory.\r
+goto fail\r
+:ok\r
+\r
+:: Clean old generated file that will cause problems in the build.\r
+del /F ".\pkg\runtime\runtime_defs.go" 2>NUL\r
+\r
+:: Set GOROOT for build.\r
+cd ..\r
+set GOROOT_TEMP=%CD%\r
+set GOROOT=\r
+cd src\r
+set vflag=\r
+if x%1==x-v set vflag=-v\r
+if x%2==x-v set vflag=-v\r
+if x%3==x-v set vflag=-v\r
+if x%4==x-v set vflag=-v\r
+\r
+if not exist ..\bin\tool mkdir ..\bin\tool\r
+\r
+:: Calculating GOROOT_BOOTSTRAP\r
+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
+               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
+\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
+if not exist "%GOROOT_BOOTSTRAP%\bin\go.exe" goto bootstrapfail\r
+set GOROOT=%GOROOT_TEMP%\r
+set GOROOT_TEMP=\r
+\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 GOBIN=\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
+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-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 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 :eof\r
+\r
+:: DO NOT ADD ANY NEW CODE HERE.\r
+:: The bootstrap+del above are the final step of make.bat.\r
+:: If something must be added, add it to cmd/dist's cmdbootstrap,\r
+:: to avoid needing three copies in three different shell languages\r
+:: (make.bash, make.bat, make.rc).\r
+\r
+:copydist\r
+mkdir "%GOTOOLDIR%" 2>NUL\r
+copy cmd\dist\dist.exe "%GOTOOLDIR%\"\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 %bootgo%.\r
+\r
+:fail\r
+set GOBUILDFAIL=1\r
+if x%GOBUILDEXIT%==x1 exit %GOBUILDFAIL%\r