+info-dir: ${srcdir}/info/dir
+
+## Not strictly necessary, but speeds things up a bit by stopping
+## the info-dir rule from running when not needed.
+## Hopefully doc/misc/*.texi is not too long for some systems?
+info_dir_deps = ${srcdir}/build-aux/dir_top \
+ ${srcdir}/doc/emacs/emacs.texi \
+ ${srcdir}/doc/lispintro/emacs-lisp-intro.texi \
+ ${srcdir}/doc/lispref/elisp.texi ${srcdir}/doc/misc/*.texi
+
+## It would be much simpler if info/dir was only created in the
+## installation location by the install-info rule, but we also
+## need one in the source directory for people running uninstalled.
+## FIXME it would be faster to use the install-info program if we have it,
+## but then we would need to depend on info-real, which would
+## slow down parallelization.
+${srcdir}/info/dir: ${info_dir_deps}
+ tempfile=info-dir.$$$$; \
+ rm -f $${tempfile}; \
+ thisdir=`pwd`; \
+ (cd ${srcdir} && ./build-aux/make-info-dir $${thisdir}/$${tempfile}); \
+ ${srcdir}/build-aux/move-if-change $${tempfile} ${srcdir}/info/dir