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
|
|
|
|
2010-08-24 18:00:33 -06:00
|
|
|
eval $(gomake -f ../../Make.inc go-env)
|
2009-06-05 11:59:55 -06:00
|
|
|
if [ -z "$GC" ]; then
|
2010-08-24 18:00:33 -06:00
|
|
|
echo 'missing $GC - gomake failed?' 1>&2
|
2009-06-05 11:59:55 -06:00
|
|
|
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
|
2010-08-30 13:40:56 -06:00
|
|
|
$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
|