qemu/make_device_config.sh
Paul Brook cf66924f81 Detect missing config includes
Terminate make_device_config.sh if the awk command fails.
Typically this means a missing file.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 00:58:07 +00:00

29 lines
629 B
Bash

#! /bin/sh
# Construct a target device config file from a default, pulling in any
# files from include directives.
dest=$1.tmp
dep=$1.d
src=$2
src_dir=`dirname $src`
all_includes=
process_includes () {
cat $1 | grep '^include' | \
while read include file ; do
all_includes="$all_includes $src_dir/$file"
process_includes $src_dir/$file
done
}
f=$src
while [ -n "$f" ] ; do
f=`awk '/^include / {ORS=" " ; print "'$src_dir'/" $2}' $f`
[ $? = 0 ] || exit 1
all_includes="$all_includes $f"
done
process_includes $src > $dest
cat $src $all_includes | grep -v '^include' > $dest
echo "$1: $all_includes" > $dep