]> code.delx.au - gnu-emacs/blobdiff - lisp/Makefile.in
(proced-after-send-signal-hook): Use defcustom.
[gnu-emacs] / lisp / Makefile.in
index 20de2e70377af99e597a01fb6ec8573c39decbce..7cbc4442db6014d0db5c6e4b3db4c7380b1db965 100644 (file)
@@ -1,6 +1,6 @@
 # Maintenance productions for the Lisp directory
 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-#   2008  Free Software Foundation, Inc.
+#   2008, 2009  Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -34,7 +34,7 @@ EMACS = ../src/emacs
 EMACSOPT = -batch --no-site-file --multibyte
 
 # Extra flags to pass to the byte compiler
-BYTE_COMPILE_EXTRA_FLAGS = 
+BYTE_COMPILE_EXTRA_FLAGS =
 # For example to not display the undefined function warnings you can use this:
 # BYTE_COMPILE_EXTRA_FLAGS = --eval '(setq byte-compile-warnings (quote (not unresolved)))'
 # The example above is just for developers, it should not be used by default.
@@ -62,23 +62,16 @@ AUTOGENEL = loaddefs.el \
        eshell/esh-groups.el
 
 # Files to compile before others during a bootstrap.  This is done to
-# speed up the bootstrap process.  The CC files are compiled first
-# because CC mode tweaks the compilation process, and requiring
-# cc-mode when it is not compiled doesn't work during the
-# bootstrapping.
+# speed up the bootstrap process.
 
 COMPILE_FIRST = \
-       $(lisp)/emacs-lisp/byte-opt.el \
-       $(lisp)/emacs-lisp/bytecomp.el \
-       $(lisp)/subr.el \
-       $(lisp)/progmodes/cc-mode.el \
-       $(lisp)/progmodes/cc-vars.el
+       $(lisp)/emacs-lisp/bytecomp.elc \
+       $(lisp)/emacs-lisp/byte-opt.elc \
+       $(lisp)/emacs-lisp/autoload.elc
 
 # The actual Emacs command run in the targets below.
 
 emacs = EMACSLOADPATH=$(lisp) LC_ALL=C $(EMACS) $(EMACSOPT)
-# Prerequisites for running $(emacs)
-emacs-deps = $(lisp)/subdirs.el
 
 # Common command to find subdirectories
 
@@ -89,7 +82,7 @@ setwins=subdirs=`(cd $$wd; find . -type d -print)`; \
           esac; \
         done
 
-# Find all subdirectories except `obsolete'.
+# Find all subdirectories except `obsolete' and `term'.
 
 setwins_almost=subdirs=`(cd $$wd; find . -type d -print)`; \
        for file in $$subdirs; do \
@@ -98,35 +91,55 @@ setwins_almost=subdirs=`(cd $$wd; find . -type d -print)`; \
           esac; \
         done
 
+# `compile-main' tends to be slower than `recompile' but can be parallelized
+# with "make -j" and results in more deterministic compilation warnings.
+# cus-load and finder-inf are not explicitly requested by anything, so
+# we add them here to make sure they get built.
+all: compile-main $(lisp)/cus-load.el $(lisp)/finder-inf.el
+       @: Let us check that we byte-compiled all the files.
+       $(MAKE) $(MFLAGS) compile-last EMACS=$(EMACS)
+
 doit:
 
+# custom-deps and finder-data both used to scan _all_ the *.el files.
+# This could lead to problems in parallel builds if automatically
+# generated *.el files (eg loaddefs etc) were being changed at the same time.
+# One solution was to add autoloads as a prerequisite:
+# http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-01/msg00469.html
+# http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-12/msg00171.html
+# However, this meant that running these targets modified loaddefs.el,
+# every time (due to time-stamping).  Calling these rules from
+# bootstrap-after would modify loaddefs after src/emacs, resulting
+# in make install remaking src/emacs for no real reason:
+# http://lists.gnu.org/archive/html/emacs-devel/2008-02/msg00311.html
+# Nowadays these commands don't scan automatically generated files,
+# since they will never contain any useful information
+# (see finder-no-scan-regexp and custom-dependencies-no-scan-regexp).
 $(lisp)/cus-load.el:
