From: Alan Mackenzie <acm@muc.de>
To: Robert Pluim <rpluim@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Speeding up the bootstrap build - a quick hack.
Date: Thu, 20 Jan 2022 11:35:17 +0000 [thread overview]
Message-ID: <YelI9WQnP6UzUTAB@ACM> (raw)
In-Reply-To: <87fspilpx5.fsf@gmail.com>
Hello, Robert.
On Thu, Jan 20, 2022 at 10:25:26 +0100, Robert Pluim wrote:
> >>>>> On Wed, 19 Jan 2022 21:32:30 +0000, Alan Mackenzie <acm@muc.de> said:
> Alan> This was surprisingly difficult to solve. There appears to be no way in
> Alan> make to set a variable depending on what the target is. The make manual
> Alan> doesn't say this explicitly, it just depends on vagueness. After an hour
> Alan> of searching for such a feature, it gradually dawns on you that there is
> Alan> no such feature, even though one might be expected. I'm glad the Emacs
> Alan> manuals aren't like that.
> "Target-specific Variable Values" in the Gnu Make info manual. eg
> Makefile:
> FOO=bar
> default:
> @echo FOO=$(FOO)
> foo: FOO=foo
> foo:
> @echo FOO=$(FOO)
> results:
> > make
> FOO=bar
> > make foo
> FOO=foo
Thank you indeed. That's exactly what I needed. I've amended my patch to use
this.
So, if there are no objections, I'll be committing the following to
master within the next day or so:
In early bootstrap, use byte-compiled compiler to native compile first files
This speeds up a make bootstrap by around 15%.
* lisp/Makefile.in (BYTE_COMPILE_FLAGS): set a value specific to compile-first
which doesn't contain the setting of Emacs variable load-prefer-newer.
Add a new make hunk which byte-compiles (rather then native compiles) when the
environment variable ANCIENT is "yes". Set the date of the .elc files built
to 1970-01-01 to cause a second compilation of them later.
* src/Makefile.in: Add an extra invocation of directory lisp's MAKE with
target compile-first and the flag environment variable ANCIENT set to yes.
* src/verbose.mk.in: When ANCIENT is yes, output ELC, not ELC+ELN for
AM_V_ELC.
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 3a72034463..3d03b16331 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -77,6 +77,8 @@ AUTOGENEL =
# Set load-prefer-newer for the benefit of the non-bootstrappers.
BYTE_COMPILE_FLAGS = \
--eval '(setq load-prefer-newer t)' $(BYTE_COMPILE_EXTRA_FLAGS)
+# ... but we must prefer .elc files for those in the early bootstrap.
+compile-first: BYTE_COMPILE_FLAGS = $(BYTE_COMPILE_EXTRA_FLAGS)
# Files to compile before others during a bootstrap. This is done to
# speed up the bootstrap process. They're ordered by size, so we use
@@ -303,9 +305,22 @@ .SUFFIXES:
# An old-fashioned suffix rule, which, according to the GNU Make manual,
# cannot have prerequisites.
ifeq ($(HAVE_NATIVE_COMP),yes)
+ifeq ($(ANCIENT),yes)
+# The first compilation of compile-first, using an interpreted compiler:
+# The resulting .elc files get given a date of 1970-01-01 so that their
+# date stamp is earlier than the source files, causing these to be compiled
+# into native code at the second recursive invocation of this $(MAKE),
+# using these .elc's. This is faster than just compiling the native code
+# directly using the interpreted compile-first files.
+.el.elc:
+ $(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
+ -l comp -f batch-byte-compile $<
+ touch -t 197001010000 $@
+else
.el.elc:
$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) \
-l comp -f batch-byte+native-compile $<
+endif
else
.el.elc:
$(AM_V_ELC)$(emacs) $(BYTE_COMPILE_FLAGS) -f batch-byte-compile $<
diff --git a/src/Makefile.in b/src/Makefile.in
index 04fabd5f42..13392bfad6 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -914,6 +914,9 @@ $(bootstrap_pdmp):
$(RUN_TEMACS) --batch $(BUILD_DETAILS) -l loadup --temacs=pbootstrap \
--bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR)
@: Compile some files earlier to speed up further compilation.
+ @: First, byte compile these files, ....
+ ANCIENT=yes $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
+ @: .... then use their .elcs in native compiling these and other files.
$(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
endif
diff --git a/src/verbose.mk.in b/src/verbose.mk.in
index e3f5678303..01076df946 100644
--- a/src/verbose.mk.in
+++ b/src/verbose.mk.in
@@ -40,12 +40,17 @@ AM_V_CXX = @$(info $ CXX $@)
AM_V_CCLD = @$(info $ CCLD $@)
AM_V_CXXLD = @$(info $ CXXLD $@)
ifeq ($(HAVE_NATIVE_COMP),yes)
-ifeq ($(NATIVE_DISABLED),1)
+ifneq ($(NATIVE_DISABLED),1)
+ifneq ($(ANCIENT),yes)
+AM_V_ELC = @$(info $ ELC+ELN $@)
+AM_V_ELN = @$(info $ ELN $@)
+else
AM_V_ELC = @$(info $ ELC $@)
AM_V_ELN =
+endif
else
-AM_V_ELC = @$(info $ ELC+ELN $@)
-AM_V_ELN = @$(info $ ELN $@)
+AM_V_ELC = @$(info $ ELC $@)
+AM_V_ELN =
endif
else
AM_V_ELC = @$(info $ ELC $@)
> Robert
> --
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2022-01-20 11:35 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 20:26 Speeding up the bootstrap build - a quick hack Alan Mackenzie
2022-01-17 20:55 ` Stefan Monnier
2022-01-18 11:56 ` Alan Mackenzie
2022-01-18 13:14 ` Stefan Monnier
2022-01-18 20:27 ` Alan Mackenzie
2022-01-18 20:48 ` Stefan Monnier
2022-01-19 11:50 ` Alan Mackenzie
2022-01-19 14:34 ` Stefan Monnier
2022-01-19 15:24 ` Stefan Monnier
2022-01-18 13:16 ` Robert Pluim
2022-01-18 14:04 ` Alan Mackenzie
2022-01-18 14:13 ` Robert Pluim
2022-01-18 14:24 ` Stefan Monnier
2022-01-18 14:35 ` Robert Pluim
2022-01-18 15:13 ` Robert Pluim
2022-01-18 16:50 ` Eli Zaretskii
2022-01-18 16:09 ` Andrea Corallo
2022-01-18 18:36 ` Stefan Monnier
2022-01-18 14:05 ` Stefan Monnier
2022-01-18 14:18 ` Robert Pluim
2022-01-17 21:03 ` Lars Ingebrigtsen
2022-01-18 0:46 ` Po Lu
2022-01-18 14:17 ` Eli Zaretskii
2022-01-18 18:40 ` Stefan Monnier
2022-01-18 19:34 ` Eli Zaretskii
2022-01-18 20:28 ` Stefan Monnier
2022-01-18 20:35 ` Alan Mackenzie
2022-01-18 20:50 ` Stefan Monnier
2022-01-19 11:10 ` Alan Mackenzie
2022-01-19 11:46 ` Eli Zaretskii
2022-01-19 16:50 ` Alan Mackenzie
2022-01-19 17:03 ` Eli Zaretskii
2022-01-19 21:32 ` Alan Mackenzie
2022-01-20 9:25 ` Robert Pluim
2022-01-20 11:35 ` Alan Mackenzie [this message]
2022-01-20 13:18 ` Robert Pluim
2022-01-20 14:54 ` Robert Pluim
2022-01-20 18:48 ` Alan Mackenzie
2022-01-20 22:29 ` Stefan Monnier
2022-01-21 8:17 ` Robert Pluim
2022-01-21 10:18 ` Stephen Leake
2022-01-21 10:42 ` David Engster
2022-01-21 10:51 ` Robert Pluim
2022-01-24 19:43 ` Andrea Corallo
2022-01-24 19:54 ` Eli Zaretskii
2022-01-24 20:15 ` Andrea Corallo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YelI9WQnP6UzUTAB@ACM \
--to=acm@muc.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=rpluim@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.