aboutsummaryrefslogtreecommitdiff
path: root/emacs/Makefile.local
diff options
context:
space:
mode:
authorAustin Clements <amdragon@MIT.EDU>2013-05-17 16:13:31 -0400
committerDavid Bremner <bremner@debian.org>2013-05-23 08:06:12 -0300
commit68720286ebc5bf53c2b89a3486b7fcd691443783 (patch)
tree773dc338ba9358000f0b4e552633baa34c1f8ffe /emacs/Makefile.local
parented9ef5dc5a281fd1a3a9bba235ef297f6496e24d (diff)
emacs: Compute build dependencies to fix byte compile issues
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.
Diffstat (limited to 'emacs/Makefile.local')
-rw-r--r--emacs/Makefile.local12
1 files changed, 12 insertions, 0 deletions
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index fb82247f..456700ac 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 $@)
+-include $(dir)/.eldeps
+CLEAN+=$(dir)/.eldeps $(dir)/.eldeps.tmp
+
%.elc: %.el $(global_deps)
$(call quiet,EMACS) --directory emacs -batch -f batch-byte-compile $<