github.com/hongwozai/go-src-1.4.3@v0.0.0-20191127132709-dc3fce3dbccb/src/cmd/gc/mkbuiltin (about)

     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 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 $(go tool dist env)
    14  if [ -z "$GOCHAR" ]; then
    15  	echo 'missing $GOCHAR - go tool dist failed?' 1>&2
    16  	exit 1
    17  fi
    18  
    19  GC=${GOCHAR}g
    20  gcc -o mkbuiltin1 mkbuiltin1.c
    21  rm -f _builtin.c
    22  echo "// AUTO-GENERATED by mkbuiltin; DO NOT EDIT" >>_builtin.c
    23  for i in runtime unsafe
    24  do
    25  	go tool $GC -A $i.go
    26  	O=$GOCHAR ./mkbuiltin1 $i >>_builtin.c
    27  done
    28  
    29  # If _builtin.c has changed vs builtin.c,
    30  # check in the new change.
    31  cmp -s _builtin.c builtin.c || cp _builtin.c builtin.c
    32  rm _builtin.c mkbuiltin1 unsafe.$GOCHAR runtime.$GOCHAR