Commit 3f6a517d authored by Russ Cox's avatar Russ Cox

cmd/dist: respect $CC, as quietgcc.bash used to

R=golang-dev, r, iant
CC=golang-dev
https://golang.org/cl/5641051
parent 1a761fd0
...@@ -336,8 +336,7 @@ setup(void) ...@@ -336,8 +336,7 @@ setup(void)
*/ */
// gccargs is the gcc command line to use for compiling a single C file. // gccargs is the gcc command line to use for compiling a single C file.
static char *gccargs[] = { static char *proto_gccargs[] = {
"gcc",
"-Wall", "-Wall",
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-missing-braces", "-Wno-missing-braces",
...@@ -352,6 +351,8 @@ static char *gccargs[] = { ...@@ -352,6 +351,8 @@ static char *gccargs[] = {
"-c", "-c",
}; };
static Vec gccargs;
// deptab lists changes to the default dependencies for a given prefix. // deptab lists changes to the default dependencies for a given prefix.
// deps ending in /* read the whole directory; deps beginning with - // deps ending in /* read the whole directory; deps beginning with -
// exclude files with that prefix. // exclude files with that prefix.
...@@ -513,6 +514,16 @@ install(char *dir) ...@@ -513,6 +514,16 @@ install(char *dir)
vinit(&lib); vinit(&lib);
vinit(&extra); vinit(&extra);
// set up gcc command line on first run.
if(gccargs.len == 0) {
xgetenv(&b, "CC");
if(b.len == 0)
bprintf(&b, "gcc");
splitfields(&gccargs, bstr(&b));
for(i=0; i<nelem(proto_gccargs); i++)
vadd(&gccargs, proto_gccargs[i]);
}
// path = full path to dir. // path = full path to dir.
bpathf(&path, "%s/src/%s", goroot, dir); bpathf(&path, "%s/src/%s", goroot, dir);
name = lastelem(dir); name = lastelem(dir);
...@@ -732,7 +743,7 @@ install(char *dir) ...@@ -732,7 +743,7 @@ install(char *dir)
vreset(&compile); vreset(&compile);
if(!isgo) { if(!isgo) {
// C library or tool. // C library or tool.
vcopy(&compile, gccargs, nelem(gccargs)); vcopy(&compile, gccargs.p, gccargs.len);
if(streq(gohostarch, "amd64")) if(streq(gohostarch, "amd64"))
vadd(&compile, "-m64"); vadd(&compile, "-m64");
else if(streq(gohostarch, "386")) else if(streq(gohostarch, "386"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment