1 :: Copyright 2012 The Go Authors. All rights reserved.
2 :: Use of this source code is governed by a BSD-style
3 :: license that can be found in the LICENSE file.
6 :: Keep environment variables within this script
7 :: unless invoked with --no-local.
8 if x%1==x--no-local goto nolocal
9 if x%2==x--no-local goto nolocal
15 if exist make.bat goto ok
16 echo Must run make.bat from Go src directory.
20 :: Grab default GOROOT_FINAL and set GOROOT for build.
21 :: The expression %VAR:\=\\% means to take %VAR%
22 :: and apply the substitution \ = \\, escaping the
23 :: backslashes. Then we wrap that in quotes to create
28 if "x%GOROOT_FINAL%"=="x" set GOROOT_FINAL=%GOROOT%
29 set DEFGOROOT=-DGOROOT_FINAL="\"%GOROOT_FINAL:\=\\%\""
31 echo # Building C bootstrap tool.
33 if not exist ..\bin\tool mkdir ..\bin\tool
34 :: Windows has no glob expansion, so spell out cmd/dist/*.c.
35 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/buildruntime.c cmd/dist/goc2c.c cmd/dist/main.c cmd/dist/windows.c
36 if errorlevel 1 goto fail
37 .\cmd\dist\dist env -wp >env.bat
38 if errorlevel 1 goto fail
41 :: Echo with no arguments prints whether echo is turned on, so echo dot.
44 echo # Building compilers and Go bootstrap tool.
45 .\cmd\dist\dist bootstrap -a -v
46 if errorlevel 1 goto fail
47 :: Delay move of dist tool to now, because bootstrap cleared tool directory.
48 move .\cmd\dist\dist.exe %GOTOOLDIR%\dist.exe
49 %GOTOOLDIR%\go_bootstrap clean -i std
52 if not %GOHOSTARCH% == %GOARCH% goto localbuild
53 if not %GOHOSTOS% == %GOOS% goto localbuild
57 echo # Building tools for local system. %GOHOSTOS%/%GOHOSTARCH%
60 set GOARCH=%GOHOSTARCH%
61 %GOTOOLDIR%\go_bootstrap install -v std
63 if errorlevel 1 goto fail
67 echo # Building packages and commands.
68 %GOTOOLDIR%\go_bootstrap install -a -v std
69 if errorlevel 1 goto fail
70 del %GOTOOLDIR%\go_bootstrap.exe
73 if x%1==x--no-banner goto nobanner
74 %GOTOOLDIR%\dist banner