-       touch $@
-# Note that custom-deps and finder-data depend on autoloads rather
-# than on loaddefs.el, so that autoloads does not run in parallel with
-# them under "make -j", because that could delete loaddefs.el from
-# under their feet.
-custom-deps: $(emacs-deps) autoloads $(lisp)/cus-load.el doit
+       $(MAKE) $(MFLAGS) custom-deps
+custom-deps: doit
        wd=$(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins
 
-finder-data: $(emacs-deps) autoloads doit
+$(lisp)/finder-inf.el:
+       $(MAKE) $(MFLAGS) finder-data
+finder-data: doit
        wd=$(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins
 
 # The chmod +w is to handle env var CVSREAD=1.  Files named
 # are identified by being the value of `generated-autoload-file'.
-autoloads: $(emacs-deps) $(LOADDEFS) doit
+autoloads: $(LOADDEFS) doit
        chmod +w $(lisp)/ps-print.el $(lisp)/emulation/tpu-edt.el \
          $(lisp)/emacs-lisp/cl-loaddefs.el
        wd=$(lisp); $(setwins_almost); \
        echo Directories: $$wins; \
        $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
 
-# Note: every rule that runs $(emacs) and is called during bootstrap must
-# depend on this.
+# This is required by the bootstrap-emacs target in ../src/Makefile, so
+# we know that if we have an emacs executable, we also have a subdirs.el.
 $(lisp)/subdirs.el:
        $(MAKE) $(MFLAGS) update-subdirs
 update-subdirs: doit
@@ -149,15 +162,31 @@ TAGS TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
        els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/[^ ]*loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
        ${ETAGS} -o $@ $$els
 
+.PHONY: update-elclist
+
+## Post-bootstrap, find the list of .elc files and use sed to update
+## ELCFILES in Makefile.in.
+## Errors in the final sed are non-fatal, since they have no effect on
+## building Emacs.  chmod +w is for CVSREAD=1.
+## "echo" is non-portable with regards to backslashes, eg between zsh
+## and bash.  Hence the use of sed on line 2 below (line 1 seems to be OK).
+## http://lists.gnu.org/archive/html/emacs-devel/2008-05/msg01535.html
+update-elclist:
+       echo "/^ELCFILES/,/^$$/c\\" > temp.sed
+       echo "ELCFILES =" | sed -e 's/$$/ \\\\\\/' >> temp.sed
+       LC_COLLATE=C ls $(lisp)/*.elc $(lisp)/*/*.elc | sed -e "s|^$(lisp)|     \$$(lisp)|" -e 's/$$/ \\\\\\/' -e '$$ s/ \\\\//' >> temp.sed
+       echo "" >> temp.sed
+       -sed -f temp.sed $(lisp)/Makefile.in > temp-elcfiles || rm temp-elcfiles
+       rm temp.sed
+       @test -f temp-elcfiles || echo "Maintainer warning: failed to update Makefile.in.  You can ignore this if you are not an Emacs developer."
+       if test -f temp-elcfiles; then \
+         chmod +w $(lisp)/Makefile.in; \
+         mv -f temp-elcfiles $(lisp)/Makefile.in; \
+       fi
 
 ## Explicitly list the .elc files, for the sake of parallel builds.
 ## http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-05/msg00016.html
-## This can be done more elegantly, but needs to be portable.
-## This list generated by (after bootstrapping):
-## ls $lisp/*.elc $lisp/*/*.elc | sed -e "s|^$lisp|   \$(lisp)|" -e 's/$/ \\/'
-## and then excluding the members of COMPILE_FIRST.
-## FIXME find a way to automatically update this list in Makefile.in
-## after bootstrap.
+## This can probably be done more elegantly, but needs to be portable.
 ELCFILES = \
        $(lisp)/abbrev.elc \
        $(lisp)/abbrevlist.elc \
@@ -309,7 +338,9 @@ ELCFILES = \
        $(lisp)/emacs-lisp/backquote.elc \
        $(lisp)/emacs-lisp/benchmark.elc \
        $(lisp)/emacs-lisp/bindat.elc \
+       $(lisp)/emacs-lisp/byte-opt.elc \
        $(lisp)/emacs-lisp/byte-run.elc \
+       $(lisp)/emacs-lisp/bytecomp.elc \
        $(lisp)/emacs-lisp/check-declare.elc \
        $(lisp)/emacs-lisp/checkdoc.elc \
        $(lisp)/emacs-lisp/cl-compat.elc \
@@ -463,6 +494,7 @@ ELCFILES = \
        $(lisp)/eshell/eshell.elc \
        $(lisp)/expand.elc \
        $(lisp)/ezimage.elc \
+       $(lisp)/face-remap.elc \
        $(lisp)/facemenu.elc \
        $(lisp)/faces.elc \
        $(lisp)/ffap.elc \
@@ -575,6 +607,7 @@ ELCFILES = \
        $(lisp)/gnus/nngateway.elc \
        $(lisp)/gnus/nnheader.elc \
        $(lisp)/gnus/nnimap.elc \
+       $(lisp)/gnus/nnir.elc \
        $(lisp)/gnus/nnkiboze.elc \
        $(lisp)/gnus/nnlistserv.elc \
        $(lisp)/gnus/nnmail.elc \
@@ -647,7 +680,6 @@ ELCFILES = \
        $(lisp)/informat.elc \
        $(lisp)/international/ccl.elc \
        $(lisp)/international/characters.elc \
-       $(lisp)/international/codepage.elc \
        $(lisp)/international/encoded-kb.elc \
        $(lisp)/international/fontset.elc \
        $(lisp)/international/isearch-x.elc \
@@ -669,7 +701,6 @@ ELCFILES = \
        $(lisp)/international/robin.elc \
        $(lisp)/international/titdic-cnv.elc \
        $(lisp)/international/utf-7.elc \
-       $(lisp)/isearch-multi.elc \
        $(lisp)/isearch.elc \
        $(lisp)/isearchb.elc \
        $(lisp)/iswitchb.elc \
@@ -686,6 +717,7 @@ ELCFILES = \
        $(lisp)/language/ethio-util.elc \
        $(lisp)/language/ethiopic.elc \
        $(lisp)/language/european.elc \
+       $(lisp)/language/hanja-util.elc \
        $(lisp)/language/ind-util.elc \
        $(lisp)/language/indian.elc \
        $(lisp)/language/japan-util.elc \
@@ -730,6 +762,7 @@ ELCFILES = \
        $(lisp)/mail/rmail.elc \
        $(lisp)/mail/rmailedit.elc \
        $(lisp)/mail/rmailkwd.elc \
+       $(lisp)/mail/rmailmm.elc \
        $(lisp)/mail/rmailmsc.elc \
        $(lisp)/mail/rmailout.elc \
        $(lisp)/mail/rmailsort.elc \
@@ -773,6 +806,7 @@ ELCFILES = \
        $(lisp)/minibuf-eldef.elc \
        $(lisp)/minibuffer.elc \
        $(lisp)/misc.elc \
+       $(lisp)/misearch.elc \
        $(lisp)/mouse-copy.elc \
        $(lisp)/mouse-drag.elc \
        $(lisp)/mouse-sel.elc \
@@ -798,8 +832,14 @@ ELCFILES = \
        $(lisp)/net/hmac-md5.elc \
        $(lisp)/net/imap.elc \
        $(lisp)/net/ldap.elc \
+       $(lisp)/net/mairix.elc \
        $(lisp)/net/net-utils.elc \
        $(lisp)/net/netrc.elc \
+       $(lisp)/net/newst-backend.elc \
+       $(lisp)/net/newst-plainview.elc \
+       $(lisp)/net/newst-reader.elc \
+       $(lisp)/net/newst-ticker.elc \
+       $(lisp)/net/newst-treeview.elc \
        $(lisp)/net/newsticker.elc \
        $(lisp)/net/ntlm.elc \
        $(lisp)/net/quickurl.elc \
@@ -825,6 +865,7 @@ ELCFILES = \
        $(lisp)/net/tramp.elc \
        $(lisp)/net/trampver.elc \
        $(lisp)/net/webjump.elc \
+       $(lisp)/net/xesam.elc \
        $(lisp)/net/zeroconf.elc \
        $(lisp)/newcomment.elc \
        $(lisp)/novice.elc \
@@ -852,33 +893,25 @@ ELCFILES = \
        $(lisp)/nxml/rng-xsd.elc \
        $(lisp)/nxml/xmltok.elc \
        $(lisp)/nxml/xsd-regexp.elc \
-       $(lisp)/obsolete/auto-show.elc \
        $(lisp)/obsolete/awk-mode.elc \
-       $(lisp)/obsolete/bg-mouse.elc \
        $(lisp)/obsolete/fast-lock.elc \
-       $(lisp)/obsolete/float.elc \
-       $(lisp)/obsolete/hilit19.elc \
-       $(lisp)/obsolete/hscroll.elc \
        $(lisp)/obsolete/iso-acc.elc \
        $(lisp)/obsolete/iso-insert.elc \
        $(lisp)/obsolete/iso-swed.elc \
        $(lisp)/obsolete/lazy-lock.elc \
-       $(lisp)/obsolete/lselect.elc \
-       $(lisp)/obsolete/mlsupport.elc \
        $(lisp)/obsolete/old-whitespace.elc \
-       $(lisp)/obsolete/ooutline.elc \
        $(lisp)/obsolete/options.elc \
-       $(lisp)/obsolete/profile.elc \
+       $(lisp)/obsolete/resume.elc \
        $(lisp)/obsolete/rnews.elc \
        $(lisp)/obsolete/rnewspost.elc \
-       $(lisp)/obsolete/rsz-mini.elc \
        $(lisp)/obsolete/sc.elc \
        $(lisp)/obsolete/scribe.elc \
        $(lisp)/obsolete/swedish.elc \
-       $(lisp)/obsolete/uncompress.elc \
+       $(lisp)/obsolete/vc-mcvs.elc \
        $(lisp)/obsolete/x-menu.elc \
        $(lisp)/org/org-agenda.elc \
        $(lisp)/org/org-archive.elc \
+       $(lisp)/org/org-attach.elc \
        $(lisp)/org/org-bbdb.elc \
        $(lisp)/org/org-bibtex.elc \
        $(lisp)/org/org-clock.elc \
@@ -887,20 +920,27 @@ ELCFILES = \
        $(lisp)/org/org-exp.elc \
        $(lisp)/org/org-export-latex.elc \
        $(lisp)/org/org-faces.elc \
+       $(lisp)/org/org-footnote.elc \
        $(lisp)/org/org-gnus.elc \
+       $(lisp)/org/org-id.elc \
        $(lisp)/org/org-info.elc \
+       $(lisp)/org/org-install.elc \
        $(lisp)/org/org-irc.elc \
        $(lisp)/org/org-jsinfo.elc \
+       $(lisp)/org/org-list.elc \
        $(lisp)/org/org-mac-message.elc \
        $(lisp)/org/org-macs.elc \
        $(lisp)/org/org-mew.elc \
        $(lisp)/org/org-mhe.elc \
        $(lisp)/org/org-mouse.elc \
+       $(lisp)/org/org-plot.elc \
        $(lisp)/org/org-publish.elc \
        $(lisp)/org/org-remember.elc \
        $(lisp)/org/org-rmail.elc \
        $(lisp)/org/org-table.elc \
+       $(lisp)/org/org-timer.elc \
        $(lisp)/org/org-vm.elc \
+       $(lisp)/org/org-w3m.elc \
        $(lisp)/org/org-wl.elc \
        $(lisp)/org/org.elc \
        $(lisp)/outline.elc \
@@ -972,8 +1012,10 @@ ELCFILES = \
        $(lisp)/progmodes/cc-fonts.elc \
        $(lisp)/progmodes/cc-langs.elc \
        $(lisp)/progmodes/cc-menus.elc \
+       $(lisp)/progmodes/cc-mode.elc \
        $(lisp)/progmodes/cc-styles.elc \
        $(lisp)/progmodes/cc-subword.elc \
+       $(lisp)/progmodes/cc-vars.elc \
        $(lisp)/progmodes/cfengine.elc \
        $(lisp)/progmodes/cmacexp.elc \
        $(lisp)/progmodes/compile.elc \
@@ -1023,6 +1065,7 @@ ELCFILES = \
        $(lisp)/progmodes/prolog.elc \
        $(lisp)/progmodes/ps-mode.elc \
        $(lisp)/progmodes/python.elc \
+       $(lisp)/progmodes/ruby-mode.elc \
        $(lisp)/progmodes/scheme.elc \
        $(lisp)/progmodes/sh-script.elc \
        $(lisp)/progmodes/simula.elc \
@@ -1045,7 +1088,6 @@ ELCFILES = \
        $(lisp)/repeat.elc \
        $(lisp)/replace.elc \
        $(lisp)/reposition.elc \
-       $(lisp)/resume.elc \
        $(lisp)/reveal.elc \
        $(lisp)/rfn-eshadow.elc \
        $(lisp)/rot13.elc \
@@ -1071,13 +1113,16 @@ ELCFILES = \
        $(lisp)/speedbar.elc \
        $(lisp)/startup.elc \
        $(lisp)/strokes.elc \
+       $(lisp)/subr.elc \
        $(lisp)/t-mouse.elc \
        $(lisp)/tabify.elc \
        $(lisp)/talk.elc \
        $(lisp)/tar-mode.elc \
        $(lisp)/tempo.elc \
        $(lisp)/term.elc \
-       $(lisp)/term/mac-win.elc \
+       $(lisp)/term/common-win.elc \
+       $(lisp)/term/internal.elc \
+       $(lisp)/term/ns-win.elc \
        $(lisp)/term/pc-win.elc \
        $(lisp)/term/rxvt.elc \
        $(lisp)/term/sun.elc \
@@ -1123,6 +1168,7 @@ ELCFILES = \
        $(lisp)/textmodes/reftex-vars.elc \
        $(lisp)/textmodes/reftex.elc \
        $(lisp)/textmodes/remember.elc \
+       $(lisp)/textmodes/rst.elc \
        $(lisp)/textmodes/sgml-mode.elc \
        $(lisp)/textmodes/spell.elc \
        $(lisp)/textmodes/table.elc \
@@ -1175,16 +1221,17 @@ ELCFILES = \
        $(lisp)/url/url-util.elc \
        $(lisp)/url/url-vars.elc \
        $(lisp)/url/url.elc \
-       $(lisp)/url/vc-dav.elc \
        $(lisp)/userlock.elc \
+       $(lisp)/vc-annotate.elc \
        $(lisp)/vc-arch.elc \
        $(lisp)/vc-bzr.elc \
        $(lisp)/vc-cvs.elc \
+       $(lisp)/vc-dav.elc \
+       $(lisp)/vc-dir.elc \
        $(lisp)/vc-dispatcher.elc \
        $(lisp)/vc-git.elc \
        $(lisp)/vc-hg.elc \
        $(lisp)/vc-hooks.elc \
-       $(lisp)/vc-mcvs.elc \
        $(lisp)/vc-mtn.elc \
        $(lisp)/vc-rcs.elc \
        $(lisp)/vc-sccs.elc \
@@ -1209,6 +1256,19 @@ ELCFILES = \
        $(lisp)/xml.elc \
        $(lisp)/xt-mouse.elc
 
+# The src/Makefile.in has its own set of dependencies and when they decide
+# that one Lisp file needs to be re-compiled, we had better recompile it as
+# well, otherwise every subsequent make will again call us, until we finally
+# end up deciding that yes, the file deserves recompilation.
+# One option is to try and reproduce exactly the same dependencies here as
+# we have in src/Makefile.in, but it turns out to be painful
+# (e.g. src/Makefile.in may have a dependency for ../lisp/foo.elc where we
+# only know of $(lisp)/foo.elc).  So instead we provide a direct way for
+# src/Makefile.in to rebuild a particular Lisp file, no questions asked.
+compile-onefile:
+       @echo Compiling $(THEFILE)
+       @$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(THEFILE)
+
 # Files MUST be compiled one by one. If we compile several files in a
 # row (i.e., in the same instance of Emacs) we can't make sure that
 # the compilation environment is clean.  We also set the load-path of
@@ -1228,11 +1288,7 @@ ELCFILES = \
 
 .PHONY: compile-first compile-main compile-last compile compile-always
 
-compile-first: $(emacs-deps) $(LOADDEFS) autoloads $(COMPILE_FIRST)
-       for el in $(COMPILE_FIRST); do \
-         echo Compiling $$el; \
-         $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el || exit 1; \
-       done
+compile-first: $(COMPILE_FIRST)
 
 compile-main: $(ELCFILES)
 
@@ -1240,31 +1296,36 @@ compile-main: $(ELCFILES)
 # date.  Some .el files don't get compiled because they set the
 # local variable no-byte-compile.
 # Calling make recursively because suffix rule cannot have prerequisites.
-compile: $(emacs-deps) $(LOADDEFS) autoloads compile-first
-       $(MAKE) $(MFLAGS) compile-main
-       $(MAKE) $(MFLAGS) compile-last
+# Explicitly pass EMACS (sometimes ../src/bootstrap-emacs) to those
+# sub-makes that run rules that use it, for the sake of some non-GNU makes.
+compile: $(LOADDEFS) autoloads compile-first
+       $(MAKE) $(MFLAGS) compile-main EMACS=$(EMACS)
+       $(MAKE) $(MFLAGS) compile-last EMACS=$(EMACS)
+
+## Doing this causes make install to dump another emacs.
+#      $(MAKE) $(MFLAGS) update-elclist
 
 # Compile all Lisp files.  This is like `compile' but compiles files
 # unconditionally.  Some files don't actually get compiled because they
 # set the local variable no-byte-compile.
 compile-always: doit
        cd $(lisp); rm -f *.elc */*.elc
-       $(MAKE) $(MFLAGS) compile
+       $(MAKE) $(MFLAGS) compile EMACS=$(EMACS)
 
 ## In case any files are missing from ELCFILES.
+## Why is the UnicodeData check needed, when these files are no-byte-compile?
 compile-last:
        @wd=$(lisp); $(setwins); \
-       els=`echo $$wins | tr ' \011' '\012\012' | \
-               sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
-       for el in $(COMPILE_FIRST) $$els; do \
-         elc=$${el}c; \
-         if test -f $$el && ! test -f $$elc && \
-           ! grep 'no-byte-compile: t' $$el > /dev/null; then \
-             sel=`echo $el | sed "s|^$$lisp|\$$(lisp)|"`; \
-             echo "Maintainer warning: $$sel missing from \$$ELCFILES?"; \
-             echo "Compiling $$el"; \
-             $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
-         fi \
+       els=`echo "$$wins " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 's| |/*.el |g'`; \
+       for el in $$els; do \
+         test -f $$el || continue; \
+         test -f $${el}c && continue; \
+         grep 'no-byte-compile: t' $$el > /dev/null && continue; \
+         head -n 1 $$el | grep '^;; Automatically generated from UnicodeData.txt.' > /dev/null && continue; \
+         sel=`echo $$el | sed "s|^$(lisp)|\\$$(lisp)|"`; \
+         echo "Maintainer warning: $$sel missing from \$$ELCFILES?"; \
+         echo "Compiling $$el"; \
+         $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
        done
 
 compile-calc:
@@ -1286,21 +1347,20 @@ compile-after-backup: backup-compiled-files compile-always
 
 # Recompile all Lisp files which are newer than their .elc files and compile
 # new ones.
-# FIXME this could use the 'compile' target now, and let make figure out
-# what needs to be done.  That would be parallelizable, but would not
-# pick up new files not in ELCFILES.
-recompile: doit $(LOADDEFS) $(lisp)/progmodes/cc-mode.elc
+# This has the same effect as compile-main (followed up with compile-last,
+# if ELCFILES is out of date).  recompile has some advantages:
+# i) It is faster (on a single processor), since it only has to start
+# Emacs once.  It was 33% faster on a test with a random 10% of the .el
+# files needing recompilation.
+# ii) The explicit cc-mode dependency.
+# recompile's disadvantages are:
+# i) Not parallelizable.
+# ii) Compiling multiple files in the same instance of Emacs is wrong,
+# since the environment of later files is affected by definitions in
+# earlier ones.
+recompile: doit $(LOADDEFS) compile-first $(lisp)/progmodes/cc-mode.elc
        $(emacs) --eval "(batch-byte-recompile-directory 0)" $(lisp)
 
-# CC Mode uses a compile time macro system which causes a compile time
-# dependency in cc-mode.elc on the macros in cc-langs.el and the
-# version string in cc-defs.el.
-$(lisp)/progmodes/cc-mode.elc: \
-       $(lisp)/progmodes/cc-mode.el \
-       $(lisp)/progmodes/cc-langs.el \
-       $(lisp)/progmodes/cc-defs.el
-       $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $@
-
 # Update MH-E internal autoloads. These are not to be confused with
 # the autoloads for the MH-E entry points, which are already in loaddefs.el.
 MH_E_DIR = $(lisp)/mh-e
@@ -1320,7 +1380,7 @@ MH_E_SRC = $(MH_E_DIR)/mh-acros.el $(MH_E_DIR)/mh-alias.el    \
        $(MH_E_DIR)/mh-xface.el
 
 mh-autoloads: $(MH_E_DIR)/mh-loaddefs.el
-$(MH_E_DIR)/mh-loaddefs.el: $(emacs-deps) $(MH_E_SRC)
+$(MH_E_DIR)/mh-loaddefs.el: $(MH_E_SRC)
        $(emacs) -l autoload \
           --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
           --eval "(setq generated-autoload-file \"$@\")" \
@@ -1342,21 +1402,21 @@ CAL_SRC = $(CAL_DIR)/cal-bahai.el $(CAL_DIR)/cal-china.el  \
        $(CAL_DIR)/holidays.el    $(CAL_DIR)/lunar.el      \
        $(CAL_DIR)/solar.el
 
-$(CAL_DIR)/cal-loaddefs.el: $(emacs-deps) $(CAL_SRC)
+$(CAL_DIR)/cal-loaddefs.el: $(CAL_SRC)
        $(emacs) -l autoload \
           --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
           --eval "(setq generated-autoload-file \"$@\")" \
           --eval "(setq make-backup-files nil)" \
           -f batch-update-autoloads $(CAL_DIR)
 
-$(CAL_DIR)/diary-loaddefs.el: $(emacs-deps) $(CAL_SRC)
+$(CAL_DIR)/diary-loaddefs.el: $(CAL_SRC)
        $(emacs) -l autoload \
           --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
           --eval "(setq generated-autoload-file \"$@\")" \
           --eval "(setq make-backup-files nil)" \
           -f batch-update-autoloads $(CAL_DIR)
 
-$(CAL_DIR)/hol-loaddefs.el: $(emacs-deps) $(CAL_SRC)
+$(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC)
        $(emacs) -l autoload \
           --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
           --eval "(setq generated-autoload-file \"$@\")" \
@@ -1376,36 +1436,121 @@ $(CAL_DIR)/hol-loaddefs.el: $(emacs-deps) $(CAL_SRC)
 # local changes.  (Because loaddefs.el is an automatically generated
 # file, we don't want to store it in the source repository).
 
-bootstrap-prepare:
-       if test -x $(EMACS); then                               \
-         $(MAKE) $(MFLAGS) autoloads;                          \
-       fi
-
-maintainer-clean: distclean bootstrap-clean
-       cd $(lisp); rm -f $(AUTOGENEL)
-
-## NB note that this rules assume only one level of subdirs below lisp/.
-## If nested subdirs are added, it's probably time to switch to:
-## find $(lisp) -name "*.elc" -exec rm -f '{}' ';'
 bootstrap-clean:
-       cd $(lisp); rm -f *.elc */*.elc
-
-# Generate/update files for the bootstrap process.
-
-bootstrap: update-subdirs autoloads compile
-
-# Generate/update files after the bootstrap process.
-# custom-deps needs `preloaded-file-list'.
-
-bootstrap-after: finder-data custom-deps
+       cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL)
 
 distclean:
        -rm -f ./Makefile
 
+maintainer-clean: distclean bootstrap-clean
+
 .PHONY: check-declare
 
 check-declare:
        $(emacs) -l $(lisp)/emacs-lisp/check-declare \
          --eval '(check-declare-directory "$(lisp)")'
 
+# Dependencies
+
+# CC Mode uses a compile time macro system which causes a compile time
+# dependency in cc-*.elc files on the macros in other cc-*.el and the
+# version string in cc-defs.el.
+$(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-awk.elc\
+ $(lisp)/progmodes/cc-cmds.elc $(lisp)/progmodes/cc-compat.elc\
+ $(lisp)/progmodes/cc-engine.elc $(lisp)/progmodes/cc-fonts.elc\
+ $(lisp)/progmodes/cc-langs.elc $(lisp)/progmodes/cc-menus.elc\
+ $(lisp)/progmodes/cc-mode.elc $(lisp)/progmodes/cc-styles.elc\
+ $(lisp)/progmodes/cc-subword.elc $(lisp)/progmodes/cc-vars.elc: \
+   $(lisp)/progmodes/cc-bytecomp.elc $(lisp)/progmodes/cc-defs.elc
+
+$(lisp)/progmodes/cc-align.elc: \
+   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc
+
+$(lisp)/progmodes/cc-cmds.elc: \
+   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc
+
+$(lisp)/progmodes/cc-compat.elc: \
+   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-styles.elc \
+   $(lisp)/progmodes/cc-engine.elc
+
+$(lisp)/progmodes/cc-defs.elc: $(lisp)/progmodes/cc-bytecomp.elc \
+   $(lisp)/emacs-lisp/cl.elc $(lisp)/emacs-lisp/regexp-opt.elc
+
+$(lisp)/progmodes/cc-engine.elc: $(lisp)/progmodes/cc-langs.elc \
+   $(lisp)/progmodes/cc-vars.elc
+
+$(lisp)/progmodes/cc-fonts.elc: $(lisp)/progmodes/cc-langs.elc \
+   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \
+   $(lisp)/font-lock.elc
+
+$(lisp)/progmodes/cc-langs.elc: $(lisp)/progmodes/cc-vars.elc \
+   $(lisp)/emacs-lisp/cl.elc
+
+$(lisp)/progmodes/cc-mode.elc: $(lisp)/progmodes/cc-langs.elc \
+   $(lisp)/progmodes/cc-vars.elc $(lisp)/progmodes/cc-engine.elc \
+   $(lisp)/progmodes/cc-styles.elc $(lisp)/progmodes/cc-cmds.elc \
+   $(lisp)/progmodes/cc-align.elc $(lisp)/progmodes/cc-menus.elc
+
+$(lisp)/progmodes/cc-styles.elc: $(lisp)/progmodes/cc-vars.elc \
+   $(lisp)/progmodes/cc-align.elc
+
+$(lisp)/progmodes/cc-subword.elc: $(lisp)/progmodes/cc-cmds.elc
+
+$(lisp)/progmodes/cc-vars.elc: $(lisp)/custom.elc $(lisp)/widget.elc
+
+# MH-E dependencies, mainly to prevent failures with parallel
+# compilation, due to race conditions between writing a given FOO.elc
+# file and another file being compiled that says "(require FOO)",
+# which causes Emacs to try to read FOO.elc.
+$(MH_E_DIR)/mh-alias.elc $(MH_E_DIR)/mh-comp.elc $(MH_E_DIR)/mh-folder.elc\
+ $(MH_E_DIR)/mh-funcs.elc $(MH_E_DIR)/mh-identity.elc $(MH_E_DIR)/mh-inc.elc\
+ $(MH_E_DIR)/mh-junk.elc $(MH_E_DIR)/mh-letter.elc $(MH_E_DIR)/mh-limit.elc\
+ $(MH_E_DIR)/mh-mime.elc $(MH_E_DIR)/mh-print.elc $(MH_E_DIR)/mh-scan.elc\
+ $(MH_E_DIR)/mh-search.elc $(MH_E_DIR)/mh-seq.elc $(MH_E_DIR)/mh-show.elc\
+ $(MH_E_DIR)/mh-speed.elc $(MH_E_DIR)/mh-thread.elc $(MH_E_DIR)/mh-tool-bar.elc\
+ $(MH_E_DIR)/mh-utils.elc $(MH_E_DIR)/mh-xface.elc:\
+   $(MH_E_DIR)/mh-e.elc
+
+$(MH_E_DIR)/mh-alias.elc $(MH_E_DIR)/mh-e.elc $(MH_E_DIR)/mh-folder.elc\
+ $(MH_E_DIR)/mh-inc.elc $(MH_E_DIR)/mh-junk.elc $(MH_E_DIR)/mh-limit.elc\
+ $(MH_E_DIR)/mh-search.elc $(MH_E_DIR)/mh-seq.elc $(MH_E_DIR)/mh-speed.elc\
+ $(MH_E_DIR)/mh-utils.elc $(MH_E_DIR)/mh-xface.elc:\
+   $(lisp)/emacs-lisp/cl.elc
+
+$(MH_E_DIR)/mh-comp.elc $(MH_E_DIR)/mh-folder.elc $(MH_E_DIR)/mh-funcs.elc\
+ $(MH_E_DIR)/mh-junk.elc $(MH_E_DIR)/mh-limit.elc $(MH_E_DIR)/mh-print.elc\
+ $(MH_E_DIR)/mh-seq.elc $(MH_E_DIR)/mh-show.elc $(MH_E_DIR)/mh-thread.elc:\
+   $(MH_E_DIR)/mh-scan.elc
+
+$(MH_E_DIR)/mh-folder.elc $(MH_E_DIR)/mh-letter.elc $(MH_E_DIR)/mh-mime.elc\
+ $(MH_E_DIR)/mh-search.elc $(MH_E_DIR)/mh-show.elc $(MH_E_DIR)/mh-speed.elc:\
+   $(lisp)/gnus/gnus-util.elc
+
+$(MH_E_DIR)/mh-folder.elc $(MH_E_DIR)/mh-search.elc:\
+   $(lisp)/progmodes/which-func.elc
+
+$(MH_E_DIR)/mh-letter.elc $(MH_E_DIR)/mh-seq.elc $(MH_E_DIR)/mh-show.elc\
+ $(MH_E_DIR)/mh-utils.elc:\
+   $(lisp)/font-lock.elc
+
+$(MH_E_DIR)/mh-alias.elc $(MH_E_DIR)/mh-show.elc: $(lisp)/net/goto-addr.elc
+
+$(MH_E_DIR)/mh-comp.elc: $(lisp)/mail/sendmail.elc
+
+$(MH_E_DIR)/mh-e.elc: $(MH_E_DIR)/mh-buffers.elc $(lisp)/gnus/gnus.elc \
+   $(lisp)/cus-face.elc
+
+$(MH_E_DIR)/mh-letter.elc: $(lisp)/gnus/mailcap.elc $(lisp)/gnus/mm-decode.elc \
+   $(lisp)/gnus/mm-view.elc  $(lisp)/gnus/mml.elc $(lisp)/gnus/message.elc
+
+$(MH_E_DIR)/mh-print.elc:  $(lisp)/ps-print.elc
+
+$(MH_E_DIR)/mh-search.elc: $(lisp)/imenu.elc
+
+$(MH_E_DIR)/mh-show.elc: $(lisp)/gnus/gnus-cite.elc
+
+$(MH_E_DIR)/mh-speed.elc: $(lisp)/speedbar.elc $(lisp)/emacs-lisp/timer.elc
+
+$(MH_E_DIR)/mh-tool-bar.elc: $(lisp)/tool-bar.elc
+
 # Makefile ends here.