From patchwork Sat Jun 28 16:59:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 32662 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 18106201EF for ; Sat, 28 Jun 2014 17:00:43 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id a41sf13309047yho.9 for ; Sat, 28 Jun 2014 10:00: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:mime-version:delivered-to:from:to:date :message-id: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; bh=Z9lB/d+sgOGcMHx1bVj6vhc37NUu0XboKL4xBFqVKHI=; b=evycGj1ZDTSEiR9U4CNc2EXZANeVs6Kbb4fVJrOCGDyW1ltUGrYWY0ZHT1Hu3jjcf7 r9Hl4zGfsdT30xA4weJLjFPxtjIfQvu4QysLEtH5qBkH+1Rw2ji3gbMHq7XnBHQALU0A iu5ilUDgdiQQEjTy0E+AN60DddcJ6SDWn050tmu3fxm9c9T1DNp4TNYf4oVhfgG3pLp/ 5dgFothDLKCsHbpIK0kNoKt1EdeF274dJ6OqkxhRGvYp2j1uK1JfcMQkJn+KQt2yKbya bj+Gwtqk30Uj9uZmWb5fEGcm6js392lGItZD5GFKUZ4Zg5q4h36/ClO6cgDvqTgyXaI1 ySKA== X-Gm-Message-State: ALoCoQnUQHDeXWrUe6a1t/H3OjVOjEjOJG3qdgdeeSFXTpk6D/lh5ihLh8Fz5PB4sr6u7MsxI37Q X-Received: by 10.58.227.10 with SMTP id rw10mr15014000vec.39.1403974842851; Sat, 28 Jun 2014 10:00:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.201 with SMTP id z67ls1014810qgd.94.gmail; Sat, 28 Jun 2014 10:00:42 -0700 (PDT) X-Received: by 10.58.208.170 with SMTP id mf10mr9617680vec.22.1403974842771; Sat, 28 Jun 2014 10:00:42 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id fa1si8018220vcb.39.2014.06.28.10.00.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 28 Jun 2014 10:00:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so6011243vcb.5 for ; Sat, 28 Jun 2014 10:00:42 -0700 (PDT) X-Received: by 10.58.34.169 with SMTP id a9mr3504473vej.5.1403974842586; Sat, 28 Jun 2014 10:00:42 -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 tc5csp31948vcb; Sat, 28 Jun 2014 10:00:42 -0700 (PDT) X-Received: by 10.229.103.130 with SMTP id k2mr43568403qco.1.1403974842224; Sat, 28 Jun 2014 10:00:42 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id bt6si18354517qcb.16.2014.06.28.10.00.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 28 Jun 2014 10:00:42 -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]:55349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0vzV-0007PX-VJ for patch@linaro.org; Sat, 28 Jun 2014 13:00:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0vyw-00075M-DO for qemu-devel@nongnu.org; Sat, 28 Jun 2014 13:00:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0vyv-0001n2-5g for qemu-devel@nongnu.org; Sat, 28 Jun 2014 13:00:06 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0vyu-0001Wo-Vu for qemu-devel@nongnu.org; Sat, 28 Jun 2014 13:00:05 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1X0vyS-0006F1-CR; Sat, 28 Jun 2014 17:59:36 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Sat, 28 Jun 2014 17:59:36 +0100 Message-Id: <1403974776-23966-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Paolo Bonzini , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH] Makefile: Don't build generated headers before Makefile is reread 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: peter.maydell@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.174 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 Having a direct dependency Makefile: $(GENERATED_HEADERS) can result in not-from-clean builds failing sometimes, because it means that when Make does its "is any makefile or include out of date and needing a rebuild?" check, as well as possibly running configure (to update config-host.mak) it will also rebuild GENERATED_HEADERS under the "old" config-host.mak regime. If the makefile rules for rebuilding the generated headers have changed in a way that means they're not compatible with the old config-host.mak variable names, the build will fail. Even if it does work, it's wasted effort since we'll need to rebuild them with the right config-host.mak settings immediately. Instead, make the generated headers depend on config-host.mak and config-target.mak. This means we'll definitely rebuild them if the configuration changes, but it will be done after Make reloads its makefiles and includes so will happen with the correct set of config-host.mak settings. We rely on the various .o files having correct autogenerated dependency rules to cause the generated headers to be generated as and when they are needed. Signed-off-by: Peter Maydell Reviewed-by: Paolo Bonzini --- The specific example of this is the change from CONFIG_TRACE_BACKEND to CONFIG_TRACE_BACKENDS, which I am still hitting on a pretty regular basis. This patch fixes that problem and I don't think it has any unpleasant side effects; Paolo, have I missed anything? Makefile | 8 +++----- Makefile.target | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 145adb6..dca33b4 100644 --- a/Makefile +++ b/Makefile @@ -546,11 +546,9 @@ ifdef SIGNCODE endif # SIGNCODE endif # CONFIG_WIN -# Add a dependency on the generated files, so that they are always -# rebuilt before other object files -ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail)) -Makefile: $(GENERATED_HEADERS) -endif +# Make the generated files depend on config-host.mak so that if +# the configuration settings change we will rebuild them +$(GENERATED_HEADERS): config-host.mak # Include automatically generated dependency files # Dependencies in Makefile.objs files come from our recursive subdir rules diff --git a/Makefile.target b/Makefile.target index 6089d29..ea8614a 100644 --- a/Makefile.target +++ b/Makefile.target @@ -198,4 +198,4 @@ ifdef CONFIG_TRACE_SYSTEMTAP endif GENERATED_HEADERS += config-target.h -Makefile: $(GENERATED_HEADERS) +$(GENERATED_HEADERS): config-target.mak config-devices.mak