aboutsummaryrefslogtreecommitdiff
path: root/src/make.bat
diff options
context:
space:
mode:
authorHyang-Ah (Hana) Kim <hyangah@gmail.com>2015-03-01 10:09:27 -0500
committerHyang-Ah Hana Kim <hyangah@gmail.com>2015-03-02 02:20:46 +0000
commitf1489ac2511eda7c9eaca6bac83d329410b3ce92 (patch)
treeb28395e046a21ddb94c42a632802abe1b1a0b07a /src/make.bat
parentfbbf219ce96f8a5efb73405218308ad6da5eb75d (diff)
downloadgo-f1489ac2511eda7c9eaca6bac83d329410b3ce92.tar.gz
go-f1489ac2511eda7c9eaca6bac83d329410b3ce92.zip
build: update Windows make.bat to use CC_FOR_TARGET.
Change-Id: Ie4d8bedb9408372dff64e9a7fd857e1be4ee59e1 Reviewed-on: https://go-review.googlesource.com/6401 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Diffstat (limited to 'src/make.bat')
-rw-r--r--src/make.bat15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/make.bat b/src/make.bat
index 70569551e5..dca7f66654 100644
--- a/src/make.bat
+++ b/src/make.bat
@@ -25,6 +25,12 @@
:: 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.
+::
+:: CC: Command line to run to compile C code for GOHOSTARCH.
+:: Default is "gcc".
+::
+:: CC_FOR_TARGET: Command line to run compile C code for GOARCH.
+:: This is used by cgo. Default is CC.
@echo off
@@ -84,7 +90,9 @@ if not %GOHOSTOS% == %GOOS% goto localbuild
goto mainbuild
:localbuild
-echo ##### Building tools for local system. %GOHOSTOS%/%GOHOSTARCH%
+echo ##### Building packages and commands for host, %GOHOSTOS%/%GOHOSTARCH%.
+:: CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the
+:: host, however, use the host compiler, CC, from `cmd/dist/dist env` instead.
setlocal
set GOOS=%GOHOSTOS%
set GOARCH=%GOHOSTARCH%
@@ -94,8 +102,11 @@ if errorlevel 1 goto fail
echo.
:mainbuild
-echo ##### Building packages and commands.
+echo ##### Building packages and commands for %GOOS%/%GOARCH%.
+setlocal
+set CC=%CC_FOR_TARGET%
"%GOTOOLDIR%\go_bootstrap" install -gcflags "%GO_GCFLAGS%" -ldflags "%GO_LDFLAGS%" -a -v std cmd
+endlocal
if errorlevel 1 goto fail
del "%GOTOOLDIR%\go_bootstrap.exe"
echo.