emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 e962cf4ba72: Fix building --with-native-compilation=aot from re


From: Eli Zaretskii
Subject: emacs-29 e962cf4ba72: Fix building --with-native-compilation=aot from release tarball
Date: Thu, 22 Jun 2023 07:04:27 -0400 (EDT)

branch: emacs-29
commit e962cf4ba726943b0f4ea57e1d740742e7618e3a
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix building --with-native-compilation=aot from release tarball
    
    * lisp/Makefile.in (%.eln): Pattern rule for AOT native
    compilation.
    (compile-eln-targets, compile-eln-aot): New targets for AOT native
    compilation.
    
    * src/Makefile.in (../native-lisp): If NATIVE_COMPILATION_AOT is
    set, also native-compile all the other Lisp files.
    (Bug#64167)
---
 lisp/Makefile.in | 36 ++++++++++++++++++++++++++++++++++++
 src/Makefile.in  |  8 ++++++++
 2 files changed, 44 insertions(+)

diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 1e0935f565f..0a534a278f7 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -436,6 +436,42 @@ ifeq ($(HAVE_NATIVE_COMP),yes)
        $(emacs) -l comp -f comp-compile-all-trampolines
 endif
 
+.PHONY: compile-eln-targets compile-eln-aot
+
+# ELNDONE is defined by ../src/Makefile, as the list of preloaded
+# *.eln files, which are therefore already compiled by the time
+# compile-eln-aot is called.
+ifeq ($(NATIVE_COMPILATION_AOT),yes)
+%.eln: %.el
+       $(AM_V_ELN)$(emacs) $(BYTE_COMPILE_FLAGS) \
+               -l comp -f byte-compile-refresh-preloaded \
+               --eval '(batch-native-compile t)' $<
+
+compile-eln-targets: $(filter-out $(ELNDONE),$(TARGETS))
+else
+compile-eln-targets:
+endif
+
+# This is called from ../src/Makefile when building a release tarball
+# configured --with-native-compilation=aot.
+compile-eln-aot:
+       @(cd $(lisp) &&                              \
+       els=`echo "${SUBDIRS_REL} " | 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_OPTIONS= grep '^;.*[^a-zA-Z]no-byte-compile: *t' $$el > 
/dev/null && \
+             continue;                              \
+         GREP_OPTIONS= grep '^;.*[^a-zA-Z]no-native-compile: *t' $$el > 
/dev/null && \
+             continue;                              \
+         echo "$${el}n";                            \
+       done | xargs $(XARGS_LIMIT) echo) |          \
+       while read chunk; do                         \
+         $(MAKE) compile-eln-targets                \
+             TARGETS="$$chunk" ELNDONE="$(ELNDONE)"; \
+       done
+
+
 .PHONY: backup-compiled-files compile-after-backup
 
 # Backup compiled Lisp files in elc.tar.gz.  If that file already
diff --git a/src/Makefile.in b/src/Makefile.in
index c29c3750e59..9bc53c072ea 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -872,6 +872,11 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) 
$(lisp:.elc=.eln)
 ## native-lisp where the *.eln files will be produced, and the exact
 ## names of those *.eln files, cannot be known in advance; we must ask
 ## Emacs to produce them.
+## If AOT native compilation is requested, we additionally
+## native-compile all the *.el files in ../lisp that need to be
+## compiled and haven't yet been compiled.  ELDONE holds the list
+## of *.el files that were already native-compiled.
+NATIVE_COMPILATION_AOT = @NATIVE_COMPILATION_AOT@
 ../native-lisp: | $(pdmp)
        @if test ! -d $@; then \
          mkdir $@ && $(MAKE) $(AM_V_NO_PD) $(elnlisp); \
@@ -882,6 +887,9 @@ elnlisp := $(addprefix ${lispsource}/,${elnlisp}) 
$(lisp:.elc=.eln)
                --bin-dest $(BIN_DESTDIR) --eln-dest $(ELN_DESTDIR) \
          && cp -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT) \
          && cp -f $(pdmp) $(bootstrap_pdmp); \
+         if test $(NATIVE_COMPILATION_AOT) = yes; then \
+           $(MAKE) $(AM_V_NO_PD) -C ../lisp compile-eln-aot 
EMACS="../src/emacs$(EXEEXT)" ELNDONE="$(addprefix %,$(notdir $(elnlisp))))"; \
+         fi; \
        fi
 endif
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]