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.
|
|
|
|
|
|
|
|
set -e
|
2009-06-05 11:59:55 -06:00
|
|
|
|
|
|
|
. $GOROOT/src/Make.$GOARCH
|
|
|
|
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-05-12 17:15:52 -06:00
|
|
|
for i in sys unsafe
|
2009-05-08 16:21:41 -06:00
|
|
|
do
|
2009-06-25 17:22:46 -06:00
|
|
|
$GC -A $i.go
|
2009-05-08 16:21:41 -06:00
|
|
|
./mkbuiltin1 $i >>_builtin.c
|
|
|
|
done
|
2009-03-05 19:26:12 -07:00
|
|
|
|
|
|
|
# If _builtin.c has changed vs builtin.c.boot,
|
|
|
|
# check in the new change if being run by
|
|
|
|
# one of the people who tends to work on
|
|
|
|
# the compiler. This makes sure that changes
|
|
|
|
# don't get forgotten, without causing problems
|
|
|
|
# in end user Go repositories.
|
|
|
|
case "$USER" in
|
|
|
|
ken | r | rsc)
|
2009-03-30 01:12:56 -06:00
|
|
|
if ! cmp _builtin.c builtin.c.boot >/dev/null 2>/dev/null
|
2009-03-05 19:26:12 -07:00
|
|
|
then
|
2009-03-30 01:12:56 -06:00
|
|
|
PATH=$PATH:/usr/local/bin # find p4 on OS X
|
|
|
|
p4 open builtin.c.boot >/dev/null 2>/dev/null || true # if p4 is missing, so be it
|
2009-03-05 19:26:12 -07:00
|
|
|
cp _builtin.c builtin.c.boot
|
|
|
|
fi
|
|
|
|
esac
|
|
|
|
|
|
|
|
cat _builtin.c
|
|
|
|
rm -f _builtin.c
|
|
|
|
|