]> git.proxmox.com Git - mirror_qemu.git/blob - scripts/make_device_config.sh
build-sys: split util-obj- on multi-lines
[mirror_qemu.git] / scripts / make_device_config.sh
1 #! /bin/sh
2 # Writes a target device config file to stdout, from a default and from
3 # include directives therein. Also emits Makefile dependencies.
4 #
5 # Usage: make_device_config.sh SRC DEPFILE-NAME DEPFILE-TARGET > DEST
6
7 src=$1
8 dep=$2
9 target=$3
10 src_dir=`dirname $src`
11 all_includes=
12
13 process_includes () {
14 cat $1 | grep '^include' | \
15 while read include file ; do
16 all_includes="$all_includes $src_dir/$file"
17 process_includes $src_dir/$file
18 done
19 }
20
21 f=$src
22 while [ -n "$f" ] ; do
23 f=`cat $f | tr -d '\r' | awk '/^include / {printf "'$src_dir'/%s ", $2}'`
24 [ $? = 0 ] || exit 1
25 all_includes="$all_includes $f"
26 done
27 process_includes $src
28
29 cat $src $all_includes | grep -v '^include'
30 echo "$target: $all_includes" > $dep