Commit bc874ec0 authored by Russ Cox's avatar Russ Cox

runtime: correct runtime.GOOS, runtime.GOARCH

If the same directory was used for multiple builds,
it was possible for a stale version.go to contain the
wrong definitions for $GOOS and $GOARCH, because
they can change even if the hg version does not.
Split into multiple files to fix.

R=r, r2
CC=golang-dev
https://golang.org/cl/4124050
parent bd4e49f5
......@@ -26,8 +26,12 @@ GOFILES=\
softfloat64.go\
type.go\
version.go\
version_$(GOOS).go\
version_$(GOARCH).go\
runtime_defs.go\
CLEANFILES+=version.go version_*.go
OFILES_windows=\
syscall.$O\
......@@ -127,6 +131,12 @@ mkversion: mkversion.c
version.go: mkversion
./mkversion >version.go
version_$(GOARCH).go:
(echo 'package runtime'; echo 'const theGoarch = "$(GOARCH)"') >$@
version_$(GOOS).go:
(echo 'package runtime'; echo 'const theGoos = "$(GOOS)"') >$@
%.c: %.goc goc2c
./goc2c `pwd`/$< > $@.tmp
mv -f $@.tmp $@
......
......@@ -5,13 +5,11 @@ char *template =
"// generated by mkversion.c; do not edit.\n"
"package runtime\n"
"const defaultGoroot = \"%s\"\n"
"const theVersion = \"%s\"\n"
"const theGoarch = \"%s\"\n"
"const theGoos = \"%s\"\n";
"const theVersion = \"%s\"\n";
void
main(void)
{
print(template, getgoroot(), getgoversion(), getgoarch(), getgoos());
print(template, getgoroot(), getgoversion());
exits(0);
}
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