linux-user: Handle TARGET_MAP_STACK and TARGET_MAP_HUGETLB
[qemu/ar7.git] / scripts / make_device_config.sh
blob354af317b3ddff748dc3d7847668e0b6e88d2d61
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.
5 # Usage: make_device_config.sh SRC DEPFILE-NAME DEPFILE-TARGET > DEST
7 src=$1
8 dep=$2
9 target=$3
10 src_dir=$(dirname $src)
11 all_includes=
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
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
29 cat $src $all_includes | grep -v '^include'
30 echo "$target: $all_includes" > $dep