2009-03-05 19:26:12 -07:00
|
|
|
#!/bin/sh
|
|
|
|
# Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
2010-01-22 17:58:33 -07:00
|
|
|
# Generate builtin.c and builtin.c.boot from $* (runtime.go and unsafe.go).
|
|
|
|
# Run this after changing runtime.go and unsafe.go
|
|
|
|
# or after changing the export metadata format in the compiler.
|
|
|
|
# Either way, you need to have a working compiler binary first.
|
|
|
|
|
2009-03-05 19:26:12 -07:00
|
|
|
set -e
|
2009-06-05 11:59:55 -06:00
|
|
|
|
2009-12-11 16:14:09 -07:00
|
|
|
GOBIN="${GOBIN:-$HOME/bin}"
|
|
|
|
|
2009-11-23 18:32:51 -07:00
|
|
|
. "$GOROOT"/src/Make.$GOARCH
|
2009-06-05 11:59:55 -06:00
|
|
|
if [ -z "$GC" ]; then
|
|
|
|
echo 'missing $GC - maybe no Make.$GOARCH?' 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-03-05 19:26:12 -07:00
|
|
|
gcc -o mkbuiltin1 mkbuiltin1.c
|
|
|
|
rm -f _builtin.c
|
2009-10-16 00:10:49 -06:00
|
|
|
for i in runtime unsafe
|
2009-05-08 16:21:41 -06:00
|
|
|
do
|
2009-12-11 16:14:09 -07:00
|
|
|
"$GOBIN"/$GC -A $i.go
|
2009-07-31 10:29:28 -06:00
|
|
|
O=$O ./mkbuiltin1 $i >>_builtin.c
|
2009-05-08 16:21:41 -06:00
|
|
|
done
|
2009-03-05 19:26:12 -07:00
|
|
|
|
|
|
|
# If _builtin.c has changed vs builtin.c.boot,
|
2010-01-22 17:58:33 -07:00
|
|
|
# check in the new change.
|
|
|
|
cmp -s _builtin.c builtin.c.boot || cp _builtin.c builtin.c.boot
|
2009-03-05 19:26:12 -07:00
|
|
|
|
2009-12-11 13:41:33 -07:00
|
|
|
mv _builtin.c builtin.c
|