diff options
Diffstat (limited to 'src/make.bash')
-rwxr-xr-x | src/make.bash | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/make.bash b/src/make.bash index 877d1e5eb..bfcb5d58e 100755 --- a/src/make.bash +++ b/src/make.bash @@ -35,10 +35,15 @@ # controls the default behavior of the linker's -linkmode option. The # default value depends on the system. # -# CC: Command line to run to get at host C compiler. +# CC: Command line to run to compile C code for GOHOSTARCH. # Default is "gcc". Also supported: "clang". -# CXX: Command line to run to get at host C++ compiler, only recorded -# for cgo use. Default is "g++". Also supported: "clang++". +# +# CC_FOR_TARGET: Command line to run to compile C code for GOARCH. +# This is used by cgo. Default is CC. +# +# CXX_FOR_TARGET: Command line to run to compile C++ code for GOARCH. +# This is used by cgo. Default is CXX, or, if that is not set, +# "g++" or "clang++". # # GO_DISTFLAGS: extra flags to provide to "dist bootstrap". Use "-s" # to build a statically linked toolchain. @@ -153,13 +158,15 @@ echo if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then echo "# Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH." - GOOS=$GOHOSTOS GOARCH=$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. + CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \ "$GOTOOLDIR"/go_bootstrap install -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std echo fi echo "# Building packages and commands for $GOOS/$GOARCH." -"$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std +CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -ccflags "$GO_CCFLAGS" -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std echo rm -f "$GOTOOLDIR"/go_bootstrap |