From 6d888f1e1b81bd2545e5da710d37a5a0ddce71d5 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 15 Feb 2013 13:37:43 -0800 Subject: build: clang support This works with at least one version of clang that existed at one moment in time. No guarantees about clangs past or future. To try: CC=clang all.bash It does not work with the Xcode clang, because that clang fails at printing a useful answer to: clang -print-libgcc-file-name The clang that works prints a full path name for that command, not just "libgcc.a". Fixes #4713. R=iant, minux.ma CC=golang-dev https://golang.org/cl/7323068 --- src/make.bash | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/make.bash') diff --git a/src/make.bash b/src/make.bash index 6c78f93ce6..2d83b6f4d1 100755 --- a/src/make.bash +++ b/src/make.bash @@ -29,6 +29,9 @@ # 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 get at host C compiler. +# Default is "gcc". Also supported: "clang". set -e if [ ! -f run.bash ]; then @@ -103,7 +106,7 @@ case "$GOHOSTARCH" in 386) mflag=-m32;; amd64) mflag=-m64;; esac -gcc $mflag -O2 -Wall -Werror -ggdb -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c +${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c eval $(./cmd/dist/dist env -p) echo -- cgit v1.3