From 88e012511ac6bfd7eb31b14d792ab0005e3693a8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 13 Apr 2017 10:03:09 +0300 Subject: [PATCH] Avoid unnecessary regeneration of the entire loaddefs.el * lisp/Makefile.in (autoloads .PHONY): Add commentary explaining why $(lisp)/loaddefs.el is a dependency of '.PHONY'. ($(lisp)/loaddefs.el): Copy an existing loaddefs.el to loaddefs.tmp before running 'batch-update-autoloads' on it, to avoid slow regeneration of the full contents. (Bug#26459) Use 'move-if-change' instead of 'mv', to avoid producing a new Emacs binary when not necessary. --- lisp/Makefile.in | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 334f2a44bb2..ec9ea16021e 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -182,15 +182,25 @@ $(lisp)/finder-inf.el: # # Write to a temporary file in case we're doing a parallel build and a # CANNOT_DUMP-mode Emacs needs to read loaddefs at startup. +# +# We make $(lisp)/loaddefs.el a dependency of .PHONY to cause Make to +# ignore its time stamp. That's because the real dependencies of +# loaddefs.el aren't known to Make, they are implemented in +# batch-update-autoloads, which only updates the autoloads whose +# sources have changed. We start by copying an existing loaddefs.el +# to loaddefs.tmp to avoid regenerating the entire file anew, which is +# slow; starting from an almost-correct content will enable the "only +# update where necessary" feature of batch-update-autoloads. autoloads .PHONY: $(lisp)/loaddefs.el $(lisp)/loaddefs.el: $(LOADDEFS) @echo Directories for loaddefs: ${SUBDIRS_ALMOST} + @if test -f $@ ; then cp $@ $(lisp)/loaddefs.tmp ; fi $(AM_V_GEN)$(emacs) -l autoload \ --eval '(setq autoload-ensure-writable t)' \ --eval '(setq autoload-builtin-package-versions t)' \ --eval '(setq generated-autoload-file (expand-file-name (unmsys--file-name "$(lisp)/loaddefs.tmp")))' \ -f batch-update-autoloads ${SUBDIRS_ALMOST} - mv -f $(lisp)/loaddefs.tmp $@ + $(top_srcdir)/build-aux/move-if-change $(lisp)/loaddefs.tmp $@ # autoloads only runs when loaddefs.el is nonexistent, although it # generates a number of different files. Provide a force option to enable -- 2.39.2