#
# 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