Replace BOOTSTRAPEMACS with an order-only dependence on bootstrap-emacs
authorGlenn Morris <rgm@gnu.org>
Fri, 27 Jun 2014 00:41:23 +0000 (20:41 -0400)
committerGlenn Morris <rgm@gnu.org>
Fri, 27 Jun 2014 00:41:23 +0000 (20:41 -0400)
* Makefile.in (src): No more need to pass BOOTSTRAPEMACS.

* src/Makefile.in (.el.elc): Replace suffix rule with pattern rule.
(%.elc): New pattern rule, with order-only prerequisite.
($(lisp)): No more need to depend on BOOTSTRAPEMACS.
($(lispsource)/loaddefs.el): Use an order-only prerequisite
in place of BOOTSTRAPEMACS.

Fixes: debbugs:2151

ChangeLog
Makefile.in
src/ChangeLog
src/Makefile.in

index fb4bea3..3a5797a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-06-27  Glenn Morris  <rgm@gnu.org>
 
+       * Makefile.in (src): No more need to pass BOOTSTRAPEMACS.
+
        * make-dist: Exclude test/automated/*.log.
 
 2014-06-26  Glenn Morris  <rgm@gnu.org>
index ce44aa5..0fd9f98 100644 (file)
@@ -368,16 +368,6 @@ lisp: src
 lib lib-src lisp nt: Makefile
        $(MAKE) -C $@ all
 
-# Pass to src/Makefile.in an additional BOOTSTRAPEMACS variable which
-# is either set to bootstrap-emacs (in case bootstrap-emacs has not been
-# constructed yet) or the empty string (otherwise).
-# src/Makefile.in uses it to implement conditional dependencies, so that
-# files that need bootstrap-emacs to be built do not additionally need
-# to be kept fresher than bootstrap-emacs.  Otherwise changing a single
-# file src/foo.c forces dumping a new bootstrap-emacs, then re-byte-compiling
-# all preloaded elisp files, and only then dump the actual src/emacs, which
-# is not wrong, but is overkill in 99.99% of the cases.
-#
 # Note the use of single quotes in the value of vcswitness.
 # This passes an unexpanded $srcdir to src's Makefile, which then
 # expands it using its own value of srcdir (which points to the
@@ -386,10 +376,7 @@ src: Makefile
        dirstate='.bzr/checkout/dirstate';                              \
        vcswitness='$$(srcdir)/../'$$dirstate;                          \
        [ -r "$(srcdir)/$$dirstate" ] || vcswitness='';                 \
-       cd $@ || exit;                                                  \
-       boot=bootstrap-emacs$(EXEEXT);                                  \
-       [ ! -x "$$boot" ] || boot='';                                   \
-       $(MAKE) all BOOTSTRAPEMACS="$$boot" VCSWITNESS="$$vcswitness"
+       $(MAKE) -C $@ all VCSWITNESS="$$vcswitness"
 
 blessmail: Makefile src
        $(MAKE) -C lib-src maybe-blessmail
index da46ead..b25e2d4 100644 (file)
@@ -1,3 +1,13 @@
+2014-06-27  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in: Replace BOOTSTRAPEMACS sleight-of-hand
+       with an order-only dependence on bootstrap-emacs.  (Bug#2151)
+       (.el.elc): Replace suffix rule with pattern rule.
+       (%.elc): New pattern rule, with order-only prerequisite.
+       ($(lisp)): No more need to depend on BOOTSTRAPEMACS.
+       ($(lispsource)/loaddefs.el): Use an order-only prerequisite
+       in place of BOOTSTRAPEMACS.
+
 2014-06-26  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * fns.c (Fcompare_strings): Use FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE.
index 5bed189..748f38e 100644 (file)
@@ -1,7 +1,7 @@
 ### @configure_input@
 
-# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2014 Free Software
-# Foundation, Inc.
+# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2014
+#   Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -594,40 +594,28 @@ tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS
 ## such as loaddefs.el or *.elc can typically be produced by any old
 ## Emacs executable, so we would like to avoid rebuilding them whenever
 ## we build a new Emacs executable.
+##
+## (In other words, changing a single file src/foo.c would force
+## dumping a new bootstrap-emacs, then re-byte-compiling all preloaded
+## elisp files, and only then dump the actual src/emacs, which is not
+## wrong, but is overkill in 99.99% of the cases.)
+##
 ## To solve the circularity, we use 2 different Emacs executables,
 ## "emacs" is the main target and "bootstrap-emacs" is the one used
 ## to build the *.elc and loaddefs.el files.
-## To solve the freshness issue, we used to use a third file "witness-emacs"
-## which was used to witness the fact that there is a bootstrap-emacs
-## executable, and then have dependencies on witness-emacs rather than
-## bootstrap-emacs, but that lead to problems in parallel builds (because
-## witness-emacs needed to be free from dependencies (to avoid rebuilding
-## it), so it was compiled in parallel, leading typically to having 2
-## processes dumping bootstrap-emacs at the same time).
-## So instead, we replace the witness-emacs dependencies by conditional
-## bootstrap-dependencies (via $(BOOTSTRAPEMACS)).  Of course, since we do
-## not want to rely on GNU Make features, we have to rely on an external
-## script to do the conditional part of the dependency
-## (i.e. see the $(SUBDIR) rule ../Makefile.in).
-
-.SUFFIXES: .elc .el
-
-## These suffix rules do not allow additional dependencies, sadly, so
-## instead of adding a $(BOOTSTRAPEMACS) dependency here, we add it
-## separately below.
-## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)"
-.el.elc:
-       @$(MAKE) -C ../lisp compile-onefile THEFILE=$< EMACS="$(bootstrap_exe)"
+## To solve the freshness issue, in the past we tried various clever tricks,
+## but now that we require GNU make, we can simply specify
+## bootstrap-emacs$(EXEEXT) as an order-only prerequisite.
 
-## Since the .el.elc rule cannot specify an extra dependency, we do it here.
-$(lisp): $(BOOTSTRAPEMACS)
+%.elc: %.el | bootstrap-emacs$(EXEEXT)
+       @$(MAKE) -C ../lisp compile-onefile THEFILE=$< EMACS="$(bootstrap_exe)"
 
 ## VCSWITNESS points to the file that holds info about the current checkout.
 ## We use it as a heuristic to decide when to rebuild loaddefs.el.
 ## If empty it is ignored; the parent makefile can set it to some other value.
 VCSWITNESS =
 
-$(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS)
+$(lispsource)/loaddefs.el: $(VCSWITNESS) | bootstrap-emacs$(EXEEXT)
        $(MAKE) -C ../lisp autoloads EMACS="$(bootstrap_exe)"
 
 ## Dump an Emacs executable named bootstrap-emacs containing the