From patchwork Wed Jul 30 15:20:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 34538 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f72.google.com (mail-oi0-f72.google.com [209.85.218.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8E82220792 for ; Wed, 30 Jul 2014 15:21:43 +0000 (UTC) Received: by mail-oi0-f72.google.com with SMTP id a141sf5964725oig.7 for ; Wed, 30 Jul 2014 08:21:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=4OqZeQzLjmGCwhzpaR8XSUMA4Bym6U39SJO0a0/082I=; b=Vx7tTe+/UrHQaLNszGqGcSf49XfpVBOWH7/ESfLk30gltAkmoDdNXFmAjRc5EgCNGz oY/j3hlk3Tw6zvOZSvNZg7tYKuq4wg0Rnjn03xpBlyhmvPDvx0XWG2zsUZGems7+B0xA b+Sj/u31r7maPi9HT0Tw5u8uqAWbIEwsrilj0ODeAMO7Xvkq7E3VkPCvLpZbGTSV/x0x +mEDC8K//rWoMBMjvWCF2HlnOmTVWM1ucPZznZHeGDRX7ZJsQFeJU/8kaIBevWsW3hJ6 cG34mEBQT+1bdayHp1VSKJmXr8c9pBLyVGzji0wUvPFqMvq+OwiRsnQi+ssmIFhjUdCO E/2g== X-Gm-Message-State: ALoCoQkwYE1N1Gi5lbBt/x9VUHdLWt3RNl1ggNBI3emdWPIrQWNCkTpBM1bO4FI+TDcTNs88fhZN X-Received: by 10.50.49.33 with SMTP id r1mr16802608ign.3.1406733702006; Wed, 30 Jul 2014 08:21:42 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.142 with SMTP id r14ls577734qgr.16.gmail; Wed, 30 Jul 2014 08:21:41 -0700 (PDT) X-Received: by 10.220.105.201 with SMTP id u9mr3774076vco.11.1406733701882; Wed, 30 Jul 2014 08:21:41 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id go5si1995482vec.42.2014.07.30.08.21.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 08:21:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id la4so2027183vcb.23 for ; Wed, 30 Jul 2014 08:21:41 -0700 (PDT) X-Received: by 10.220.97.5 with SMTP id j5mr5261922vcn.16.1406733701792; Wed, 30 Jul 2014 08:21:41 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp35866vcb; Wed, 30 Jul 2014 08:21:41 -0700 (PDT) X-Received: by 10.140.104.49 with SMTP id z46mr7423818qge.74.1406733701319; Wed, 30 Jul 2014 08:21:41 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s8si4449201qan.38.2014.07.30.08.21.41 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 30 Jul 2014 08:21:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:51566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCVhE-0002mn-T9 for patch@linaro.org; Wed, 30 Jul 2014 11:21:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCVgI-0001ni-OH for qemu-devel@nongnu.org; Wed, 30 Jul 2014 11:20:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCVgD-00017V-ON for qemu-devel@nongnu.org; Wed, 30 Jul 2014 11:20:42 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:44795 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCVgD-000170-Az for qemu-devel@nongnu.org; Wed, 30 Jul 2014 11:20:37 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaro.local) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1XCVpq-0002Zs-Ny; Wed, 30 Jul 2014 17:30:34 +0200 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Wed, 30 Jul 2014 16:20:26 +0100 Message-Id: <1406733627-24255-5-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.0.3 In-Reply-To: <1406733627-24255-1-git-send-email-alex.bennee@linaro.org> References: <1406733627-24255-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: alex.bennee@linaro.org X-SA-Exim-Scanned: No (on socrates.bennee.com); SAEximRunCond expanded to false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 88.198.71.155 Cc: peter.maydell@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [Qemu-devel] [PATCH v2 4/5] scripts/make_device_config.sh: inline includes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 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