From patchwork Sun Sep 26 09:05:55 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 65776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 54669B70D9 for ; Sun, 26 Sep 2010 19:10:49 +1000 (EST) Received: from localhost ([127.0.0.1]:57549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OznFu-0004jy-CC for incoming@patchwork.ozlabs.org; Sun, 26 Sep 2010 05:10:46 -0400 Received: from [140.186.70.92] (port=39676 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OznBZ-00035n-OZ for qemu-devel@nongnu.org; Sun, 26 Sep 2010 05:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OznBY-0003g8-Ho for qemu-devel@nongnu.org; Sun, 26 Sep 2010 05:06:17 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:56373) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OznBY-0003g1-EP for qemu-devel@nongnu.org; Sun, 26 Sep 2010 05:06:16 -0400 Received: by qwk4 with SMTP id 4so1170532qwk.4 for ; Sun, 26 Sep 2010 02:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=8F+u30wsQPcpotpUEwAs64Qt8qbpzA8CnpmXH6b7KdQ=; b=SdLgsuesx81Mz/86CzIIYiyMYkW6rYMwk04t5FT7BKp4G+zg4IbSg3+NR2G235iZse 3Gxkm3jYJr5H1ivoG3EIZdSFe7OMlRftMjiDuVIzk+HwwU+NHOQVEPfh38aVBkCsCd7b lAHLiOPPKHz7FkYHY139RCuZvxW4pymgmW2ZE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=h2zLtCJ3kOU8fvrq3IljwnPpwNLIrmO/bAGKz0KXLqwmJKNtFTB1El6zA+fLVozZFT mb2XtDZ0DHqdYY7yqR3CE4MKRqgJ2qccMhEVWyZFNesWM73Tjnu34LZpvMp0gJZnYk/j n7Wm1jNuCkMFYgaTDJpOTcOFtaNiMi8cn6pws= Received: by 10.229.10.203 with SMTP id q11mr4164390qcq.282.1285491975810; Sun, 26 Sep 2010 02:06:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.236.66 with HTTP; Sun, 26 Sep 2010 02:05:55 -0700 (PDT) From: Blue Swirl Date: Sun, 26 Sep 2010 09:05:55 +0000 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 2/2] trace: avoid unnecessary recompilation if nothing changed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add logic to detect changes in generated files. If the old and new files are identical, don't touch the generated file. This avoids a lot of churn since many files depend on trace.h. Signed-off-by: Blue Swirl --- Makefile | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) + fi trace.o: trace.c $(GENERATED_HEADERS) diff --git a/Makefile b/Makefile index ff39025..085e8ed 100644 --- a/Makefile +++ b/Makefile @@ -107,10 +107,24 @@ ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS) bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS) trace.h: $(SRC_PATH)/trace-events config-host.mak - $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h < $< > $@," GEN $@") + $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h < $< > $@.tmp," GEN $@") + @if test -f $@; then \ + if ! cmp -s $@ $@.tmp; then \ + mv $@.tmp $@; \ + fi; \ + else \ + mv $@.tmp $@; \ + fi trace.c: $(SRC_PATH)/trace-events config-host.mak - $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c < $< > $@," GEN $@") + $(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c < $< > $@.tmp," GEN $@") + @if test -f $@; then \ + if ! cmp -s $@ $@.tmp; then \ + mv $@.tmp $@; \ + fi; \ + else \ + mv $@.tmp $@; \