From da313ecaea3f2fad5eee6582dba5e0cc95ee5ea0 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Thu, 26 Jun 2014 20:41:23 -0400 Subject: [PATCH] Replace BOOTSTRAPEMACS with an order-only dependence on bootstrap-emacs * 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 | 2 ++ Makefile.in | 15 +-------------- src/ChangeLog | 10 ++++++++++ src/Makefile.in | 40 ++++++++++++++-------------------------- 4 files changed, 27 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index fb4bea3592..3a5797a7ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-27 Glenn Morris + * Makefile.in (src): No more need to pass BOOTSTRAPEMACS. + * make-dist: Exclude test/automated/*.log. 2014-06-26 Glenn Morris diff --git a/Makefile.in b/Makefile.in index ce44aa5de8..0fd9f980ca 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/src/ChangeLog b/src/ChangeLog index da46ead2b9..b25e2d487d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2014-06-27 Glenn Morris + + * 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 * fns.c (Fcompare_strings): Use FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE. diff --git a/src/Makefile.in b/src/Makefile.in index 5bed189f16..748f38e55b 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -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 -- 2.20.1