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
43 echo # Building compilers and Go bootstrap tool.
45 if x%1==x--no-clean set buildall=
46 .\cmd\dist\dist bootstrap %buildall% -v
47 if errorlevel 1 goto fail
48 :: Delay move of dist tool to now, because bootstrap cleared tool directory.
49 move .\cmd\dist\dist.exe "%GOTOOLDIR%\dist.exe"
50 "%GOTOOLDIR%\go_bootstrap" clean -i std
53 if not %GOHOSTARCH% == %GOARCH% goto localbuild
54 if not %GOHOSTOS% == %GOOS% goto localbuild
58 echo # Building tools for local system. %GOHOSTOS%/%GOHOSTARCH%
61 set GOARCH=%GOHOSTARCH%
62 "%GOTOOLDIR%\go_bootstrap" install -v std
64 if errorlevel 1 goto fail
68 echo # Building packages and commands.
69 "%GOTOOLDIR%\go_bootstrap" install -a -v std
70 if errorlevel 1 goto fail
71 del "%GOTOOLDIR%\go_bootstrap.exe"
74 if x%1==x--no-banner goto nobanner
75 "%GOTOOLDIR%\dist" banner