]> Git Repo - qemu.git/blobdiff - scripts/make_device_config.sh
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2015-10-12' into staging
[qemu.git] / scripts / make_device_config.sh
index 0778fe2a420148934ee51a7378b9b82c8e8fa02e..c1afb3ffaa4d02897e3fe4fb2d94c232f9892018 100644 (file)
@@ -1,10 +1,12 @@
 #! /bin/sh
-# Construct a target device config file from a default, pulling in any
-# files from include directives.
+# Writes a target device config file to stdout, from a default and from
+# include directives therein.  Also emits Makefile dependencies.
+#
+# Usage: make_device_config.sh SRC DEPFILE-NAME DEPFILE-TARGET > DEST
 
-dest=$1.tmp
-dep=$1.d
-src=$2
+src=$1
+dep=$2
+target=$3
 src_dir=`dirname $src`
 all_includes=
 
@@ -18,11 +20,11 @@ process_includes () {
 
 f=$src
 while [ -n "$f" ] ; do
-  f=`tr -d '\r' < $f | awk '/^include / {printf "'$src_dir'/%s", $2}'`
+  f=`cat $f | tr -d '\r' | awk '/^include / {printf "'$src_dir'/%s ", $2}'`
   [ $? = 0 ] || exit 1
   all_includes="$all_includes $f"
 done
-process_includes $src > $dest
+process_includes $src
 
-cat $src $all_includes | grep -v '^include' > $dest
-echo "`basename $1`: $all_includes" > $dep
+cat $src $all_includes | grep -v '^include'
+echo "$target: $all_includes" > $dep
This page took 0.019998 seconds and 4 git commands to generate.