From: Tomi Ollila Date: Wed, 11 Apr 2012 20:52:01 +0000 (+0300) Subject: Re: [PATCH v2] Record dependencies during build instead of before X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=cdad36c3f70c039e35b4f9c59ebb2434c0762bba;p=notmuch-archives.git Re: [PATCH v2] Record dependencies during build instead of before --- diff --git a/a6/7826727e0d7c111bd0b3862646d4d47101f928 b/a6/7826727e0d7c111bd0b3862646d4d47101f928 new file mode 100644 index 000000000..105b9a0b8 --- /dev/null +++ b/a6/7826727e0d7c111bd0b3862646d4d47101f928 @@ -0,0 +1,93 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 47D6E431FAF + for ; Wed, 11 Apr 2012 13:52:05 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 7TXx-Zosd5kZ for ; + Wed, 11 Apr 2012 13:52:04 -0700 (PDT) +Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) + by olra.theworths.org (Postfix) with ESMTP id 1ABE3431FAE + for ; Wed, 11 Apr 2012 13:52:04 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 4997068055; Wed, 11 Apr 2012 23:52:01 +0300 (EEST) +From: Tomi Ollila +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH v2] Record dependencies during build instead of before +In-Reply-To: <1334176719-24781-1-git-send-email-amdragon@mit.edu> +References: <1333857710-24511-1-git-send-email-amdragon@mit.edu> + <1334176719-24781-1-git-send-email-amdragon@mit.edu>User-Agent: + Notmuch/0.12+77~gee11800 (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +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: Wed, 11 Apr 2012 20:52:05 -0000 + +On Wed, Apr 11 2012, Austin Clements wrote: + +> Previously, the makefile created dependency files in a separate, first +> pass. In particular, include-ing the dependency files would cause +> make to attempt to rebuild those files using the dependency-generation +> rules in the makefile. Unfortunately, this approach required obtuse +> rules and silently delayed the start of the build process (by quite a +> bit on a clean tree without any dependency files). Worse, this +> required the dependency files to themselves depend on all of the +> headers the source file depended on, which meant that, if a header +> file was removed, the depedency file could not be updated because of a +> missing dependency (!), which would cause make to silently fail. +> +> This patch eliminates the dependency generation rules and instead +> generates dependency files as a side-effect of the regular build rule. +> On the first build, we don't need to know the dependencies beforehand; +> the object file doesn't exist, so it will be built anyway. On +> subsequent builds, if a header file is updated, the dependency rules +> generated by the previous build will force a rebuild. If a source +> file is updated, the dependency rules may be stale, but it doesn't +> matter because the updated source file will force a rebuild. +> +> In the final case above, the stale dependency rules may refer to a +> header file that no longer exists but is also no longer needed. In +> order to prevent this from breaking the build, we also pass gcc the +> -MP option, which generates phony targets for every depended-on header +> file, so make won't complain if it can't find them during a later +> build. +> --- + +Looks good, patch applies and works (at least the cases I tested and +examined). And is definitely better than before. + ++1 + +Tomi + +> Sorry, the previous version of this patch was corrupted. Hopefully +> this one will be correct. +> +> Makefile.local | 18 ++++-------------- +> 1 files changed, 4 insertions(+), 14 deletions(-) +>