1 #!/bin/sh
2 # Copyright 2009 The Go Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style
4 # license that can be found in the LICENSE file.
5
6 # Generate builtin.c and builtin.c.boot from $* (runtime.go and unsafe.go).
7 # Run this after changing runtime.go and unsafe.go
8 # or after changing the export metadata format in the compiler.
9 # Either way, you need to have a working compiler binary first.
10
11 set -e
12
13 eval $(gomake --no-print-directory -f ../../Make.inc go-env)
14 if [ -z "$GC" ]; then
15 echo 'missing $GC - gomake failed?' 1>&2
16 exit 1
17 fi
18
19 gomake mkbuiltin1
20 rm -f _builtin.c
21 for i in runtime unsafe
22 do
23 $GC -A $i.go
24 O=$O ./mkbuiltin1 $i >>_builtin.c
25 done
26
27 # If _builtin.c has changed vs builtin.c.boot,
28 # check in the new change.
29 cmp -s _builtin.c builtin.c.boot || cp _builtin.c builtin.c.boot
30
31 mv _builtin.c builtin.c