qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Alex Bennée" <alex.bennee@linaro.org>
Subject: [Qemu-devel] [PATCH v2 4/5] scripts/make_device_config.sh: inline includes
Date: Wed, 30 Jul 2014 16:20:26 +0100	[thread overview]
Message-ID: <1406733627-24255-5-git-send-email-alex.bennee@linaro.org> (raw)
In-Reply-To: <1406733627-24255-1-git-send-email-alex.bennee@linaro.org>

Previously we processed all the includes at first and then just
concatenated them to the end of the eventual file. This meant if you
wanted to include a set of configs but only turn off some you couldn't.

Now you can do (for example):

    # We support most of the 32 bit boards so need all their config
    include arm-softmmu.mak
    # we explicitly disable ones that require old ARMv5 support
    CONFIG_ARMV5_BOARDS=n

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

diff --git a/scripts/make_device_config.sh b/scripts/make_device_config.sh
index 7242707..b0d0b51 100644
--- a/scripts/make_device_config.sh
+++ b/scripts/make_device_config.sh
@@ -1,6 +1,8 @@
 #! /bin/sh
 # Construct a target device config file from a default, pulling in any
-# files from include directives.
+# files from include directives. The include files are inlined in the order
+# they are found in the source file so you can reverse a sub-set of
+# settings afterwards.
 
 dest=$1.tmp
 dep=`dirname $1`-`basename $1`.d
@@ -8,21 +10,26 @@ 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
+process_file () {
+    local in=$1
+    local out=$2
+    while read first second; do
+        if [ "$first" = "include" ]; then
+            local inc="$src_dir/$second"
+            all_includes="$all_includes $inc"
+            echo "# include file: $inc" >> $out
+            process_file $inc $out
+            echo "# end of include: $inc" >> $out
+        else
+            if [ "x$second" = "x" ]; then
+                echo $first >> $out
+            else
+                echo "$first $second" >> $out
+            fi
+        fi
+    done < $in
 }
 
-f=$src
-while [ -n "$f" ] ; do
-  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
-
-cat $src $all_includes | grep -v '^include' > $dest
+echo "# This file is auto-generated by make_device_config.sh" > $dest
+process_file $src $dest
 echo "$1: $all_includes" > $dep
-- 
2.0.3

  parent reply	other threads:[~2014-07-30 15:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30 15:20 [Qemu-devel] [PATCH v2 0/5] AArch64 TLB performance improvements Alex Bennée
2014-07-30 15:20 ` [Qemu-devel] [PATCH v2 1/5] target-arm: don't hardcode mask values in arm_cpu_handle_mmu_fault Alex Bennée
2014-07-30 15:20 ` [Qemu-devel] [PATCH v2 2/5] target-arm: A64: fix TLB flush instructions Alex Bennée
2014-07-30 15:20 ` [Qemu-devel] [PATCH v2 3/5] target-arm: A64: fix use 12 bit page tables for AArch64 Alex Bennée
2014-07-30 15:20 ` Alex Bennée [this message]
2014-07-30 15:20 ` [Qemu-devel] [PATCH v2 5/5] target-arm: A64: disable a bunch of ARMv5 machines Alex Bennée
2014-08-01 16:45   ` Christopher Covington
2014-08-01 17:32     ` Peter Maydell
2014-08-01 16:06 ` [Qemu-devel] [PATCH v2 0/5] AArch64 TLB performance improvements Peter Maydell
2014-08-01 22:26   ` Peter Maydell
2014-08-04 10:23     ` Alex Bennée
2014-08-04 10:32       ` Peter Maydell
2014-08-04 13:11         ` Christopher Covington
2014-08-06 20:32     ` Richard Henderson
2014-08-01 19:35 ` Paolo Bonzini
2014-08-04 10:29   ` Alex Bennée
2014-08-04 11:34     ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406733627-24255-5-git-send-email-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).