From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 81615431FAE for ; Wed, 19 Feb 2014 20:24:55 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8mns0Qxp2MTm for ; Wed, 19 Feb 2014 20:24:49 -0800 (PST) Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu [18.9.25.12]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 246F5431FBD for ; Wed, 19 Feb 2014 20:24:49 -0800 (PST) X-AuditID: 1209190c-f794a6d000000c27-47-53058390644b Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP id 2D.44.03111.09385035; Wed, 19 Feb 2014 23:24:48 -0500 (EST) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id s1K4OjnU023899; Wed, 19 Feb 2014 23:24:45 -0500 Received: from drake.dyndns.org (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [216.15.114.40]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s1K4OfDO008704 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Wed, 19 Feb 2014 23:24:44 -0500 Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1WGLBb-0002uj-MW; Wed, 19 Feb 2014 23:24:35 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Avoid rebuilding .eldeps even when there's nothing to do Date: Wed, 19 Feb 2014 23:24:24 -0500 Message-Id: <1392870264-11156-1-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixCmqrDuhmTXY4MMSTovrN2cyW7xZOY/V gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4MqYvryPqWCVcMW1uVwNjC/4uxg5OSQETCQO bnrEDmGLSVy4t54NxBYSmM0kseGTbRcjF5C9kVGicfMmRgjnDpPEzVNL2SGcuYwSE84fBmtn E9CQ2LZ/OSOILSIgLbHz7mxWEJtZwEri8NVNYLawQIDE4YZVYDUsAqoSP7c2sIDYvAIOEpvv 3WaGOENJYuGpbWD1nAIGEltefWWFOElf4sKtVywTGPkXMDKsYpRNya3SzU3MzClOTdYtTk7M y0st0jXUy80s0UtNKd3ECA4kSZ4djG8OKh1iFOBgVOLhZbjKEizEmlhWXJl7iFGSg0lJlPdR HmuwEF9SfkplRmJxRnxRaU5q8SFGCQ5mJRFenkygHG9KYmVValE+TEqag0VJnLfW4leQkEB6 YklqdmpqQWoRTFaGg0NJgreoCahRsCg1PbUiLTOnBCHNxMEJMpwHaHgwSA1vcUFibnFmOkT+ FKOilDjvBpCEAEgiozQPrhcW6a8YxYFeEeYNB6niASYJuO5XQIOZgAZ77WUEGVySiJCSamC0 NF507uCV4gkyTQF512XP9N4xnzLLW9XuCGd41J0Nr7dELbl+y+SZhW/+z4KCFcJGsSfCcmqc 0zavdC5MnHewbxLvnGaZDca7P/xpi+52XWwiKPffO/fE3t6adFsHPp09XP47VfYYh+gE6rEd flKx7UKhgYLDJTZr0clzDj341VTtZT7fcrsSS3FGoqEWc1FxIgBbS+XkzwIAAA== Cc: tomi.ollila@iki.fi X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Feb 2014 04:24:55 -0000 Previously, we updated .eldeps only if the file contents actually needed to change. This was done to avoid unnecessary make restarts (if the .eldeps rule changes the mtime of .eldeps, make has to restart to collect the new dependencies). However, this meant that, after a modification to any .el file that did not change dependencies, .eldeps would always be out of date, so every make invocation would run the .eldeps rule, which is both expensive because it starts up Emacs and noisy. This was true even when there was nothing to do. E.g., $ make clean && make ... $ touch emacs/notmuch-lib.el && make ... $ make Use "make V=1" to see the verbose compile lines. EMACS emacs/.eldeps make: Nothing to be done for `all'. $ make Use "make V=1" to see the verbose compile lines. EMACS emacs/.eldeps make: Nothing to be done for `all'. Fix this by replacing .eldeps with two files with identical content. One tracks the mtime of the dependency information and triggers the Emacs call to rebuild dependencies only when it may be necessary. The other tracks the content only; this rule over-triggers in the same way the old rule did, but this rule is cheap and quiet. --- emacs/Makefile.local | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/emacs/Makefile.local b/emacs/Makefile.local index 42bfbd9..6a39b32 100644 --- a/emacs/Makefile.local +++ b/emacs/Makefile.local @@ -33,10 +33,19 @@ ifeq ($(HAVE_EMACS),1) $(dir)/.eldeps: $(dir)/Makefile.local $(dir)/make-deps.el $(emacs_sources) $(call quiet,EMACS) --directory emacs -batch -l make-deps.el \ -f batch-make-deps $(emacs_sources) > $@.tmp && \ - (cmp -s $@.tmp $@ || mv $@.tmp $@) --include $(dir)/.eldeps + mv $@.tmp $@ +# We could include .eldeps directly, but that would cause a make +# restart whenever any .el file was modified, even if dependencies +# didn't change, because the mtime of .eldeps will change. Instead, +# we include a second file, .eldeps.x, which we ensure always has the +# same content as .eldeps, but its mtime only changes when dependency +# information changes, in which case a make restart is necessary +# anyway. +$(dir)/.eldeps.x: $(dir)/.eldeps + @cmp -s $^ $@ || cp $^ $@ +-include $(dir)/.eldeps.x endif -CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp +CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp $(dir)/.eldeps.x ifeq ($(HAVE_EMACS),1) %.elc: %.el $(global_deps) -- 1.8.4.rc3