diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-03 00:16:12 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-03 00:16:12 +0000 |
commit | 4180345a0b00e68339e2d8b4aec291ad5ec1a01c (patch) | |
tree | fcf705f857548012e46180c9f778ead306f29e47 /libgo/godeps.sh | |
parent | ca562850ec92c835701fa68cc9196796468d61c8 (diff) | |
download | gcc-4180345a0b00e68339e2d8b4aec291ad5ec1a01c.tar.gz |
libgo: Generate dependencies automatically.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181955 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/godeps.sh')
-rw-r--r-- | libgo/godeps.sh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libgo/godeps.sh b/libgo/godeps.sh new file mode 100644 index 00000000000..7ae5af93bf4 --- /dev/null +++ b/libgo/godeps.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# Copyright 2011 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. + +# The godeps.sh script outputs a dependency file for a package. The +# dependency file is then included in the libgo Makefile. This is +# automatic dependency generation, Go style. + +# The first parameter is the name of the file being generated. The +# remaining parameters are the names of Go files which are scanned for +# imports. + +set -e + +if test $# = 0; then + echo 1>&2 "Usage: godeps.sh OUTPUT INPUTS..." + exit 1 +fi + +output=$1 +shift + +deps=`for f in $*; do cat $f; done | + sed -n -e '/^import.*"/p; /^import[ ]*(/,/^)/p' | + grep '"' | + grep -v '"unsafe"' | + sed -e 's/^.*"\([^"]*\)".*$/\1/' -e 's/$/.gox/' | + sort -u` + +echo $output: $deps |