From: Tomi Ollila Date: Sun, 19 May 2013 14:33:24 +0000 (+0300) Subject: Re: [PATCH] emacs: Compute build dependencies to fix byte compile issues X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ade909ba4213a36e74805d7f9e33de5325b6746f;p=notmuch-archives.git Re: [PATCH] emacs: Compute build dependencies to fix byte compile issues --- diff --git a/57/331cf82a79ad5a96df41d67cfffc418b5122b7 b/57/331cf82a79ad5a96df41d67cfffc418b5122b7 new file mode 100644 index 000000000..9f84afb83 --- /dev/null +++ b/57/331cf82a79ad5a96df41d67cfffc418b5122b7 @@ -0,0 +1,107 @@ +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 75BFC431FBD + for ; Sun, 19 May 2013 07:33:35 -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 erplEgQdO326 for ; + Sun, 19 May 2013 07:33:30 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 9247B431FBC + for ; Sun, 19 May 2013 07:33:30 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id 14BF31002C3; + Sun, 19 May 2013 17:33:25 +0300 (EEST) +From: Tomi Ollila +To: Austin Clements , notmuch@notmuchmail.org +Subject: Re: [PATCH] emacs: Compute build dependencies to fix byte compile + issues +In-Reply-To: <1368821611-24110-1-git-send-email-amdragon@mit.edu> +References: <1368821611-24110-1-git-send-email-amdragon@mit.edu> +User-Agent: Notmuch/0.15.2+99~g7e455bc (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Sun, 19 May 2013 14:33:35 -0000 + +On Fri, May 17 2013, Austin Clements wrote: + +> Previously, we simply byte compiled each Elisp source file +> independently. This is actually the wrong thing to do and can lead to +> issues with macros and performance issues with substitutions because +> 1) when the byte compiler encounters a (require 'x) form, it will load +> x.elc in preference to x.el, even if x.el is newer, and as a result +> may load old macro and substitution definitions and 2) if we update a +> macro or substitution definition in one file, we currently won't +> re-compile other files that depend on the file containing the +> definition. +> +> This patch addresses these problems by computing make dependency rules +> from the (require 'x) forms in the Elisp source files, which we inject +> into make's dependency database. +> --- +> emacs/Makefile.local | 12 +++++++++ +> emacs/make-deps.el | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ +> 2 files changed, 78 insertions(+) +> create mode 100644 emacs/make-deps.el +> +> diff --git a/emacs/Makefile.local b/emacs/Makefile.local +> index fb82247..456700a 100644 +> --- a/emacs/Makefile.local +> +++ b/emacs/Makefile.local +> @@ -22,6 +22,18 @@ emacs_images := \ +> +> emacs_bytecode = $(emacs_sources:.el=.elc) +> +> +# Because of defmacro's and defsubst's, we have to account for load +> +# dependencies between Elisp files when byte compiling. Otherwise, +> +# the byte compiler may load an old .elc file when processing a +> +# "require" or we may fail to rebuild a .elc that depended on a macro +> +# from an updated file. +> +$(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 $@) + +The last line above could be in format + + { cmp -s $@.tmp $@ || mv $@.tmp $@; } + +so that the expression is evaluated in current shell instead of a subshell. + +You may consider changing this if you add year to copyright line. + +Tomi + + +> +-include $(dir)/.eldeps +> +CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp +> + +> %.elc: %.el $(global_deps) +> $(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $< +>